Newer
Older
IrisServer / src / main / java / com / ntlab / irisserver / entities / Game.java
package com.ntlab.irisserver.entities;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Game {

    private Map<Member, List<Integer>> assignments = new HashMap<>();//どのメンバーがどの絵(dno)を描いたか
    private Map<Integer, Drawing> drawingList = new HashMap<>();//dnoと絵の対応
    private Map<Integer, String> keywordList = new HashMap<>();//dnoとキーワードの対応
    private List<Integer> map = new ArrayList<>();//ランダムに決められたマップ上のdno
    private List<String> color = new ArrayList<>();//マップ上のカードの色
    private String turn = "none";//現在赤と青どちらのターンか
    private List<Boolean> opens = new ArrayList<>();//マップ上のカードの開閉状態

    private DrawingController drawingController = null;

    public Game(Room room) {
        List<Member> memberList = room.getMembers();
        //デバッグ用に値を追加
        int cnt = 0;
        for (int i=0; i<memberList.size(); i++){
            List<Integer> 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);
    }

    public DrawingController getDrawingController() {
        return drawingController;
    }

    public Drawing getDrawing(int dno) {
        Drawing d = drawingList.get(dno);
        return d;
    }

    public Map<Integer, Drawing> getDrawings(){
        return drawingList;
    }

    public Drawing putDrawing(int dno, Drawing drawing) {
        Drawing d = drawingList.put(dno, drawing);
        drawingController.update();
        return d;
    }

    public String getKeyword(int dno) {
        String keyword = keywordList.get(dno);
        return keyword;
    }

    public List<String> getKeywords() {
        List<String> keywords = new ArrayList<>(keywordList.values());
        return keywords;
    }

    public Map<Member, List<Integer>> getAssignments(){
        return assignments;
    }

    public List<Integer> getMap(){
        return map;
    }
    public List<String> getColor(){
        return color;
    }
    public String getTurn(){
        return turn;
    }

    public List<Boolean> getOpens(){
        return opens;
    }
}