예제 #1
0
        void data(NetIncomingMessage incomingMessage)
        {
            Player player = connections[incomingMessage.SenderConnection.GetHashCode()];

            switch (incomingMessage.ReadString())
            {
            case "createRoom":
                player.createRoom();
                break;

            case "getAllRooms":
                player.getAllRooms();
                break;

            case "getRoomInfo":
                player.getRoomInfo(incomingMessage.ReadInt32());
                break;

            case "joinRoom":
                player.joinRoom(incomingMessage.ReadInt32());
                break;

            case "leaveAllRooms":
                player.leaveAllRooms();
                break;

            case "leaveRoom":
                player.leaveRoom(incomingMessage.ReadInt32());
                break;

            case "setName":
                player.setName(incomingMessage.ReadString());
                break;

            case "update":
                player.update(incomingMessage.ReadString());
                break;
            }
        }