Commit 2275983e authored by Drahomír Karchňák's avatar Drahomír Karchňák

#742 Different way to load rank badges textures.

parent 48e15df8
......@@ -209,37 +209,55 @@ task prepareGraphicAssets(dependsOn: prepareAssets) {
new File("${assetsDir.absolutePath}/${assetsSourceDirName}/").eachDir() { langDir ->
langDir.eachDir() { sectionDir ->
sectionDir.eachDir() { atlasDir ->
if (assetsGameDirectory.equals(sectionDir.name) && !assetsGameGlobalDirectory.equals(atlasDir.name)) {
atlasDir.eachDir() { difficultyDir ->
if (!assetsGameExcludedDirectory.equals(difficultyDir.name)) {
String packFileName = assetsGameCommonDifficultyDirectory.equals(difficultyDir.name) ? atlasDir.name : difficultyDir.name;
TexturePacker.process(settings,
"${difficultyDir}",
"${assetsDir.absolutePath}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/",
"${packFileName}")
} else {
task("${name}_" + sectionDir.name + "_" + langDir.name + "_" + atlasDir.name + "_" + difficultyDir.name, type: Copy) {
from difficultyDir
into "${buildDir}/${assetsDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/${difficultyDir.name}"
include '**/*'
includeEmptyDirs false
outputs.upToDateWhen { false }
}.execute()
//If section dir has no dirs, copy whole content
if (hasAtlasDir(sectionDir)) {
sectionDir.eachDir() { atlasDir ->
if (assetsGameDirectory.equals(sectionDir.name) && !assetsGameGlobalDirectory.equals(atlasDir.name)) {
atlasDir.eachDir() { difficultyDir ->
if (!assetsGameExcludedDirectory.equals(difficultyDir.name)) {
String packFileName = assetsGameCommonDifficultyDirectory.equals(difficultyDir.name) ? atlasDir.name : difficultyDir.name;
TexturePacker.process(settings,
"${difficultyDir}",
"${assetsDir.absolutePath}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/",
"${packFileName}")
} else {
task("${name}_" + sectionDir.name + "_" + langDir.name + "_" + atlasDir.name + "_" + difficultyDir.name, type: Copy) {
from difficultyDir
into "${buildDir}/${assetsDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/${difficultyDir.name}"
include '**/*'
includeEmptyDirs false
outputs.upToDateWhen { false }
}.execute()
}
}
} else {
TexturePacker.process(settings,
"${atlasDir}",
"${assetsDir.absolutePath}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/",
"${atlasDir.name}")
}
} else {
TexturePacker.process(settings,
"${atlasDir}",
"${assetsDir.absolutePath}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/",
"${atlasDir.name}")
}
} else {
task("${name}_" + sectionDir.name + "_" + langDir.name, type: Copy) {
from sectionDir
into "${buildDir}/${assetsDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}"
include '**/*'
includeEmptyDirs false
outputs.upToDateWhen { false }
}.execute()
}
}
}
}
}
def hasAtlasDir(File file) {
for(File f : file.listFiles()) {
if(f.isDirectory()) return true;
}
return false;
}
task zipAssets(dependsOn: [prepareSoundAssets, prepareGraphicAssets, prepareJsonAssets]) {
doLast {
new File(project(":core").projectDir.absolutePath + "/${assetsDirName}").eachDir() { dir ->
......
......@@ -41,6 +41,7 @@ import cz.nic.tablexia.bus.ApplicationBus.ApplicationEvent;
import cz.nic.tablexia.game.ranksystem.UserRankManager;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationAvatarManager;
import cz.nic.tablexia.loader.application.ApplicationBadgesManager;
import cz.nic.tablexia.loader.application.ApplicationExternalSoundManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.loader.application.ApplicationInternalSoundManager;
......@@ -297,6 +298,8 @@ public class Tablexia extends TablexiaApplication {
ApplicationExternalSoundManager.getInstance().load();
ApplicationAtlasManager.getInstance().load();
ApplicationBadgesManager.initialize();
loadingComplete = false;
}
......
......@@ -18,6 +18,7 @@
package cz.nic.tablexia.game.ranksystem;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.scenes.scene2d.EventListener;
import com.badlogic.gdx.scenes.scene2d.Group;
......@@ -30,6 +31,7 @@ import com.badlogic.gdx.utils.Align;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationBadgesManager;
import cz.nic.tablexia.loader.application.ApplicationExternalSoundManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
......@@ -163,13 +165,13 @@ public class RankAnimation extends Group {
}
private void prepareOldBadge() {
prepareBadgeGroup(oldBadgeGroup, oldRank);
prepareBadgeGroup(oldBadgeGroup, oldRank, ApplicationBadgesManager.getInstance().getCurrentRankBadgeTexture());
this.addActor(oldBadgeGroup);
}
private void prepareNewBadge() {
prepareBadgeGroup(newBadgeGroup, newRank);
prepareBadgeGroup(newBadgeGroup, newRank, ApplicationBadgesManager.getInstance().getNextRankBadgeTexture());
newBadgeGroup.addAction(Actions.alpha(0));
newBadgeGroup.addAction(Actions.moveBy(BADGE_SLIDE_DISTANCE * this.getWidth(), 0));
......@@ -177,8 +179,8 @@ public class RankAnimation extends Group {
this.addActor(newBadgeGroup);
}
private void prepareBadgeGroup(Group group, UserRankManager.UserRank userRank) {
Image badgeImage = createBadgeImage(userRank);
private void prepareBadgeGroup(Group group, UserRankManager.UserRank userRank, Texture badgeTexture) {
Image badgeImage = createBadgeImage(badgeTexture);
group.setSize(badgeImage.getWidth(), badgeImage.getHeight());
group.setPosition(this.getWidth() / 2f - group.getWidth() / 2f, this.getHeight() / 2f - group.getHeight() / 2f);
group.addActor(badgeImage);
......@@ -200,8 +202,8 @@ public class RankAnimation extends Group {
return badgeLabel;
}
private Image createBadgeImage(UserRankManager.UserRank userRank) {
return ScaleUtil.createImageToHeight(ApplicationAtlasManager.getInstance().getTextureRegion(userRank.getBadgeImageKey()), this.getHeight() * BADGE_HEIGHT);
private Image createBadgeImage(Texture badgeTexture) {
return ScaleUtil.createImageToHeight(badgeTexture, this.getHeight() * BADGE_HEIGHT);
}
private void animateBadges() {
......
......@@ -17,7 +17,6 @@
package cz.nic.tablexia.game.ranksystem;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -38,32 +37,31 @@ import cz.nic.tablexia.util.Log;
*/
public class UserRankManager {
public enum UserRank {
RANK_NONE ( 0, false, false, null, ApplicationAtlasManager.BADGE_NONE, ApplicationAtlasManager.BADGE_NONE_ICON, 0),
RANK_I ( 1, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_1, ApplicationAtlasManager.BADGE_1, ApplicationAtlasManager.BADGE_1_ICON, 3),
RANK_II ( 2, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_2, ApplicationAtlasManager.BADGE_2, ApplicationAtlasManager.BADGE_2_ICON, 9),
RANK_III ( 3, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_3, ApplicationAtlasManager.BADGE_3, ApplicationAtlasManager.BADGE_3_ICON, 18),
RANK_IV ( 4, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_4, ApplicationAtlasManager.BADGE_4, ApplicationAtlasManager.BADGE_4_ICON, 30),
RANK_V ( 5, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_5, ApplicationAtlasManager.BADGE_5, ApplicationAtlasManager.BADGE_5_ICON, 48),
RANK_VI ( 6, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_6, ApplicationAtlasManager.BADGE_6, ApplicationAtlasManager.BADGE_6_ICON, 73),
RANK_VII ( 7, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_7, ApplicationAtlasManager.BADGE_7, ApplicationAtlasManager.BADGE_7_ICON, 105),
RANK_VIII ( 8, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_8, ApplicationAtlasManager.BADGE_8, ApplicationAtlasManager.BADGE_8_ICON, 145),
RANK_IX ( 9, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_9, ApplicationAtlasManager.BADGE_9, ApplicationAtlasManager.BADGE_9_ICON, 193),
RANK_X (10, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_10, ApplicationAtlasManager.BADGE_10, ApplicationAtlasManager.BADGE_10_ICON, 248),
RANK_XI (11, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_11, ApplicationAtlasManager.BADGE_11, ApplicationAtlasManager.BADGE_11_ICON, 316);
RANK_NONE ( 0, false, false, null, ApplicationAtlasManager.BADGE_NONE_ICON, 0),
RANK_I ( 1, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_1, ApplicationAtlasManager.BADGE_1_ICON, 3),
RANK_II ( 2, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_2, ApplicationAtlasManager.BADGE_2_ICON, 9),
RANK_III ( 3, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_3, ApplicationAtlasManager.BADGE_3_ICON, 18),
RANK_IV ( 4, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_4, ApplicationAtlasManager.BADGE_4_ICON, 30),
RANK_V ( 5, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_5, ApplicationAtlasManager.BADGE_5_ICON, 48),
RANK_VI ( 6, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_6, ApplicationAtlasManager.BADGE_6_ICON, 73),
RANK_VII ( 7, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_7, ApplicationAtlasManager.BADGE_7_ICON, 105),
RANK_VIII ( 8, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_8, ApplicationAtlasManager.BADGE_8_ICON, 145),
RANK_IX ( 9, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_9, ApplicationAtlasManager.BADGE_9_ICON, 193),
RANK_X (10, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_10, ApplicationAtlasManager.BADGE_10_ICON, 248),
RANK_XI (11, true, true, ApplicationTextManager.ApplicationTextsAssets.USER_RANK_11, ApplicationAtlasManager.BADGE_11_ICON, 316);
private int id;
private String nameKey;
private String badgeImage, badgeIcon;
private String badgeIcon;
//This value is not final as it can be influenced by RankComputingScripts
private int experiencePointsNeeded;
private boolean userMenu, badgeBoard;
UserRank(int id, boolean userMenu, boolean badgeBoard, String nameKey, String badgeImage, String badgeIcon, int experiencePointsNeeded) {
UserRank(int id, boolean userMenu, boolean badgeBoard, String nameKey, String badgeIcon, int experiencePointsNeeded) {
this.id = id;
this.nameKey = nameKey;
this.badgeImage = badgeImage;
this.badgeIcon = badgeIcon;
this.experiencePointsNeeded = experiencePointsNeeded;
......@@ -110,10 +108,6 @@ public class UserRankManager {
return badgeBoard;
}
public String getBadgeImageKey() {
return badgeImage;
}
public String getBadgeIconKey() {
return badgeIcon;
}
......@@ -389,6 +383,7 @@ public class UserRankManager {
rankComputeDataMap.put(user.getId(), rankComputeData);
ApplicationBus.getInstance().post(new GameMenuItemGroup.RefreshMainMenuProgressBarsEvent()).asynchronously();
}
public static class UserRankUpEvent implements ApplicationBus.ApplicationEvent {
......
......@@ -138,30 +138,6 @@ public abstract class TablexiaAbstractFileManager extends AssetManager {
}
}
public enum AvatarsStorageType implements StorageType {
INTERNAL(RootStorageType.INTERNAL, AvatarsStorageType.AVATARS_DIRECTORY),
EXTERNAL(RootStorageType.LOCAL, AvatarsStorageType.AVATARS_DIRECTORY);
public static final String AVATARS_DIRECTORY = "avatars/";
private String storagePath;
private FileHandleResolver resolver;
AvatarsStorageType(RootStorageType rootStorageType, String assetsPath) {
this.storagePath = rootStorageType.getStoragePath() + assetsPath;
this.resolver = rootStorageType.getResolver();
}
public String getStoragePath() {
return storagePath;
}
public FileHandleResolver getResolver() {
return resolver;
}
}
public enum DataStorageType implements StorageType {
INTERNAL(RootStorageType.INTERNAL, DataStorageType.DATA_DIRECTORY),
......
......@@ -101,18 +101,6 @@ public class ApplicationAtlasManager extends TablexiaAtlasManager implements IAp
public static final String USERMENU_MENUITEM_CUSTOM_AVATAR = AVATAR_PATH+"custom_avatar";
public static final String BADGE_PATH = "badge/";
public static final String BADGE_NONE = BADGE_PATH + "badge_none";
public static final String BADGE_1 = BADGE_PATH + "badge1";
public static final String BADGE_2 = BADGE_PATH + "badge2";
public static final String BADGE_3 = BADGE_PATH + "badge3";
public static final String BADGE_4 = BADGE_PATH + "badge4";
public static final String BADGE_5 = BADGE_PATH + "badge5";
public static final String BADGE_6 = BADGE_PATH + "badge6";
public static final String BADGE_7 = BADGE_PATH + "badge7";
public static final String BADGE_8 = BADGE_PATH + "badge8";
public static final String BADGE_9 = BADGE_PATH + "badge9";
public static final String BADGE_10 = BADGE_PATH + "badge10";
public static final String BADGE_11 = BADGE_PATH + "badge11";
public static final String BADGE_NONE_ICON = BADGE_PATH + "badge_none_icon";
public static final String BADGE_1_ICON = BADGE_PATH + "badge1_icon";
......
package cz.nic.tablexia.loader.application;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import net.engio.mbassy.listener.Handler;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.bus.ApplicationBus;
import cz.nic.tablexia.game.ranksystem.UserRankManager;
import cz.nic.tablexia.loader.TablexiaTextureManager;
import cz.nic.tablexia.shared.model.User;
/**
* Created by drahomir on 8/4/17.
*/
public class ApplicationBadgesManager extends TablexiaTextureManager {
private static final String BADGES_ASSETS_PATH = "badges/";
private static final String BADGE_IMAGE_FILE_EXT = ".png";
private enum FullRankBadges {
BADGE_NONE (UserRankManager.UserRank.RANK_NONE, BADGES_ASSETS_PATH + "badge_none" + BADGE_IMAGE_FILE_EXT),
BADGE_1 (UserRankManager.UserRank.RANK_I, BADGES_ASSETS_PATH + "badge1" + BADGE_IMAGE_FILE_EXT),
BADGE_2 (UserRankManager.UserRank.RANK_II, BADGES_ASSETS_PATH + "badge2" + BADGE_IMAGE_FILE_EXT),
BADGE_3 (UserRankManager.UserRank.RANK_III, BADGES_ASSETS_PATH + "badge3" + BADGE_IMAGE_FILE_EXT),
BADGE_4 (UserRankManager.UserRank.RANK_IV, BADGES_ASSETS_PATH + "badge4" + BADGE_IMAGE_FILE_EXT),
BADGE_5 (UserRankManager.UserRank.RANK_V, BADGES_ASSETS_PATH + "badge5" + BADGE_IMAGE_FILE_EXT),
BADGE_6 (UserRankManager.UserRank.RANK_VI, BADGES_ASSETS_PATH + "badge6" + BADGE_IMAGE_FILE_EXT),
BADGE_7 (UserRankManager.UserRank.RANK_VII, BADGES_ASSETS_PATH + "badge7" + BADGE_IMAGE_FILE_EXT),
BADGE_8 (UserRankManager.UserRank.RANK_VIII, BADGES_ASSETS_PATH + "badge8" + BADGE_IMAGE_FILE_EXT),
BADGE_9 (UserRankManager.UserRank.RANK_IX, BADGES_ASSETS_PATH + "badge9" + BADGE_IMAGE_FILE_EXT),
BADGE_10 (UserRankManager.UserRank.RANK_X, BADGES_ASSETS_PATH + "badge10" + BADGE_IMAGE_FILE_EXT),
BADGE_11 (UserRankManager.UserRank.RANK_XI, BADGES_ASSETS_PATH + "badge11" + BADGE_IMAGE_FILE_EXT);
private UserRankManager.UserRank userRank;
private String filePath;
FullRankBadges(UserRankManager.UserRank userRank, String filePath) {
this.userRank = userRank;
this.filePath = filePath;
}
public static String getFilePathForUserRank(UserRankManager.UserRank rank) {
for(FullRankBadges badge : values()) {
if(badge.userRank == rank) return badge.filePath;
}
return FullRankBadges.BADGE_NONE.filePath;
}
}
private static ApplicationBadgesManager instance;
private UserRankManager.UserRank currentRank, nextRank;
private String currentRankPath, nextRankPath;
private ApplicationBadgesManager() {}
public static void initialize() {
instance = new ApplicationBadgesManager();
ApplicationBus.getInstance().subscribe(instance);
}
public static ApplicationBadgesManager getInstance() {
return instance;
}
@Handler
public void onUserSelectedEvent(TablexiaSettings.SelectedUserEvent selectedUserEvent) {
refreshBadges();
}
private void loadAssetsForCurrentUser() {
Gdx.app.postRunnable(() -> {
loadTexture(currentRankPath = FullRankBadges.getFilePathForUserRank(currentRank));
loadTexture(nextRankPath = FullRankBadges.getFilePathForUserRank(nextRank));
finishLoading();
});
}
public void refreshBadges() {
User currentUser = TablexiaSettings.getInstance().getSelectedUser();
if(currentUser != null) {
UserRankManager.UserRank rank = UserRankManager.getInstance().getRank(currentUser);
if(rank != null && currentRank != rank) {
currentRank = rank;
nextRank = UserRankManager.UserRank.getNextRank(currentRank);
disposeAllLoadedAssets();
loadAssetsForCurrentUser();
}
} else {
disposeAllLoadedAssets();
}
}
public Texture getCurrentRankBadgeTexture() {
return getTexture(currentRankPath);
}
public Texture getNextRankBadgeTexture() {
return getTexture(nextRankPath);
}
private void disposeAllLoadedAssets() {
clear();
}
}
......@@ -63,6 +63,7 @@ import cz.nic.tablexia.loader.TablexiaAtlasManager;
import cz.nic.tablexia.loader.TablexiaDataManager;
import cz.nic.tablexia.loader.TablexiaSoundManager;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationBadgesManager;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
import cz.nic.tablexia.model.UserDAO;
import cz.nic.tablexia.model.screen.ScreenDAO;
......@@ -723,6 +724,8 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
// reset screen state after loading screen with state
TablexiaStorage.getInstance().resetScreenState(this);
ApplicationBadgesManager.getInstance().refreshBadges();
//Clear the stage (Makes sure every game starts with empty stage)
getStage().clear();
screenLoaded(screenState);
......
......@@ -64,6 +64,7 @@ import cz.nic.tablexia.bus.event.StartFullSynchronizationEvent;
import cz.nic.tablexia.game.ranksystem.UserRankManager;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationAvatarManager;
import cz.nic.tablexia.loader.application.ApplicationBadgesManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.menu.user.UserAvatarDefinition;
import cz.nic.tablexia.menu.user.UserMenu;
......@@ -467,7 +468,11 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
}
protected Actor prepareBadge() {
badge = ScaleUtil.createImageWidthPosition(ApplicationAtlasManager.getInstance().getTextureRegion(UserRankManager.UserRank.getInitialRank().getBadgeImageKey()), getStage().getWidth() * FormActorsLayout.BADGE_WIDTH, getStage().getWidth() * FormActorsLayout.BADGE_X, getStage().getWidth() * FormActorsLayout.BADGE_Y);
badge = ScaleUtil.createImageWidthPosition(
ApplicationBadgesManager.getInstance().getCurrentRankBadgeTexture(),
getStage().getWidth() * FormActorsLayout.BADGE_WIDTH,
getStage().getWidth() * FormActorsLayout.BADGE_X, getStage().getWidth() * FormActorsLayout.BADGE_Y
);
return badge;
}
......
......@@ -390,11 +390,13 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
String badgeName = getText(HallOfFameAssets.TEXT_BADGE_CABINET_LOCKED);
if(currentRank.getId() >= rank.getId()) {
badgeImage = ScaleUtil.createImageToHeight(ApplicationAtlasManager.getInstance().getTextureRegion(rank.getBadgeImageKey()), BADGE_TABLE_BADGE_HEIGHT * tableHeight);
//TODO
badgeImage = ScaleUtil.createImageToHeight(ApplicationAtlasManager.getInstance().getTextureRegion(rank.getBadgeIconKey()), BADGE_TABLE_BADGE_HEIGHT * tableHeight);
badgeName = ApplicationTextManager.getInstance().getText(rank.getNameKey());
}
else {
badgeImage = ScaleUtil.createGreyScaleImageToHeight(ApplicationAtlasManager.getInstance().getTextureRegion(rank.getBadgeImageKey()), BADGE_TABLE_BADGE_HEIGHT * tableHeight);
//TODO
badgeImage = ScaleUtil.createGreyScaleImageToHeight(ApplicationAtlasManager.getInstance().getTextureRegion(rank.getBadgeIconKey()), BADGE_TABLE_BADGE_HEIGHT * tableHeight);
badgeImage.setColor(badgeImage.getColor().r, badgeImage.getColor().g, badgeImage.getColor().b, badgeImage.getColor().a * BADGE_BOARD_BADGE_INACTIVE_ALPHA);
}
......
......@@ -34,6 +34,7 @@ import java.util.Map;
import cz.nic.tablexia.bus.ApplicationBus;
import cz.nic.tablexia.bus.event.StartFullSynchronizationEvent;
import cz.nic.tablexia.loader.application.ApplicationAvatarManager;
import cz.nic.tablexia.loader.application.ApplicationBadgesManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.game.ranksystem.UserRankManager;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
......@@ -247,12 +248,12 @@ public class ProfileScreen extends FormScreen {
@Override
protected Actor prepareBadge() {
UserRankManager.UserRank rank = UserRankManager.getInstance().getRank(getSelectedUser());
badge = ScaleUtil.createImageToHeight(ApplicationAtlasManager.getInstance().getTextureRegion(rank.getBadgeImageKey()), BADGE_HEIGHT * getSceneInnerHeight());
badge = ScaleUtil.createImageToHeight(ApplicationBadgesManager.getInstance().getCurrentRankBadgeTexture(), BADGE_HEIGHT * getSceneInnerHeight());
float pageWidth = (book.getWidth()/2);
badge.setPosition(book.getX() + pageWidth/2 - badge.getWidth()/2, badge.getY());
badge.setName(rank.getBadgeImageKey());
UserRankManager.UserRank rank = UserRankManager.getInstance().getRank(getSelectedUser());
badge.setName(rank.toString());
return badge;
}
......
......@@ -106,9 +106,9 @@ public class TestProfile extends AbstractTestScenario {
}
//test badge image
Image badgeImage = (Image) findActorByName(userRank.getBadgeImageKey());
Image badgeImage = (Image) findActorByName(userRank.toString());
if(badgeImage==null){
logError("Badge image with rank " + userRank.getBadgeImageKey() + " not exists");
logError("Badge image with rank " + userRank.toString() + " not exists");
stopTheTest();
}
logOK();
......
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