mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
performance: fixed app freeze after first connection, moved sets and formats preload to client startup instead connection
This commit is contained in:
parent
0b0e947741
commit
1777a45ee4
2 changed files with 11 additions and 2 deletions
|
|
@ -5,7 +5,6 @@ import mage.cards.action.ActionCallback;
|
|||
import mage.cards.decks.Deck;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.cards.repository.CardScanner;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.cards.repository.RepositoryUtil;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
|
|
@ -33,6 +32,7 @@ import mage.client.util.*;
|
|||
import mage.client.util.audio.MusicPlayer;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.client.util.gui.countryBox.CountryUtil;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
import mage.client.util.stats.UpdateMemUsageTask;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.components.ImagePanelStyle;
|
||||
|
|
@ -269,6 +269,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
LOGGER.info("Images: search broken files...");
|
||||
CardImageUtils.checkAndFixImageFiles();
|
||||
|
||||
bootstrapSetsAndFormats();
|
||||
|
||||
if (RateCard.PRELOAD_CARD_RATINGS_ON_STARTUP) {
|
||||
RateCard.bootstrapCardsAndRatings();
|
||||
}
|
||||
|
|
@ -374,6 +376,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
private void bootstrapSetsAndFormats() {
|
||||
logger.info("Loading sets and formats...");
|
||||
ConstructedFormats.ensureLists();
|
||||
}
|
||||
|
||||
private void setWindowTitle() {
|
||||
setTitle(TITLE_NAME + " Client: "
|
||||
+ (VERSION == null ? "<not available>" : VERSION.toString()) + " Server: "
|
||||
|
|
|
|||
|
|
@ -78,12 +78,14 @@ public final class ConstructedFormats {
|
|||
}
|
||||
|
||||
public static void ensureLists() {
|
||||
if (underlyingSetCodesPerFormat.isEmpty()) {
|
||||
if (underlyingSetCodesPerFormat.isEmpty()
|
||||
|| underlyingSetCodesPerFormat.values().stream().findFirst().get().isEmpty()) {
|
||||
buildLists();
|
||||
}
|
||||
}
|
||||
|
||||
public static void buildLists() {
|
||||
underlyingSetCodesPerFormat.clear();
|
||||
underlyingSetCodesPerFormat.put(STANDARD, new ArrayList<>());
|
||||
underlyingSetCodesPerFormat.put(EXTENDED, new ArrayList<>());
|
||||
underlyingSetCodesPerFormat.put(FRONTIER, new ArrayList<>());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue