Newer
Older
IrisServer / src / main / java / com / ntlab / irisserver / resources / SettingsRest.java
package com.ntlab.irisserver.resources;

import org.springframework.stereotype.Component;

import javax.ws.rs.*;

@Component
@Path("rooms")
public class SettingsRest {
    //お絵描きの制限時間、単位は秒、初期値は10
    int drawingTimerTimes = 10;
    //ゲーム画面での諜報員が考える時間の長さ、単位は秒、初期値30
    int gameTimerTimes = 30;
    //最初のヒントの追加考察時間、単位は秒、初期値10
    int gameTimerFirstThinkingTimes = 10;

    boolean drawingTimer = false;
    boolean gameTimer = true;
    /*
    RoomManager rm = RoomManager.getInstance();
    Room room = rm.getRoom();
    */
    @GET
    @Path("/{rid}/settings")
    public Object GetSettings(@PathParam("rid") String rid){

        return "drawingTime:" + drawingTimer + ",\n" +
                "drawingTimerTimes:" + drawingTimerTimes + ",\n" +
                "gameTimer:" + gameTimer +",\n" +
                "gameTimerTimes:" + gameTimerTimes + ",\n" +
                "gameTimerInitializeTimes:" + gameTimerFirstThinkingTimes;
    }

    @PUT
    @Path("/{rid}/settings")
    public void PutSettings(@PathParam("rid") String rid,
                              @FormParam("drawingTimer") boolean dTimer,
                              @FormParam("drawingTimerTimes") int dTimerTimes,
                              @FormParam("gameTimer") boolean gTimer,
                              @FormParam("gameTimerTimes") int gTimerTimes,
                              @FormParam("gameTimerFirstThinkingTimes") int gTimerFTTimes){
        drawingTimer = dTimer;
        drawingTimerTimes = dTimerTimes;
        gameTimer = gTimer;
        gameTimerTimes = gTimerTimes;
        gameTimerFirstThinkingTimes =gTimerFTTimes;

    }

    public void DrawingSetting(){
    }

    public void GameSetting(){
    }
}