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
@Override
protected void showGame() {
goToPlanningMode();
goToPlanningMode(null);
super.showGame();
actionsWidget.showActions();
}
......@@ -651,12 +651,12 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
}
private void goToPlanningMode() {
private void goToPlanningMode(Integer actionNumber) {
hideFadeLayer();
actionsStripWidget.setStartButtonState();
actionsWidget.enableActions();
actionsStripWidget.enableControl();
actionsStripWidget.displaySelectedActions();
actionsStripWidget.displaySelectedActions(actionNumber);
setMapWidgetsClickable(true);
planningStartTime = (int)scene.getSecondsElapsedTotal();
}
......@@ -801,7 +801,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private void performaErrorAction() {
errorCount++;
resetGameState();
goToPlanningMode();
goToPlanningMode(Integer.valueOf(selectedActionPosition));
}
private void unregisterUpdateHandler() {
......
......@@ -108,7 +108,7 @@ public class ActionsStripWidget extends Entity implements ActionListener {
createNextActionField();
createOverlay();
displaySelectedActions();
displaySelectedActions(null);
}
......@@ -534,9 +534,17 @@ public class ActionsStripWidget extends Entity implements ActionListener {
return selectedActions;
}
public void displaySelectedActions() {
public void displaySelectedActions(Integer actionNumber) {
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) {
......@@ -632,7 +640,11 @@ public class ActionsStripWidget extends Entity implements ActionListener {
}
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) {
......
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