private void continueConversation(DialogBox last) { DialogBox next; currentDialog++; if (currentDialog == conversation.length) { for (DialogBox value : people.values().toArray()) value.setCallback(null); if (callback != null) callback.onCompleted(); return; } next = people.get(speakingOrder[currentDialog]); next.setText(conversation[currentDialog]); last.setVisible(false); next.setVisible(true); }
public void startConversation() { currentDialog = 0; for (DialogBox value : people.values().toArray()) { value.setVisible(false); value.setCallback( new DialogCallback() { @Override public void onEvent(int type, DialogBox source) { if (type == DialogCallback.CLICKED_AFTER_END) continueConversation(source); } }); } DialogBox first = people.get(speakingOrder[currentDialog]); first.setText(conversation[currentDialog]); first.setVisible(true); }