Commit 82f27745 authored by Luboš Horáček's avatar Luboš Horáček

Merge branch 'feature-potme' into 'devel'

Feature potme

See merge request !46
parents 546f069c 4ba86765
...@@ -149,7 +149,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -149,7 +149,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
ActionType.DOOR, ActionType.DOOR,
ActionType.GO}); ActionType.GO});
private static final boolean SHOW_DEBUGINFO_RULE = true; private static final boolean SHOW_DEBUGINFO_RULE = false;
private static final int INITIAL_MAP_WIDGET = 0; private static final int INITIAL_MAP_WIDGET = 0;
private static final float FADE_DURATION = 0.4f; private static final float FADE_DURATION = 0.4f;
...@@ -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() {
...@@ -976,11 +976,11 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -976,11 +976,11 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
public int countProgress() { public int countProgress() {
if (!getPotmeDifficulty().hasResults()) { if (!getPotmeDifficulty().hasResults()) {
return -1; return -1;
} else if (errorCount < 1) { } else if (errorCount < 2) {
return 3; return 3;
} else if (errorCount < 3) { } else if (errorCount < 4) {
return 2; return 2;
} else if (errorCount < 6) { } else if (errorCount < 8) {
return 1; return 1;
} else { } else {
return 0; return 0;
......
...@@ -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