Changed Tutorials
This commit is contained in:
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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() {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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)
|
||||
|
@ -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(){
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user