mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Simplify the way custom achievement images are loaded
This commit is contained in:
@@ -2,7 +2,6 @@ package forge.achievement;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.GuiBase;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.assets.ISkinImage;
|
||||
@@ -81,7 +80,7 @@ public abstract class Achievement {
|
||||
return customImage;
|
||||
}
|
||||
|
||||
public void updateCustomImage() {
|
||||
private void updateCustomImage() {
|
||||
int suffix;
|
||||
if (earnedGold()) {
|
||||
suffix = 3;
|
||||
@@ -155,12 +154,7 @@ public abstract class Achievement {
|
||||
}
|
||||
}
|
||||
if (type != null) {
|
||||
FThreads.invokeInEdtNowOrLater(GuiBase.getInterface(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateCustomImage();
|
||||
}
|
||||
});
|
||||
updateCustomImage();
|
||||
if (sharedDesc != null) {
|
||||
desc = sharedDesc + " " + desc;
|
||||
}
|
||||
@@ -181,6 +175,7 @@ public abstract class Achievement {
|
||||
public void loadFromXml(Element el) {
|
||||
best = getIntAttribute(el, "best");
|
||||
current = getIntAttribute(el, "current");
|
||||
updateCustomImage();
|
||||
}
|
||||
|
||||
private int getIntAttribute(Element el, String name) {
|
||||
|
||||
@@ -20,9 +20,7 @@ package forge.model;
|
||||
import forge.CardStorageReader;
|
||||
import forge.CardStorageReader.ProgressObserver;
|
||||
import forge.FThreads;
|
||||
import forge.GuiBase;
|
||||
import forge.StaticData;
|
||||
import forge.achievement.Achievement;
|
||||
import forge.achievement.AchievementCollection;
|
||||
import forge.achievement.ConstructedAchievements;
|
||||
import forge.achievement.DraftAchievements;
|
||||
@@ -176,20 +174,6 @@ public class FModel {
|
||||
achievements.put(GameType.Sealed, new SealedAchievements());
|
||||
achievements.put(GameType.Quest, new QuestAchievements());
|
||||
|
||||
//as long as custom achievement pics directory exists, queue up load for those images
|
||||
if (FileUtil.doesFileExist(ForgeConstants.CACHE_ACHIEVEMENT_PICS_DIR)) {
|
||||
FThreads.invokeInEdtLater(GuiBase.getInterface(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (AchievementCollection achievementCol : achievements.values()) {
|
||||
for (Achievement achievement : achievementCol) {
|
||||
achievement.updateCustomImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//preload AI profiles
|
||||
AiProfileUtil.loadAllProfiles(ForgeConstants.AI_PROFILE_DIR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user