Commit f06bb212 authored by Matyáš Latner's avatar Matyáš Latner

#323 Reset pozice naplánovaných akcí po chybě tak, aby byla viditelná poslední prováděná akce.

parent c5ec8323
...@@ -439,7 +439,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -439,7 +439,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
@Override @Override
protected void showGame() { protected void showGame() {
goToPlanningMode(); goToPlanningMode(null);
super.showGame(); super.showGame();
actionsWidget.showActions(); actionsWidget.showActions();
} }
...@@ -651,12 +651,12 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -651,12 +651,12 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
} }
} }
private void goToPlanningMode() { private void goToPlanningMode(Integer actionNumber) {
hideFadeLayer(); hideFadeLayer();
actionsStripWidget.setStartButtonState(); actionsStripWidget.setStartButtonState();
actionsWidget.enableActions(); actionsWidget.enableActions();
actionsStripWidget.enableControl(); actionsStripWidget.enableControl();
actionsStripWidget.displaySelectedActions(); actionsStripWidget.displaySelectedActions(actionNumber);
setMapWidgetsClickable(true); setMapWidgetsClickable(true);
planningStartTime = (int)scene.getSecondsElapsedTotal(); planningStartTime = (int)scene.getSecondsElapsedTotal();
} }
...@@ -801,7 +801,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -801,7 +801,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private void performaErrorAction() { private void performaErrorAction() {
errorCount++; errorCount++;
resetGameState(); resetGameState();
goToPlanningMode(); goToPlanningMode(Integer.valueOf(selectedActionPosition));
} }
private void unregisterUpdateHandler() { private void unregisterUpdateHandler() {
......
...@@ -108,7 +108,7 @@ public class ActionsStripWidget extends Entity implements ActionListener { ...@@ -108,7 +108,7 @@ public class ActionsStripWidget extends Entity implements ActionListener {
createNextActionField(); createNextActionField();
createOverlay(); createOverlay();
displaySelectedActions(); displaySelectedActions(null);
} }
...@@ -534,9 +534,17 @@ public class ActionsStripWidget extends Entity implements ActionListener { ...@@ -534,9 +534,17 @@ public class ActionsStripWidget extends Entity implements ActionListener {
return selectedActions; return selectedActions;
} }
public void displaySelectedActions() { public void displaySelectedActions(Integer actionNumber) {
showOverlay(false); showOverlay(false);
moveScrollPaneBottomToAction(0, null, true); int position = 0;
if (actionNumber != null && isScreenFilledWithActions(selectedActions.size())) {
position = actionNumber.intValue();
if (!isScreenFilledWithActions(selectedActions.size() - position)) {
moveScrollPaneTopToAction(selectedActions.size() + 1, null);
return;
}
}
moveScrollPaneBottomToAction(position, null, true);
} }
public void displayProcessedActions(int actionNumber, boolean useEaseFunction, IEntityModifierListener modifierListener) { public void displayProcessedActions(int actionNumber, boolean useEaseFunction, IEntityModifierListener modifierListener) {
...@@ -632,7 +640,11 @@ public class ActionsStripWidget extends Entity implements ActionListener { ...@@ -632,7 +640,11 @@ public class ActionsStripWidget extends Entity implements ActionListener {
} }
private boolean isScreenFilledWithActions() { private boolean isScreenFilledWithActions() {
return ((selectedActions.size() + 1) * (PotmeActivity.ACTION_SIZE_BIGGER + ACTION_OFFSET)) > height; return isScreenFilledWithActions(selectedActions.size() + 1);
}
private boolean isScreenFilledWithActions(int actionCount) {
return (actionCount * (PotmeActivity.ACTION_SIZE_BIGGER + ACTION_OFFSET)) > height;
} }
public int getCurrentActionOffset(int position) { public int getCurrentActionOffset(int position) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment