Exemplo n.º 1
0
 /**
  * Handles the add layer packet, (handler "ap"). This is so we can add a Data.Player to the room as they join.
  *
  * @param receivedPacket
  *   The packet to handle.
  */
 private void HandleAddPlayer(Data.PenguinPacket receivedPacket)
 {
     Data.Player newPlayer = new Data.Player();
     newPlayer.LoadData(receivedPacket.Xt.Arguments[0]);
     if (newPlayer.Id != ID)
     {
         currentRoom.AddPlayer(newPlayer);
     }
 }
Exemplo n.º 2
0
        /**
         * Handles the join room packet, (handler "jr"). This is so we can change the room numbers and load the new room object and Player objects.
         *
         * @param receivedPacket
         *   The packet to handle.
         */
        private void HandleJoinRoom(Data.PenguinPacket receivedPacket)
        {
            int    roomExtId = int.Parse(receivedPacket.Xt.Arguments[0]);
            string strName   = (roomExtId < 1000) ? Crumbs.Rooms.GetAttributeById(roomExtId, "name") : "Igloo";

            currentRoom.ChangeRoom(strName, receivedPacket.Xt.Room, roomExtId);
            for (int intIndex = 1; intIndex < receivedPacket.Xt.Arguments.Length; intIndex++)
            {
                Data.Player newPlayer = new Data.Player();
                newPlayer.LoadData(receivedPacket.Xt.Arguments[intIndex]);
                currentRoom.AddPlayer(newPlayer);
            }
        }