Exemple #1
0
        /// <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;
            }
        }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        _joinGame = _getScripts.GetComponent <AddPlayers>();

        for (int i = 0; i < _joinGame.currentPlayers; i++)
        {
            Instantiate(_players[i]);
        }
    }
Exemple #3
0
        public void AddPlayersSafe()
        {
            object _lock = new object();

            lock (_lock)
            {
                AddPlayers.ForEach(o => Game.AddPlayer(o));
                AddPlayers.Clear();
            }
        }
Exemple #4
0
        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");
            }
        }
Exemple #5
0
 private void OnEnable()
 {
     instance     = this;
     offsetMax    = 180;
     inputCounter = playersHolder.transform.childCount - 1;
 }