diff --git a/.idea/misc.xml b/.idea/misc.xml index a65c3ba..840b3f6 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -43,4 +43,7 @@ + + \ No newline at end of file diff --git a/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java b/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java index 1138b61..56f480b 100644 --- a/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java +++ b/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java @@ -24,7 +24,7 @@ private String team; private String hint; private Integer max; - private Integer openlist; + private List openList; final private MutableLiveData turnsMutableLiveData; final private MutableLiveData turnMutableLiveData; @@ -45,10 +45,12 @@ public GameViewModel() { this.turnsMutableLiveData = new MutableLiveData<>(); this.turnMutableLiveData = new MutableLiveData<>(); + this.mapMutableLiveData = new MutableLiveData<>(); + this.colorMutableLiveData = new MutableLiveData<>(); this.opensMutableLiveData = new MutableLiveData<>(); - this.mapMutableLiveData = new MutableLiveData<>(); this.imageMutableLiveData = new MutableLiveData<>(); + this.retrofit = new Retrofit.Builder() .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/iris/") .addConverterFactory(JacksonConverterFactory.create()) @@ -60,13 +62,15 @@ public void setRid(String rid) { this.rid = rid; } -// public void setCno(Integer cno) { -// this.cno = cno; -// } public void putHint(String hint, int max) { this.hint = hint; this.max = max; + updateTurn(); + } + + public void setOpenList(Integer cno) { + this.cno = cno; } @@ -78,18 +82,18 @@ public LiveData getTurnLiveData() { return this.turnMutableLiveData; } - public LiveData> getColorLiveData() { - return this.colorMutableLiveData; - } +// public LiveData> getColorLiveData() { +// return this.colorMutableLiveData; +// } public LiveData> getOpenLiveData() { return this.opensMutableLiveData; } - public LiveData> getMapLiveData() { - return this.mapMutableLiveData; - } - public LiveData getImageLiveData() { - return this.imageMutableLiveData; - } +// public LiveData> getMapLiveData() { +// return this.mapMutableLiveData; +// } +// public LiveData getImageLiveData() { +// return this.imageMutableLiveData; +// } public GameJson getGame() { return game; } @@ -106,7 +110,7 @@ @Override public void update() { updateTurns(rid); - updateTurn(rid); + //updateTurn(rid); updateOpens(rid); } @@ -141,8 +145,8 @@ }); } - //hint,openlist,maxの取得 - public void updateTurn(String rid) { + //hint,openList,maxの更新 + public void updateTurn() { final GameRest gameRest = retrofit.create(GameRest.class); Call call = gameRest.putHint(rid, tno, hint, max); @@ -154,7 +158,7 @@ //初回代入 turnMutableLiveData.setValue(response.body()); turnPreData = response.body(); - }if(response.body().equals(turnPreData)){ + }else if(response.body().equals(turnPreData)){ //値が一緒なら書き換えない }else{ //値が異なるときのみライブデータを上書き @@ -193,7 +197,7 @@ }); } - //現在開いているすべてのカードを取得 + //現在開いているすべてのカードを取得([tffftffffftttff]みたいなリストを逐一更新する、マスが開くたびに更新) public void updateOpens(String rid) { final GameRest gameRest = retrofit.create(GameRest.class); Call> call = gameRest.getOpens(rid); @@ -206,7 +210,7 @@ //初回代入 opensMutableLiveData.setValue(response.body()); opensPreData = response.body(); - }if(response.body().equals(turnPreData)){ + }else if(response.body().equals(turnPreData)){ //値が一緒なら書き換えない }else{ //値が異なるときのみライブデータを上書き @@ -266,4 +270,5 @@ }); } + }