diff --git a/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java b/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java index 06f9ab3..e21c183 100644 --- a/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java +++ b/app/src/main/java/org/ntlab/irisclient/DrawingCardFragment.java @@ -54,6 +54,8 @@ private String nowTurn; private String rid; private Integer turnState = 1; // 0がヒント入力中 + private Integer OpenRedCard = 0; + private Integer OpenBlueCard = 0; // ロングタップで表示させるために必要。非同期で値が格納され、順番通りに保存されないからHashMapにしている private Map bmImages = new HashMap<>(); @@ -437,21 +439,55 @@ gameViewModel.sendOpenList(cno); if( colorList.get(cno).equals("d") ){ - System.out.println("黒引きました"); gameViewModel.sendEndState(); } else if ( colorList.get(cno).equals(myTeam) ){ - System.out.println("チームと同じなのでまだ引けます"); +// System.out.println("チームと同じなのでまだ引けます"); } else { if( myTeam.equals("r") ){ nowTurn = "b"; - System.out.println("青に切り替わり"); } else if( myTeam.equals("b") ){ nowTurn = "r"; - System.out.println("赤に切り替わり"); } + //ターン切り替え gameViewModel.addTurns(); } + //青と赤のカードが何枚めくれているか + if( colorList.get(cno).equals("r") ){ + OpenRedCard = 0; + nowOpenList.set(cno, true); + for( int i = 0; i < 16; i++ ){ + if( colorList.get(i).equals("r") && nowOpenList.get(i).equals(true) ){ + OpenRedCard += 1; + } + } + nowOpenList.set(cno, false); + System.out.println("OpenRedCard:" + OpenRedCard); + + if( OpenRedCard >= 6 ){ + nowTurn = "b"; + finishGameAlertMake(myTeam, nowTurn); + } + + } + if( colorList.get(cno).equals("b") ){ + OpenBlueCard = 0; + nowOpenList.set(cno, true); + for( int i = 0; i < 16; i++ ){ + if( colorList.get(i).equals("b") && nowOpenList.get(i).equals(true) ){ + OpenBlueCard += 1; + } + } + nowOpenList.set(cno, false); + + System.out.println("OpenBlueCard: " + OpenBlueCard); + + if( OpenBlueCard >= 5 ){ + nowTurn = "r"; + finishGameAlertMake(myTeam, nowTurn); + } + } + } }