public void removeGame(Game g) { GameInfo gi = map.get(g.getId()); gi.epArr[0].close(); epMap.remove(gi.epArr[0]); if (gi.epArr[1] != null) { gi.epArr[1].close(); epMap.remove(gi.epArr[1]); } map.remove(g.getId()); onGameListUpdate(); }
public Game create(String name, int nValue, int dropNumber, EndPoint ep) { GameInfo gi = new GameInfo(name, nValue, dropNumber, ep); Game g = gi.game; map.put(g.getId(), gi); epMap.put(ep, gi); onGameListUpdate(); return g; }
public boolean addEndPoint(Game g, EndPoint ep) { if (epMap.containsKey(ep)) return false; GameInfo gi = map.get(g.getId()); if (gi == null) return false; gi.epArr[1] = ep; epMap.put(ep, gi); return true; }
public boolean isMaster(Game g, EndPoint ep) { GameInfo gi = map.get(g.getId()); return gi.epArr[0].equals(ep); }
public void dispatch(Game g, EndPoint ep, Message msg) { map.get(g.getId()).bus.dispatch(ep, msg); }
public void subscribe(Game g, EndPoint ep, Class msgType) { map.get(g.getId()).bus.subscribe(ep, msgType); }