public virtual void OnAddNewPlayer(AddNewPlayRequest args) { if (AddNewPlayer != null) { AddNewPlayer(args); } }
private void Client_AddNewPlayer(AddNewPlayRequest obj) { this.InvokeUI(() => { Button btn = new Button(); btn.Location = obj.Location; btn.Size = new Size(100, 150); btn.Text = obj.UserName; btn.Tag = obj.UserName; 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; btn.TabStop = false; this.pnl_AreaPark.Controls.Add(btn); }); }
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); }