/// <summary>
 /// Játék indítás
 /// </summary>
 /// <param name="player">Indító játékos</param>
 public void StartGame(Player player)
 {
     ConnectionEnabled = false;
     player.IsCzar     = true;
     CzarPlayer        = player.Nickname;
     CardService.StartCardDivision();
     for (int i = 0; i < 10; i++)
     {
         CzarCard = Rng.Next(1, DataStore.BlackCardsById.Count);
         PacketSendUtility.SendPackBroadcast(this.Players.Values, new SM_CZAR_CARD(DataStore.BlackCardsById[CzarCard]));
         foreach (Player playerr in this.Players.Values)
         {
             playerr.SelectCards = new List <int>();
         }
         SelectedCardCount = 0;
         do
         {
             Thread.Sleep(200);
         } while (SelectedCardCount != Players.Count - 1);
         SelectedCardCount = 0;
         CardService.SelectedCardsSend(Players[CzarPlayer], CzarCard);
         do
         {
             Thread.Sleep(200);
         } while (SelectedCardCount != 1);
         CardService.SelectedCardSend()
     }
 }
Example #2
0
        public static void SelectedCardSend(int[] CzarCards)
        {
            IEnumerable <Player> players = GameService.Instance.Players.Values;
            List <CardTemplate>  cards   = new List <CardTemplate>();

            foreach (int id in CzarCards)
            {
                cards.Add(DataStore.BlackCardsById[id]);
            }
            PacketSendUtility.SendPackBroadcast(players, new SM_SELECTED_CARD(cards));
        }
Example #3
0
        public static void SelectedCardsSend(Player Czar, int CzarCard)
        {
            IEnumerable <Player> players  = GameService.Instance.Players.Values;
            CardTemplate         czarCard = DataStore.BlackCardsById[CzarCard];
            List <CardTemplate>  cards    = new List <CardTemplate>();

            foreach (Player player in players)
            {
                foreach (int id in player.SelectCards)
                {
                    cards.Add(DataStore.WhileCardsById[id]);
                }
            }
            PacketSendUtility.SendPack(Czar, new SM_SELECTED_CARDS(cards, czarCard.CardCount));
        }
Example #4
0
        public static void StartCardDivision()
        {
            IEnumerable <Player> players = GameService.Instance.Players.Values;
            List <CardTemplate>  cards;
            int id, count = DataStore.WhileCardsById.Count;

            foreach (Player player in players)
            {
                cards = new List <CardTemplate>();
                for (int i = 0; i < 10; i++)
                {
                    id = Rng.Next(1, count);
                    cards.Add(DataStore.WhileCardsById[id]);
                    player.WhileCards.Add(id);
                }
                PacketSendUtility.SendPack(player, new SM_PLAYER_CARD_INFO(cards, true));
            }
        }
 /// <summary>
 /// Játékos kilépés
 /// </summary>
 /// <param name="player"></param>
 public void OffPlayer(Player player)
 {
     PacketSendUtility.SendPackBroadcast(player, new SM_PLAYER_INFO(player.Nickname, false), false);
     Players.Remove(player.Nickname);
 }
 /// <summary>
 /// Játékos belépés
 /// </summary>
 /// <param name="player"></param>
 public void OnPlayer(Player player)
 {
     Players.Add(player.Nickname, player);
     PacketSendUtility.SendPackBroadcast(player, new SM_PLAYER_INFO(player.Nickname, true));
 }