Пример #1
0
 /// <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()
     }
 }
Пример #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));
        }
Пример #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));
        }
Пример #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));
            }
        }
Пример #5
0
 /// <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);
 }
Пример #6
0
 /// <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));
 }