From 399f681abc0bc738e01d659f2a6ae73e5fc64f71 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Tue, 7 Feb 2023 15:25:44 +0900 Subject: - loading and unloading Signed-off-by: syeyoung --- .../launcher/gui/screen/version/WidgetInfo.java | 11 ++++++++ .../gui/screen/version/WidgetInfoRemote.java | 8 ++++++ .../gui/versions/versionInfo.gui | 31 ++++++++++++++-------- 3 files changed, 39 insertions(+), 11 deletions(-) (limited to 'loader/src/main') diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java index 780a3548..63ccad23 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java @@ -40,6 +40,12 @@ public abstract class WidgetInfo extends AnnotatedImportOnlyWidget { @Bind(variableName = "version") public final BindableAttribute version = new BindableAttribute<>(String.class, ""); + @Bind(variableName = "loadVisibility") + public final BindableAttribute loadVisibility = new BindableAttribute<>(String.class, "loadable"); + + @Bind(variableName = "reason") + public final BindableAttribute reason = new BindableAttribute<>(String.class, ""); + public WidgetInfo() { super(new ResourceLocation("dungeons_guide_loader:gui/versions/versionInfo.gui")); makeItDefault.addOnUpdate((old, neu) ->{ @@ -53,6 +59,11 @@ public abstract class WidgetInfo extends AnnotatedImportOnlyWidget { public void setVersion(String version) {this.version.setValue(version);} public void setDefault(boolean bool) {this.makeItDefault.setValue(bool);} + public void setNotLoadable(String reason) { + this.reason.setValue(reason); + this.loadVisibility.setValue("notloadable"); + } + public abstract IDGLoader getLoader(); public void setConfiguration(Configuration configuration) {} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java index dc4e2331..64b92d09 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java @@ -18,8 +18,10 @@ package kr.syeyoung.dungeonsguide.launcher.gui.screen.version; +import kr.syeyoung.dungeonsguide.launcher.LoaderMeta; import kr.syeyoung.dungeonsguide.launcher.branch.Update; import kr.syeyoung.dungeonsguide.launcher.branch.UpdateBranch; +import kr.syeyoung.dungeonsguide.launcher.exceptions.DungeonsGuideLoadingException; import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader; import kr.syeyoung.dungeonsguide.launcher.loader.RemoteLoader; import net.minecraftforge.common.config.Configuration; @@ -37,6 +39,12 @@ public class WidgetInfoRemote extends WidgetInfo { this.isLatest = isLatest; setVersion((isLatest ? "Latest :: " : "") + branch.getName()+"/"+update.getName()+ " ("+branch.getId()+"/"+update.getId()+")"); setDefault(isLatest); + + + int reqVersion = update.getMetadata().has("loaderVersion") ? update.getMetadata().getInt("loaderVersion") : 0; + if (reqVersion > LoaderMeta.LOADER_VERSION) { + setNotLoadable("This version of Dungeons Guide requires loader version: " + reqVersion +" But current loader version: "+ LoaderMeta.LOADER_VERSION); + } } @Override diff --git a/loader/src/main/resources/assets/dungeons_guide_loader/gui/versions/versionInfo.gui b/loader/src/main/resources/assets/dungeons_guide_loader/gui/versions/versionInfo.gui index cccbefde..0707899e 100644 --- a/loader/src/main/resources/assets/dungeons_guide_loader/gui/versions/versionInfo.gui +++ b/loader/src/main/resources/assets/dungeons_guide_loader/gui/versions/versionInfo.gui @@ -22,17 +22,26 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + -- cgit