/// <summary> /// Попытка подключения к серверу /// </summary> /// <param name="name"></param> /// <param name="myPort"></param> /// <param name="remotePort"></param> /// <param name="remoteIpAddress"></param> public void ConnectToServer(string name, string myPort, string remotePort, string remoteIpAddress) { this.myPort = Convert.ToInt32(myPort); this.remotePort = Convert.ToInt32(remotePort); sender = new UdpClient(this.myPort); this.remoteIPAddress = IPAddress.Parse(remoteIpAddress); endPoint = new IPEndPoint(this.remoteIPAddress, this.remotePort); myPlayer = new HumanPlayer(name); DelegatesData.HandlerPlayerIsMoreThanEnough = new DelegatesData.PlayerIsMoreThanEnough(TurnComesToNextPlayer); try { sender.Connect(endPoint); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } Thread thread = new Thread(Listener); thread.IsBackground = true; thread.Start(); }
/// <summary> /// Внешний вид карт на столе /// </summary> /// <param name="curPlayer">Текущий игрок</param> void CardViewCreate(HumanPlayer curPlayer) { StackplayersCard.Children.Clear(); foreach (CardDeck.CardFactory card in curPlayer.cardsOnHand.gameDeck) { StackplayersCard.Children.Add(GetImagePicture(card)); } }
/// <summary> /// Внешний вид стола без учета карт /// </summary> /// <param name="curPlayer">Текущий игрок</param> void NonCardViewCreate(HumanPlayer curPlayer) { TextBlockName.Text = curPlayer.playersName; TextBlockScore.Text = curPlayer.GetPlayersPoints().ToString(); }