public virtual void OnJoinPublicParkResponse(JoinPublicParkResponse args) { if (JoinPPResponse != null) { JoinPPResponse(args); } }
public void JoinPublicParkRequestHandler(JoinPublicParkRequest request) { this.Status = StatusEnum.InPublicPark; this.LocationPP = new Point(0, 0); AddNewPlayRequest playRequest = new AddNewPlayRequest(this.Email, this.LocationPP); foreach (Receiver receiver in Server.Receivers.Where(x => x != this)) { if (receiver.Status == StatusEnum.InPublicPark) { receiver.SendMessage(playRequest); } } JoinPublicParkResponse response = new JoinPublicParkResponse(request, GetAllPlayerInPublicPark(Server.Receivers), this.Email, this.LocationPP); this.SendMessage(response); }
private void Client_JoinPPResponse(JoinPublicParkResponse obj) { this.InvokeUI(() => { foreach (KeyValuePair <String, Point> kvp in obj.ListOtherPlayer) { Button btn = new Button(); btn.Size = new Size(100, 150); btn.Text = kvp.Key; btn.Tag = kvp.Key; btn.Location = kvp.Value; btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderSize = 0; btn.FlatAppearance.MouseDownBackColor = btn.FlatAppearance.MouseOverBackColor = Color.Transparent; btn.Image = global::DCN.TicTacToe.UI.Client.Client_Resx.avatar_public_park; btn.ImageAlign = ContentAlignment.BottomCenter; btn.TextAlign = ContentAlignment.TopCenter; this.pnl_AreaPark.Controls.Add(btn); } Button btnCurrentPlayer = new Button(); btnCurrentPlayer.Size = new Size(100, 150); btnCurrentPlayer.Text = obj.UserNameCurrent; btnCurrentPlayer.Tag = obj.UserNameCurrent; btnCurrentPlayer.Location = obj.LocationCurrent; btnCurrentPlayer.FlatStyle = FlatStyle.Flat; btnCurrentPlayer.FlatAppearance.BorderSize = 0; btnCurrentPlayer.FlatAppearance.MouseDownBackColor = btnCurrentPlayer.FlatAppearance.MouseOverBackColor = Color.Transparent; btnCurrentPlayer.Image = global::DCN.TicTacToe.UI.Client.Client_Resx.avatar_public_park; btnCurrentPlayer.ImageAlign = ContentAlignment.BottomCenter; btnCurrentPlayer.TextAlign = ContentAlignment.TopCenter; btnCurrentPlayer.LocationChanged += Btn_LocationChanged; this.pnl_AreaPark.Controls.Add(btnCurrentPlayer); this.userName = obj.UserNameCurrent; }); }