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 b2bf511..fc27d90 100644 --- a/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java +++ b/app/src/main/java/org/ntlab/irisclient/viewmodels/GameViewModel.java @@ -35,8 +35,6 @@ //更新比較用フィールド private String turnsPreData = null; private TurnJson turnPreData = null; - private List colorPreData = null; - private List mapPreData = null; //------------------------------------------------------------------ //コンストラクタ @@ -71,12 +69,15 @@ public LiveData getTurnLiveData() { return this.turnMutableLiveData; } - public LiveData> getcolorLiveData() { + public LiveData> getColorLiveData() { return this.colorMutableLiveData; } - public LiveData> getmapLiveData() { + public LiveData> getMapLiveData() { return this.mapMutableLiveData; } + public void getGame() { + return; + } // public Integer getTurnNumber(){ // return tno; // } @@ -84,8 +85,8 @@ //----------------------------------------------------------------------------- // updates public void init() { - updatecolor(rid); - updatemap(rid); + updateColor(rid); + updateMap(rid); } @Override public void update() { @@ -156,7 +157,7 @@ } //カードのカラー(r,b,g,d)の取得 - public void updatecolor(String rid) { + public void updateColor(String rid) { final GameRest gameRest = retrofit.create(GameRest.class); Call> call = gameRest.getColor(rid); @@ -164,17 +165,7 @@ @Override public void onResponse(Call> call, Response> response) { if (response.isSuccessful()){ - if(colorPreData == null){ - //初回代入 - colorMutableLiveData.setValue(response.body()); - colorPreData = response.body(); - }if(response.body().equals(colorPreData)){ - //値が一緒なら書き換えない - }else{ - //値が異なるときのみライブデータを上書き - colorMutableLiveData.setValue(response.body()); - colorPreData = response.body(); - } + colorMutableLiveData.setValue(response.body()); } } @@ -187,25 +178,15 @@ } //カードの並び順の取得 - public void updatemap(String rid) { + public void updateMap(String rid) { final GameRest gameRest = retrofit.create(GameRest.class); Call> call = gameRest.getMap(rid); call.enqueue(new Callback>() { @Override public void onResponse(Call> call, Response> response) { - if (response.isSuccessful()){ - if(mapPreData == null){ - //初回代入 - mapMutableLiveData.setValue(response.body()); - mapPreData = response.body(); - }if(response.body().equals(mapPreData)){ - //値が一緒なら書き換えない - }else{ - //値が異なるときのみライブデータを上書き - mapMutableLiveData.setValue(response.body()); - mapPreData = response.body(); - } + if (response.isSuccessful()) { + mapMutableLiveData.setValue(response.body()); } }