Skip to content
Snippets Groups Projects
Commit 2c492771 authored by Drahomír Karchňák's avatar Drahomír Karchňák
Browse files

#328 Victory dialog now displays game progress bar instead of users one...

parent c6d97fc2
No related branches found
No related tags found
No related merge requests found
core/assets/common/_global/application/ui/progressbar_fill.png

6.86 KiB | W: | H:

core/assets/common/_global/application/ui/progressbar_fill.png

4.62 KiB | W: | H:

core/assets/common/_global/application/ui/progressbar_fill.png
core/assets/common/_global/application/ui/progressbar_fill.png
core/assets/common/_global/application/ui/progressbar_fill.png
core/assets/common/_global/application/ui/progressbar_fill.png
  • 2-up
  • Swipe
  • Onion skin
core/assets/common/screen/form/gfx/progressbar_fill.png

6.86 KiB

......@@ -165,7 +165,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
public static final String GAME_STATE_GAME_ID = "game_id";
private static final float PROGRESS_BAR_SPEED = 2f;
private static final float PROGRESS_BAR_SPEED = 3.5f;
//Experience Stars
private static final Vector2[] EXPERIENCE_STAR_PATH = new Vector2[] {
......@@ -849,7 +849,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
adapters.add(new ResizableSpaceContentDialogComponent());
final UserRankManager.RankProgress rankProgress = UserRankManager.getInstance().getTotalUserRankProgress(getSelectedUser());//UserRankManager.getGameRankProgress(getSelectedUser(), gd);
final UserRankManager.RankProgress rankProgress = UserRankManager.getInstance().getGameRankProgress(getSelectedUser(), GameDefinition.getGameDefinitionForGameNumber(game.getGameNumber()));
final TablexiaProgressBar progressBar = new TablexiaProgressBar(
ApplicationAtlasManager.getInstance().getTextureRegion(ApplicationAtlasManager.PROGRESS_BAR),
ApplicationAtlasManager.getInstance().getTextureRegion(ApplicationAtlasManager.PROGRESS_BAR_FILL)
......@@ -1237,8 +1237,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
GameDefinition gd = GameDefinition.getGameDefinitionForClass(getClass());
if(gd == null) throw new RuntimeException("Couldn't find game definition for class: " + getClass());
UserRankManager.RankProgress gameRankProgress = UserRankManager.getInstance().getGameRankProgress(getSelectedUser(), gd);
UserRankManager.RankProgress totalRankProgress = new UserRankManager.RankProgress(rankProgress.getMinXP(), rankProgress.getCurrXP(), rankProgress.getNextXP());
UserRankManager.RankProgress gameRankProgress = new UserRankManager.RankProgress(rankProgress.getMinXP(), rankProgress.getCurrXP(), rankProgress.getNextXP());
//Iterate through all the achieved cups
for(int cupsAchievedIndex = 0; cupsAchievedIndex < cupsImages.length; cupsAchievedIndex++) {
......@@ -1255,12 +1254,11 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
for(int starIndex = 0; starIndex < starCountPerCup; starIndex++) {
float gamePercent = gameRankProgress.getPercentDone();
float totalPercent = totalRankProgress.getPercentDone();
if(gamePercent >= 1 || totalPercent >= 1) return; //ProgressBar is already at (100%) or you got enoguh xp from this game...
if(gamePercent >= 1) return; //ProgressBar is already at (100%)
//Final destination point for stars in stars coordinate system
Vector2 lastPoint = new Vector2(
progressBarStagePosition.x + progressBar.getFillOffsetX() + (progressBar.getWidth() - 2*progressBar.getFillOffsetX()) * totalPercent - starPosition.x,
progressBarStagePosition.x + progressBar.getFillOffsetX() + (progressBar.getWidth() - 2*progressBar.getFillOffsetX()) * gamePercent - starPosition.x,
progressBarStagePosition.y - starPosition.y
);
......@@ -1278,7 +1276,6 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
experienceStar.startAnimation(cupDelay + (EXPERIENCE_STAR_DELAY * starIndex), EXPERIENCE_STAR_FADE_IN, EXPERIENCE_STAR_PATH_DURATION, EXPERIENCE_STAR_FADE_IN_INTERPOLATION);
gameRankProgress.setCurrXP(gameRankProgress.getCurrXP() + 1);
totalRankProgress.setCurrXP(totalRankProgress.getCurrXP() + 1);
TablexiaComponentDialogFactory.getDialogStage().addActor(experienceStar);
}
}
......
......@@ -27,6 +27,7 @@ import cz.nic.tablexia.util.ui.button.CloseTablexiaButton;
import cz.nic.tablexia.util.ui.button.TablexiaButton;
public class ProfileScreen extends FormScreen {
private static final String PROGRESS_BAR_FILL = "gfx/progressbar_fill";
private static final float PROGRESS_BAR_WIDTH = 0.8f;
private static final float PROGRESS_BAR_BOTTOM_OFFSET = 0.28f;
private static final float PROGRESS_BAR_SPEED = 3.0f;
......@@ -175,7 +176,7 @@ public class ProfileScreen extends FormScreen {
private void prepareProgressBar() {
this.progressBar = new TablexiaProgressBar(
ApplicationAtlasManager.getInstance().getTextureRegion(ApplicationAtlasManager.PROGRESS_BAR),
ApplicationAtlasManager.getInstance().getTextureRegion(ApplicationAtlasManager.PROGRESS_BAR_FILL)
getScreenTextureRegion(PROGRESS_BAR_FILL)
);
float pageWidth = book.getWidth() / 2f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment