diff --git a/src/main/java/com/ntlab/irisserver/entities/Game.java b/src/main/java/com/ntlab/irisserver/entities/Game.java index c127387..36d4490 100644 --- a/src/main/java/com/ntlab/irisserver/entities/Game.java +++ b/src/main/java/com/ntlab/irisserver/entities/Game.java @@ -4,50 +4,58 @@ public class Game { - private Map> assignments = new HashMap<>(); - private Map drawingList = new HashMap<>(); - private Map keywordList = new HashMap<>(); - private List map = new ArrayList<>(); - private List color = new ArrayList<>(); - //private String turn = "none"; - private List opens = new ArrayList<>(); + private Map> assignments = new HashMap<>();//> + private Map drawingList = new HashMap<>();// + private Map keywordList = new HashMap<>();// + private Map cellList = new HashMap<>();// + + private List map = new ArrayList<>();//cno順にdnoを管理 + private List color = new ArrayList<>();//cno順にr,g,b,dを管理 + private List opens = new ArrayList<>();//cno順にカードの開閉状態を管理 + private List turnList = new ArrayList<>(); + + private Turn nowTurn = null;//現在のターン private DrawingController drawingController = null; private Settings settings = null; - private List turnList = new ArrayList<>(); - private Turn nowTurn = null; - private Map cellList = new HashMap<>();// public Game(Room room) { - this.settings = room.getSettings(); + List memberList = room.getMembers(); + int num = 16/memberList.size();//一人あたりが確実に採用されるイラスト枚数 + int cnt = 0; + for(int i=0; i dnoList = new ArrayList<>();//一人が描くイラストのdnoリスト + for(int j=0; j dnoList = assignments.get(memberList.get(i)); + dnoList.add(cnt); + cnt++; + assignments.put(memberList.get(i), dnoList); + } + for(int i=0; i<16; i++) map.add(i); Collections.shuffle(map);//0~15のdnoをランダムにマップに割り振る - //r:6 b:5 g:4, d:1 + //r:6 b:5 g:4 d:1 for(int i=0; i<6; i++) color.add("r"); for(int i=0; i<5; i++) color.add("b"); for(int i=0; i<4; i++) color.add("g"); color.add("d"); - Collections.shuffle(color);//r,b,g,dをランダムにマップに割り振る - List memberList = room.getMembers(); - - - //デバッグ用に値を追加 - int cnt = 0; - for (int i=0; i dnos = new ArrayList<>(); - for(int j=0; j<3; j++){ - dnos.add(cnt); - cnt++; - } - assignments.put(memberList.get(i), dnos); - } - // drawingController = new DrawingController(room, room.getMembers(), this); + this.settings = room.getSettings(); - for(int i=0; i<16; i++){//Cellのインスタンス作成 + //Cellのインスタンス作成 + for(int i=0; i<16; i++){ Cell c = new Cell(); cellList.put(i, c); c.setCno(i); @@ -105,6 +113,7 @@ public List getOpens(){ return opens; } + public Settings getSettings(){ return this.settings; } @@ -122,4 +131,8 @@ public Turn getTurn(Integer num){ return turnList.get(num); } + + public Integer getNowTurn(){//現在何ターン目か取得 + return turnList.size()-1; + } }