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
ActionType.DOOR,
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 float FADE_DURATION = 0.4f;
......@@ -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() {
......@@ -976,11 +976,11 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
public int countProgress() {
if (!getPotmeDifficulty().hasResults()) {
return -1;
} else if (errorCount < 1) {
} else if (errorCount < 2) {
return 3;
} else if (errorCount < 3) {
} else if (errorCount < 4) {
return 2;
} else if (errorCount < 6) {
} else if (errorCount < 8) {
return 1;
} else {
return 0;
......
......@@ -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