mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Refactor conversations to state machine - minor bugfixes for "next" button disabling.
This commit is contained in:
@@ -87,13 +87,15 @@ public final class Dialogs {
|
||||
}
|
||||
|
||||
public static void addMonsterIdentifiers(Intent intent, Monster monster) {
|
||||
addMonsterIdentifiers(intent.getExtras(), monster);
|
||||
if (monster == null) return;
|
||||
intent.putExtra("x", monster.position.x);
|
||||
intent.putExtra("y", monster.position.y);
|
||||
}
|
||||
public static void addMonsterIdentifiers(Bundle bundle, Monster monster) {
|
||||
if (monster == null) return;
|
||||
bundle.putInt("x", monster.position.x);
|
||||
bundle.putInt("y", monster.position.y);
|
||||
}
|
||||
if (monster == null) return;
|
||||
bundle.putInt("x", monster.position.x);
|
||||
bundle.putInt("y", monster.position.y);
|
||||
}
|
||||
|
||||
public static Monster getMonsterFromIntent(Intent intent, final WorldContext world) {
|
||||
return getMonsterFromBundle(intent.getExtras(), world);
|
||||
|
||||
@@ -91,8 +91,9 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
nextButtonClicked();
|
||||
}
|
||||
});
|
||||
nextButton.setEnabled(false);
|
||||
|
||||
statementList.setOnKeyListener(this);
|
||||
statementList.setOnKeyListener(this);
|
||||
|
||||
statementList.setSelected(false);
|
||||
statementList.setFocusable(false);
|
||||
@@ -193,11 +194,12 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
}
|
||||
|
||||
private void nextButtonClicked() {
|
||||
RadioButton rb = getSelectedReplyButton();
|
||||
replyGroup.removeAllViews();
|
||||
if (conversationState.hasOnlyOneNextReply()) {
|
||||
nextButton.setEnabled(false);
|
||||
if (conversationState.hasOnlyOneNextReply()) {
|
||||
conversationState.playerSelectedNextStep();
|
||||
} else {
|
||||
RadioButton rb = getSelectedReplyButton();
|
||||
if (rb == null) return;
|
||||
Reply r = (Reply) rb.getTag();
|
||||
addConversationStatement(player, rb.getText().toString());
|
||||
@@ -391,7 +393,5 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
rb.setFocusable(false);
|
||||
rb.setFocusableInTouchMode(false);
|
||||
replyGroup.addView(rb, layoutParams);
|
||||
|
||||
nextButton.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user