Changed Tutorials

This commit is contained in:
=
2017-11-26 16:01:46 +01:00
parent 18ea4042e9
commit b954e14934
29 changed files with 536 additions and 499 deletions

View File

@ -21,41 +21,7 @@
</stars>
<energy x="12.2500305" y="-0.45333368"/>
</level>
<level packId="1" id="2" goalX="23.896725" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="1.6130004" width="9.226001"/>
<tileData x="12.257368" width="10.486735"/>
<tileData x="20.768412" width="4.751354"/>
<tileData x="25.874727" width="4.7972755"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="10.448362" width="26.896725"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData floating="false" moving="false" deadly="false" leftEdge="3.2166634" rightEdge="6.2166634" height="0.293" y="-0.45350003">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="14.9867525" rightEdge="15.406753" height="0.535" y="-0.3325">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="15.435268" rightEdge="17.498268" height="0.484" y="-0.35800004">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="23.488386" rightEdge="24.138388" height="0.331" y="-0.43450004">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="12.025399" rightEdge="14.681399" height="0.204" y="-0.49800003">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
</obstacles>
<stars class="java.util.ArrayList">
<positionData x="6.626662" y="-0.5666664"/>
<positionData x="14.833428" y="-0.4399998"/>
<positionData x="17.97675" y="-0.5133334"/>
</stars>
<energy x="16.436743" y="-0.37333328"/>
</level>
<level packId="1" id="3" goalX="24.896633" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<level packId="1" id="2" goalX="24.896633" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="2.9376845" width="11.875369"/>
<tileData x="14.498707" width="3.6946783"/>
@ -104,7 +70,7 @@
</stars>
<energy x="9.043368" y="-0.8999996"/>
</level>
<level packId="1" id="4" goalX="23.086607" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<level packId="1" id="3" goalX="23.086607" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-0.27333355" width="5.453333"/>
<tileData x="10.081098" width="5.255528"/>
@ -159,7 +125,7 @@
</stars>
<energy x="17.006697" y="-0.41333315"/>
</level>
<level packId="1" id="5" goalX="23.089874" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<level packId="1" id="4" goalX="23.089874" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-0.22666693" width="5.546666"/>
<tileData x="5.158922" width="4.104512"/>
@ -209,6 +175,40 @@
</stars>
<energy x="19.086668" y="-0.81333315"/>
</level>
<level packId="1" id="5" goalX="23.896725" startSpeed="0.4" endSpeed="0.4" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="1.6130004" width="9.226001"/>
<tileData x="12.257368" width="10.486735"/>
<tileData x="20.768412" width="4.751354"/>
<tileData x="25.874727" width="4.7972755"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="10.448362" width="26.896725"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData floating="false" moving="false" deadly="false" leftEdge="3.2166634" rightEdge="6.2166634" height="0.293" y="-0.45350003">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="14.9867525" rightEdge="15.406753" height="0.535" y="-0.3325">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="15.435268" rightEdge="17.498268" height="0.484" y="-0.35800004">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="23.488386" rightEdge="24.138388" height="0.331" y="-0.43450004">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="12.025399" rightEdge="14.681399" height="0.204" y="-0.49800003">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
</obstacles>
<stars class="java.util.ArrayList">
<positionData x="6.626662" y="-0.5666664"/>
<positionData x="14.833428" y="-0.4399998"/>
<positionData x="17.97675" y="-0.5133334"/>
</stars>
<energy x="16.436743" y="-0.37333328"/>
</level>
<level packId="1" id="6" goalX="16.046711" startSpeed="0.45" endSpeed="0.45" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="2.367918" width="10.735836"/>

View File

@ -37,7 +37,6 @@ import de.frajul.endlessroll.rendering.renderer.GameRenderer;
import de.frajul.endlessroll.sounds.SoundManager;
import de.frajul.endlessroll.sqlDatabase.MyDatabase;
import de.frajul.endlessroll.user.User;
import de.frajul.endlessroll.views.GoalMessage;
import de.frajul.endlessroll.views.LevelupMessage;
import de.frajul.endlessroll.views.TaskCompletedMessage;
@ -94,6 +93,7 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
levelManager = new LevelManager(this, dataStorageHandler);
tutorialManager = new TutorialManager(this);
tutorialManager.getToolShopTutorial().setFinished(dataStorageHandler.readToolShopTutorialFinished());
this.glSurfaceView = new MyGlSurfaceView(this, new GameRenderer(this));
typeface = Typeface.createFromAsset(getAssets(), "fontBaron.ttf");
@ -165,6 +165,7 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
levelupMessage.show(level);
}
});
tutorialManager.onLvUp(user);
}
public void onTasksCompleted(final List<PlayerShape> shapes) {
@ -176,7 +177,10 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
});
}
public void showTutorialScreen(final List<BreakPoint> breakPoints) {
public void showTutorial(final List<BreakPoint> breakPoints) {
if(!gameScreen.isLevelFinished()){
gameScreen.setGamePausedWithoutMenu();
}
runOnUiThread(new Runnable() {
@Override
public void run() {
@ -195,7 +199,7 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
dataStorageHandler.writeUserData(user);
dataStorageHandler.writeToolShopTutorialFinished(false);
levelManager.reset();
tutorialManager.getToolShopTutorial().setFinished(false);
tutorialManager.resetAllTutorials();
MyDatabase database = dataStorageHandler.getDatabase();
database.open();
database.clearLevelProgess();

View File

@ -25,7 +25,6 @@ import de.frajul.endlessroll.main.GameHandler;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.physics.Physics;
import de.frajul.endlessroll.main.screens.Screen;
import de.frajul.endlessroll.main.tutorial.Tutorial;
import de.frajul.endlessroll.rendering.Rendering;
import de.frajul.endlessroll.sqlDatabase.MyDatabase;
import de.frajul.endlessroll.views.ToolButton;
@ -55,8 +54,6 @@ public class Game extends Rendering<GameScene> {
private List<Integer> collectedStars = new ArrayList<>();
private boolean energyCollected;
private Tutorial currentTutorial;
public Game(GameHandler handler, GameActivity gameActivity) throws Exception {
super(gameActivity);
this.handler = handler;
@ -95,9 +92,6 @@ public class Game extends Rendering<GameScene> {
if (scene != null) {
gameState = GameState.COUNTDOWN;
gameActivity.getTutorialManager().resetGameTutorials();
currentTutorial = gameActivity.getTutorialManager().getGameTutorial(level);
if (level.isFinished())
currentTutorial = null;
collectedStars.clear();
energyCollected = false;
particleSystem.deleteAllSources();
@ -145,14 +139,7 @@ public class Game extends Rendering<GameScene> {
}
scene.getCamera().update(player.getPosition().y, timer);
if (currentTutorial != null) {
currentTutorial.update(playerProgress);
if (currentTutorial.isOverNewBreakPoints()) {
gameState = GameState.PAUSED;
handler.showTutorialScreen(currentTutorial.getCurrentBreakPoints());
return;
}
}
gameActivity.getTutorialManager().update(level, playerProgress);
physics.applyGravity(scene, timer);
scene.update(timer);
@ -211,6 +198,10 @@ public class Game extends Rendering<GameScene> {
currentTool = toolType;
}
public void pauseWithoutMenu(){
gameState = GameState.PAUSED;
}
public void tryToPause() {
if (gameState == GameState.GAME_OVER || gameState == GameState.LEVEL_FINISHED || gameState == GameState.PAUSED)
return;
@ -307,12 +298,6 @@ public class Game extends Rendering<GameScene> {
}
database.close();
gameActivity.getDataStorageHandler().writeUserData(gameActivity.getUser());
if (currentTutorial != null) {
currentTutorial.onLevelFinished();
if (currentTutorial.isOverNewBreakPoints())
handler.showTutorialScreen(currentTutorial.getCurrentBreakPoints());
}
}
public void onStarCollision(Star star) {
@ -334,4 +319,7 @@ public class Game extends Rendering<GameScene> {
return gameState;
}
public ViewManager getViewManager() {
return viewManager;
}
}

View File

@ -30,12 +30,17 @@ public class GameScreen extends GLScreen<RelativeLayout> {
@Override
public void prepareToBeShown() {
glView.setCurrentRendering(game);
game.getViewManager().prepareToBeShown();
}
public void onPause() {
game.tryToPause();
}
public void setGamePausedWithoutMenu(){
game.pauseWithoutMenu();
}
public void onResume() {
game.setRunning();
}
@ -76,7 +81,7 @@ public class GameScreen extends GLScreen<RelativeLayout> {
@Override
public void showTutorialScreen(List<BreakPoint> breakPoints) {
gameActivity.showTutorialScreen(breakPoints);
gameActivity.showTutorial(breakPoints);
}
@Override

View File

@ -29,7 +29,6 @@ import de.frajul.endlessroll.views.TopBar;
*/
public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnClickListener {
private LevelUpBounties levelUpBounties;
private ToolSlotSettings slotSettings;
private ToolOfferSlot selectedToolOfferSlot;
@ -46,11 +45,9 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
public ToolShopScreen(GameActivity gameActivity) {
super(ScreenType.TOOL_SHOP, gameActivity, R.layout.toolshop);
this.levelUpBounties = new LevelUpBounties(0);
this.slotSettings = gameActivity.getUser().getToolSlotSettings();
this.tutorial = gameActivity.getTutorialManager().getToolShopTutorial();
tutorial.setToolShopScreen(this);
tutorial.setFinished(gameActivity.getDataStorageHandler().readToolShopTutorialFinished());
pulse = AnimationUtils.loadAnimation(gameActivity, R.anim.pulse);
topBar = super.createTopBar(R.id.toolshop_topbar);
@ -92,8 +89,7 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
@Override
public void prepareToBeShown() {
topBar.update();
levelUpBounties.loadAllForLevel(gameActivity.getUser().getLevel());
slotSettings.unlockSlotsIfLevelReached(levelUpBounties);
slotSettings.unlockSlotsIfLevelReached(gameActivity.getUser().getLevelUpBounties());
onToolOfferSlotSelected(toolOfferSlots.get(0));
for (int i = 0; i < toolSlotViews.size(); i++) {
@ -102,7 +98,7 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
toolSlotView.setImageResource(toolSlot.getDrawable());
}
for (ToolOfferSlot toolOfferSlot : toolOfferSlots) {
boolean locked = levelUpBounties.isToolLocked(toolOfferSlot.getToolType());
boolean locked = gameActivity.getUser().getLevelUpBounties().isToolLocked(toolOfferSlot.getToolType());
toolOfferSlot.setLocked(locked);
toolOfferSlot.updateBackgroundColor();
}
@ -202,11 +198,8 @@ public class ToolShopScreen extends Screen<RelativeLayout> implements View.OnCli
.isBought();
}
public LevelUpBounties getLevelUpBounties() {
return levelUpBounties;
}
public ToolType getSelectedToolType() {
return selectedToolOfferSlot.getToolType();
}
}

View File

@ -1,5 +1,6 @@
package de.frajul.endlessroll.main.screens;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
@ -29,6 +30,7 @@ public class WorldsScreen extends Screen<RelativeLayout> implements WorldButtonO
buttonLayout = (LinearLayout) layout.findViewById(R.id.worlds_layout);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER_VERTICAL;
params.setMargins(25, 0, 25, 0);
for (LevelPack levelPack : gameActivity.getLevelManager()) {

View File

@ -9,7 +9,7 @@ import android.support.annotation.StringRes;
public class BreakPoint {
public final static float LEVEL_FINISHED_X = -1;
public final static float NONE_X = -1;
private float x;
private boolean alreadyShown = false;

View File

@ -4,19 +4,20 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import de.frajul.endlessroll.main.GameActivity;
/**
* Created by Julian on 14.03.2017.
*/
public class Tutorial {
private int levelId, levelPackId;
private GameActivity gameActivity;
private List<BreakPoint> breakPoints;
protected List<BreakPoint> currentBreakPoints = new ArrayList<>();
public Tutorial(int levelId, int levelPackId, BreakPoint... breakPoints) {
this.levelId = levelId;
this.levelPackId = levelPackId;
public Tutorial(GameActivity gameActivity, BreakPoint... breakPoints) {
this.gameActivity = gameActivity;
this.breakPoints = Arrays.asList(breakPoints);
}
@ -26,47 +27,29 @@ public class Tutorial {
currentBreakPoints.clear();
}
public void onLevelFinished() {
currentBreakPoints.clear();
for (BreakPoint breakPoint : breakPoints) {
if (breakPoint.getX() == BreakPoint.LEVEL_FINISHED_X) {
breakPoint.setAlreadyShown(true);
currentBreakPoints.add(breakPoint);
}
}
}
public void update(float playerProgress) {
playerProgress *= 2f;
currentBreakPoints.clear();
boolean newBreakPoints = false;
for (BreakPoint breakPoint : breakPoints) {
if (!breakPoint.isAlreadyShown() && playerProgress >= breakPoint.getX() && breakPoint
.getX() != BreakPoint.LEVEL_FINISHED_X) {
.getX() != BreakPoint.NONE_X) {
breakPoint.setAlreadyShown(true);
currentBreakPoints.add(breakPoint);
newBreakPoints = true;
}
}
if (newBreakPoints)
showCurrentBreakPoints();
}
public boolean isOverNewBreakPoints() {
return !currentBreakPoints.isEmpty();
private void showCurrentBreakPoints() {
gameActivity.showTutorial(currentBreakPoints);
}
public List<BreakPoint> getCurrentBreakPoints() {
return currentBreakPoints;
public void showAllBreakPoints() {
gameActivity.showTutorial(breakPoints);
}
public List<BreakPoint> getBreakPoints() {
return breakPoints;
}
public int getLevelId() {
return levelId;
}
public int getLevelPackId() {
return levelPackId;
}
}

View File

@ -1,12 +1,11 @@
package de.frajul.endlessroll.main.tutorial;
import java.util.Arrays;
import java.util.List;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.levels.Level;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.screens.ToolShopScreen;
import de.frajul.endlessroll.user.User;
import de.frajul.endlessroll.views.TopBar;
/**
* Created by Julian on 17.03.2017.
@ -14,42 +13,75 @@ import de.frajul.endlessroll.main.screens.ToolShopScreen;
public class TutorialManager {
private List<Tutorial> gameTutorials;
private final int WELCOME_TUTORIAL_LEVEL = 1;
private final int IN_AIR_TUTORIAL_LEVEL = 5;
private final int SWITCH_TOOLS_TUTORIAL_LEVEL = 10;
private Tutorial welcomeTutorial;
private Tutorial inAirTutorial;
private Tutorial toToolShopTutorial;
private ToolShopTutorial toolShopTutorial;
private Tutorial switchToolsTutorial;
public TutorialManager(GameActivity gameActivity) {
Tutorial t11 = new Tutorial(1, 1, new BreakPoint(0, R.string.tutorial_welcome, -1),
welcomeTutorial = new Tutorial(gameActivity,
new BreakPoint(0, R.string.tutorial_welcome, -1),
new BreakPoint(0, R.string.tutorial_place_tools, R.drawable.tutorial_place_tools),
new BreakPoint(7, R.string.tutorial_place_ramp_gap,
R.drawable.tutorial_place_ramp_gap),
new BreakPoint(21, R.string.tutorial_place_ramp_obstacle,
R.drawable.tutorial_place_ramp_obstacle));
Tutorial t21 = new Tutorial(2, 1, new BreakPoint(11, R.string.tutorial_place_ramp_air,
R.drawable.tutorial_place_ramp_air_1),
inAirTutorial = new Tutorial(gameActivity,
new BreakPoint(11, R.string.tutorial_place_ramp_air,
R.drawable.tutorial_place_ramp_air_1),
new BreakPoint(33, R.string.tutorial_place_ramp_air_2,
R.drawable.tutorial_place_ramp_air_2));
Tutorial t51 = new Tutorial(5, 1,
new BreakPoint(BreakPoint.LEVEL_FINISHED_X, R.string.tutorial_leveled_up, -1),
new BreakPoint(BreakPoint.LEVEL_FINISHED_X, R.string.tutorial_to_toolshop,
toToolShopTutorial = new Tutorial(gameActivity,
new BreakPoint(BreakPoint.NONE_X, R.string.tutorial_leveled_up_to_toolshop,
R.drawable.tutorial_to_toolshop));
gameTutorials = Arrays.asList(t11, t21, t51);
toolShopTutorial = new ToolShopTutorial(gameActivity);
switchToolsTutorial = new Tutorial(gameActivity,
new BreakPoint(0, R.string.tutorial_switch_tools_two_neccessary, -1),
new BreakPoint(0, R.string.tutorial_switch_tools_switch, -1));
}
public void update(Level level, float playerProgress) {
if (level.getPackId() == 1 && level.getId() == WELCOME_TUTORIAL_LEVEL && !level
.isFinished()) {
welcomeTutorial.update(playerProgress);
} else if (level.getPackId() == 1 && level.getId() == IN_AIR_TUTORIAL_LEVEL && !level
.isFinished()) {
inAirTutorial.update(playerProgress);
} else if (level.getPackId() == 1 && level.getId() == SWITCH_TOOLS_TUTORIAL_LEVEL && !level
.isFinished()) {
switchToolsTutorial.update(playerProgress);
}
}
public void onLvUp(User user) {
boolean springUnlockedOnLvUp = user.getLevelUpBounties()
.getLevelToolIsUnlocked(ToolType.SPRING) == user.getLevel();
if (springUnlockedOnLvUp) {
toToolShopTutorial.showAllBreakPoints();
}
}
public void onTopBarUpdate(TopBar topBar) {
toolShopTutorial.onTopBarUpdate(topBar);
}
public void resetGameTutorials() {
for (Tutorial tutorial : gameTutorials)
tutorial.reset();
welcomeTutorial.reset();
inAirTutorial.reset();
switchToolsTutorial.reset();
}
public Tutorial getGameTutorial(Level level) {
for (Tutorial tutorial : gameTutorials) {
if (tutorial.getLevelPackId() == level.getPackId() && tutorial.getLevelId() == level
.getId())
return tutorial;
}
return null;
public void resetAllTutorials() {
welcomeTutorial.reset();
inAirTutorial.reset();
switchToolsTutorial.reset();
toToolShopTutorial.reset();
toolShopTutorial.setFinished(false);
}
public ToolShopTutorial getToolShopTutorial() {

View File

@ -22,6 +22,7 @@ public class TutorialView implements View.OnClickListener {
private ImageView imageView;
private GameActivity activity;
private int currentBreakPoint = 0;
private List<BreakPoint> breakPoints;
public TutorialView(GameActivity activity) {
@ -43,17 +44,18 @@ public class TutorialView implements View.OnClickListener {
public void show(List<BreakPoint> breakPoints) {
this.breakPoints = breakPoints;
if(!breakPoints.isEmpty())
showFirstBreakPoint();
currentBreakPoint = 0;
if (!breakPoints.isEmpty())
showCurrentBreakPoint();
}
public boolean isShowingTutorial() {
return layout.getVisibility() == View.VISIBLE;
}
private void showFirstBreakPoint() {
int textId = breakPoints.get(0).getTextId();
int imageId = breakPoints.get(0).getImageId();
private void showCurrentBreakPoint() {
int textId = breakPoints.get(currentBreakPoint).getTextId();
int imageId = breakPoints.get(currentBreakPoint).getImageId();
if (textId == -1)
textView.setVisibility(View.INVISIBLE);
@ -72,14 +74,12 @@ public class TutorialView implements View.OnClickListener {
@Override
public void onClick(View v) {
if(breakPoints.size() == 0)
return;
breakPoints.remove(0);
if (!breakPoints.isEmpty()) {
showFirstBreakPoint();
} else {
currentBreakPoint++;
if (breakPoints.size() <= currentBreakPoint) {
layout.setVisibility(View.GONE);
activity.onTutorialViewHidden();
} else {
showCurrentBreakPoint();
}
}
}

View File

@ -26,9 +26,6 @@ public class User {
private LevelUpBounties levelUpBounties;
private int inLevelCollectedStars;
private int inLevelCollectedEnergy;
public User(LvUpListener lvUpListener, int ep, int level, int starCount, int energyCount, ToolSlotSettings toolSlotSettings, PlayerShape playerShape) {
this.lvUpListener = lvUpListener;
this.ep = ep;
@ -127,14 +124,6 @@ public class User {
return levelUpBounties;
}
public int getInLevelCollectedEnergy() {
return inLevelCollectedEnergy;
}
public int getInLevelCollectedStars() {
return inLevelCollectedStars;
}
//CHEAT
public void setLevel(int level) {
this.level = level;

View File

@ -1,6 +1,7 @@
package de.frajul.endlessroll.views;
import android.graphics.Typeface;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;

View File

@ -50,6 +50,14 @@ public class GameOverMessage implements View.OnClickListener {
layout.setVisibility(View.VISIBLE);
}
public boolean isVisible(){
return layout.getVisibility() == View.VISIBLE;
}
public void prepareToBeShown(){
topBar.update();
}
private void hide() {
layout.clearAnimation();
layout.setVisibility(View.GONE);

View File

@ -12,6 +12,7 @@ import de.frajul.endlessroll.R;
import de.frajul.endlessroll.levels.Level;
import de.frajul.endlessroll.levels.LevelPack;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.game.Game;
import de.frajul.endlessroll.main.screens.Screen;
@ -52,22 +53,40 @@ public class GoalMessage implements GoalMessageLevelButtonOnClickListener, View.
toMenu.setOnClickListener(this);
}
public void fadeInWithDelay(LevelPack levelPack, final Level level) {
public void fadeInWithDelay(final LevelPack levelPack, final Level level) {
this.levelPack = levelPack;
topBar.update();
restart.init(R.string.goal_message_restart_format_d, level);
boolean nextLevelVisible = !levelPack.isLastLevel(level);
nextLevel.setVisible(nextLevelVisible);
if (nextLevelVisible)
nextLevel
.init(R.string.goal_message_next_level_format_d, levelPack.getNextLevel(level));
layout.postDelayed(new Runnable() {
GameLog.i("Level: "+level.getId());
gameActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
topBar.update();
restart.init(R.string.goal_message_restart_format_d, level);
boolean nextLevelVisible = !levelPack.isLastLevel(level);
nextLevel.setVisible(nextLevelVisible);
if (nextLevelVisible)
nextLevel
.init(R.string.goal_message_next_level_format_d, levelPack.getNextLevel(level));
layout.startAnimation(fadeIn);
}
}, 500);
});
// layout.postDelayed(new Runnable() {
// @Override
// public void run() {
//
// }
// }, 500);
}
public boolean isVisible(){
return layout.getVisibility() == View.VISIBLE;
}
public void prepareToBeShown(){
topBar.update();
}
private void hide() {

View File

@ -69,6 +69,14 @@ public class ShortMenu implements View.OnClickListener {
topBar.update();
}
public boolean isVisible(){
return layout.getVisibility() == View.VISIBLE;
}
public void prepareToBeShown(){
topBar.update();
}
private void startRandomAnimation(View view) {
float r = random.nextFloat();
if (r >= 0.5)

View File

@ -47,12 +47,12 @@ public class TopBar implements View.OnClickListener {
Typeface typeface = gameActivity.getTypeface();
levelDisplay = (TextView) layout.findViewById(R.id.topbar_leveldisplay);
levelDisplay.setTypeface(typeface);
// levelDisplay.setTypeface(typeface);
levelProgress = (ProgressBar) layout.findViewById(R.id.topbar_levelprogress);
starCount = (TextView) layout.findViewById(R.id.topbar_starcount);
starCount.setTypeface(typeface);
// starCount.setTypeface(typeface);
energyCount = (TextView) layout.findViewById(R.id.topbar_energycount);
energyCount.setTypeface(typeface);
// energyCount.setTypeface(typeface);
settingsButton = (Button) layout.findViewById(R.id.topbar_settings);
settingsButton.setOnClickListener(this);
toolshopButton = (Button) layout.findViewById(R.id.topbar_toolshop);
@ -93,7 +93,7 @@ public class TopBar implements View.OnClickListener {
starCount.setText(user.getStarCount() + "");
energyCount.setText(user.getEnergyCount() + "");
gameActivity.getTutorialManager().getToolShopTutorial().onTopBarUpdate(this);
gameActivity.getTutorialManager().onTopBarUpdate(this);
}
public void startToolShopButtonPulse(){

View File

@ -47,7 +47,7 @@ public class ViewManager implements View.OnClickListener {
gameActivity.getUser().getToolSlotSettings(),
(LinearLayout) layout.findViewById(R.id.game_toolbuttonbar));
shortMenu = new ShortMenu(game, gameActivity,
(LinearLayout) layout.findViewById(R.id.game_shortmenu));
layout.findViewById(R.id.game_shortmenu));
gameOverMessage = new GameOverMessage(game, gameActivity,
layout.findViewById(R.id.game_game_over_message));
goalMessage = new GoalMessage(game, gameActivity, layout.findViewById(R.id.game_goal_message));
@ -66,6 +66,15 @@ public class ViewManager implements View.OnClickListener {
playerSpeedFormat = game.getContext().getString(R.string.game_playerspeed_format_f);
}
public void prepareToBeShown(){
if(shortMenu.isVisible())
shortMenu.prepareToBeShown();
if(gameOverMessage.isVisible())
gameOverMessage.prepareToBeShown();
if(goalMessage.isVisible())
goalMessage.prepareToBeShown();
}
@Override
public void onClick(View v) {
game.tryToPause();

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_levelup_message"
@ -9,33 +9,14 @@
android:id="@+id/goal_message_topbar"
layout="@layout/topbar"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"/>
<RelativeLayout
android:layout_below="@id/goal_message_topbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/goal_message_mid_layout">
<Button
android:id="@+id/goal_message_to_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/message_to_menu"
android:textColor="@color/message_views"
android:background="@drawable/xml_background_game_over_message_button"
android:textSize="40sp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/goal_message_mid_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<TextView
android:id="@+id/goal_message_title"
android:layout_width="wrap_content"
@ -45,6 +26,19 @@
android:textColor="@color/level_finished"
android:textSize="55sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/goal_message_title">
<Button
android:id="@+id/goal_message_to_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/message_to_menu"
android:textColor="@color/message_views"
android:background="@drawable/xml_background_game_over_message_button"
android:textSize="40sp"/>
</RelativeLayout>
<RelativeLayout
@ -71,4 +65,4 @@
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -8,7 +8,8 @@
android:id="@+id/toolshop_topbar"
layout="@layout/topbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<RelativeLayout
android:layout_width="match_parent"

View File

@ -3,8 +3,7 @@
android:id="@+id/topbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#a600f9"
android:clipChildren="false">
android:background="#a600f9">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topbar_levellayout"
@ -14,7 +13,6 @@
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:layout_marginStart="5dp"
android:clipChildren="false"
android:orientation="vertical">
<TextView

View File

@ -105,8 +105,9 @@
<string name="tutorial_place_ramp_obstacle">Great job!\nNow place it in front of the obstacle</string>
<string name="tutorial_place_ramp_air">You can even set a Tool in mid-air.\nTime carefully!</string>
<string name="tutorial_place_ramp_air_2">Now try again!</string>
<string name="tutorial_leveled_up">Congratulations!!!\nYou have leveled up!</string>
<string name="tutorial_to_toolshop">Now go to the toolshop by either clicking on the \'Spring unlocked\' or the toolshop button!</string>
<string name="tutorial_leveled_up_to_toolshop">Congratulations! You have leveled up!\nNow go to the toolshop</string>
<string name="tutorial_switch_tools_two_neccessary">For this level you will need two tools equipped</string>
<string name="tutorial_switch_tools_switch">To switch between the tools click here</string>
<string name="tutorial_toolshop_welcome">Welcome to the toolshop!\nHere you can buy and upgrade all tools and you can customize your toolbar.</string>
<string name="tutorial_toolshop_toolbar">Right! That is your toolbar.</string>
<string name="tutorial_toolshop_all_tools">Here you can see all the tools you will be able to buy and use.</string>