diff --git a/src/main/java/com/ntlab/irisserver/resources/SettingsRest.java b/src/main/java/com/ntlab/irisserver/resources/SettingsRest.java index 5c5616c..d96b8d6 100644 --- a/src/main/java/com/ntlab/irisserver/resources/SettingsRest.java +++ b/src/main/java/com/ntlab/irisserver/resources/SettingsRest.java @@ -1,5 +1,7 @@ package com.ntlab.irisserver.resources; +import com.ntlab.irisserver.entities.Room; +import com.ntlab.irisserver.models.RoomManager; import org.springframework.stereotype.Component; import javax.ws.rs.*; @@ -18,26 +20,26 @@ boolean drawingTimer = false; boolean gameTimer = true; - /* + RoomManager rm = RoomManager.getInstance(); - */ + @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{rid}/settings") - public Object GetSettings(@PathParam("rid") String rid){ + public Object GetSettings(@PathParam("rid") String rid) { var response = Response.status(Response.Status.NO_CONTENT); - //Room r = rm.getRoom(rid); + Room r = rm.getRoom(rid); + //部屋が存在しない - /* if(r == null) { response.status(404).entity("部屋が存在しません"); throw new WebApplicationException(response.build()); } - */ + return "drawingTime:" + drawingTimer + ",\n" + "drawingTimerTimes:" + drawingTimerTimes + ",\n" + @@ -53,13 +55,15 @@ @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; + @FormParam("gameTimerFirstThinkingTimes") int gTimerFTTimes) { + Room r = rm.getRoom(rid); + + r.setDrawingTimer(dTimer); + r.setDrawingTimerTimes(dTimerTimes); + r.setGameTimer(gTimer); + r.setGameTimerTimes(gTimerTimes); + r.setGameTimerFirstThinkingTimes(gTimerFTTimes); } public void DrawingSetting(){