private MsgAddPlayer BuildPlayerAdd(ServerPlayer player) { MsgAddPlayer add = new MsgAddPlayer(); add.PlayerID = player.PlayerID; add.Callsign = player.Callsign; add.Team = player.ActualTeam; add.Motto = player.Motto; add.PlayerType = 0; add.Wins = player.Info.Score.Wins; add.Losses = player.Info.Score.Losses; add.TeamKills = player.Info.Score.TeamKills; return(add); }
public void HandleAddPlayer(NetworkMessage msg) { MsgAddPlayer ap = msg as MsgAddPlayer; if (!PlayerList.ContainsKey(ap.PlayerID)) { if (LocalPlayerID == ap.PlayerID) { PlayerList.Add(ap.PlayerID, new LocalPlayer(null)); } else { PlayerList.Add(ap.PlayerID, new Player()); } } Player player = PlayerList[ap.PlayerID]; player.PlayerID = ap.PlayerID; player.Callsign = ap.Callsign; player.Motto = ap.Motto; player.PlayerType = (PlayerTypes)ap.PlayerType; player.Team = ap.Team; player.Wins = ap.Wins; player.Losses = ap.Losses; player.TeamKills = ap.TeamKills; if (player.IsLocalPlayer) // hey it's us! { Me = player as LocalPlayer; if (SelfAdded != null) { SelfAdded.Invoke(this, player); } } if (PlayerAdded != null) { PlayerAdded.Invoke(this, player); } }
private static void HandleAddPlayer(NetworkMessage msg) { MsgAddPlayer ap = msg as MsgAddPlayer; WriteLine("Player Added " + ap.Callsign + "(" + ap.PlayerID.ToString() + ")"); }