package org.example.handler;

import com.nhn.gameanvil.common.GameAnvilController;
import com.nhn.gameanvil.game.GameRoomMapping;
import com.nhn.gameanvil.game.IRoomDispatchContext;
import com.nhn.gameanvil.packet.Packet;
import org.example.game.BasicRoom;
import protocol.Puzzle;

@GameAnvilController
public class PuzzlePositionHandler {

    @GameRoomMapping(value = Puzzle.PuzzlePosition.class, loadClass =  BasicRoom.class)
    public void execute(IRoomDispatchContext ctx, Puzzle.PuzzlePosition request) {
        BasicRoom room = ctx.getRoom();
        room.puzzlePositions.put(request.getIndex(), request);
        room.broadcast(Packet.makePacket(request));
    }
}
