/// <inheritdoc /> public override void Decode(MinecraftStream stream) { TeamName = stream.ReadString(); PacketMode = (Mode)stream.ReadByte(); switch (PacketMode) { case Mode.CreateTeam: var a = new CreateTeam(); a.Read(stream); Payload = a; break; case Mode.RemoveTeam: break; case Mode.UpdateTeam: var upd = new UpdateTeam(); upd.Read(stream); Payload = upd; break; case Mode.AddPlayer: var add = new AddPlayers(); add.Read(stream); Payload = add; break; case Mode.RemovePlayer: var remove = new RemovePlayers(); remove.Read(stream); Payload = remove; break; } }
// Use this for initialization void Start() { _joinGame = _getScripts.GetComponent <AddPlayers>(); for (int i = 0; i < _joinGame.currentPlayers; i++) { Instantiate(_players[i]); } }
public void AddPlayersSafe() { object _lock = new object(); lock (_lock) { AddPlayers.ForEach(o => Game.AddPlayer(o)); AddPlayers.Clear(); } }
public void AddNewUser(Player player, string jsonPlayerInfo) { try { PlayerInfo playerInfo = (PlayerInfo)JsonConvert.DeserializeObject(jsonPlayerInfo, typeof(PlayerInfo)); player.Name = playerInfo.Name; player.Colour = playerInfo.Colour; player.Symbol = playerInfo.Symbol; string jsonMap = JsonConvert.SerializeObject(Game.Map.ConvertToCharArray()); Server.SendMessage(player, jsonMap); AddPlayers.Add(player); Console.WriteLine(String.Format("Player {0} joined the game.", player.Name)); } catch (Exception e) { Console.WriteLine("{0} completely failed to enter there data correctly. Well done muppet"); } }
private void OnEnable() { instance = this; offsetMax = 180; inputCounter = playersHolder.transform.childCount - 1; }