private Manager(Client client) { this.mClient = client; // 初始化翻译机,与client双向绑定 mTranslator = new Translator(client.obtainMessagePoster()); mClient.registerObserver(mTranslator); // 初始化统计记录器 mTranslator.registerObserver(HandStatistics.getInstance()); // 初始化场景记录器 mSceneRecorder = new SceneRecorder(); mTranslator.registerObserver(mSceneRecorder); // 初始化决策者,与翻译机双向绑定 mTranslator.registerObserver(birth()); }
private void disconnect() { try { Client.disconnectFromServer(); } catch (IOException e) { e.printStackTrace(); return; } System.exit(0); }