50 lines
1.9 KiB
Java
50 lines
1.9 KiB
Java
package io.gitlab.jfronny.inceptum.imgui.window;
|
|
|
|
import imgui.ImGui;
|
|
import io.gitlab.jfronny.inceptum.common.R;
|
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
|
import io.gitlab.jfronny.inceptum.imgui.control.InstanceManageControls;
|
|
import io.gitlab.jfronny.inceptum.launcher.system.install.SetupStepInfo;
|
|
import io.gitlab.jfronny.inceptum.launcher.system.install.Steps;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class NewInstanceWindow extends Window {
|
|
private final InstanceManageControls imc = new InstanceManageControls(null, null);
|
|
|
|
public NewInstanceWindow() {
|
|
super("New Instance");
|
|
}
|
|
|
|
@Override
|
|
public void draw() {
|
|
if (ImGui.beginTabBar("NewInstanceBar")) {
|
|
if (ImGui.beginTabItem("New")) {
|
|
imc.snapshotsBox();
|
|
imc.versionBox(R::nop);
|
|
imc.nameBox("OK", name -> {
|
|
try {
|
|
GuiUtil.createInstance(new SetupStepInfo(imc.getVersionInfo(),
|
|
imc.getLoaderInfo(),
|
|
name,
|
|
Steps.createProcessState()));
|
|
} catch (IOException e) {
|
|
Utils.LOGGER.error("Could not initialize instance creation", e);
|
|
}
|
|
close();
|
|
});
|
|
ImGui.endTabItem();
|
|
}
|
|
if (ImGui.beginTabItem("Import")) {
|
|
ImGui.text("You can also just add an instance directory and it'll be loaded automatically");
|
|
ImGui.text("Using git to manage it is recommended if you do so");
|
|
ImGui.spacing();
|
|
ImGui.text("Importing CurseForge or Modrinth packs is not yet implemented");
|
|
//TODO generic importer based on zip contents and file name ("mrpack")
|
|
ImGui.endTabItem();
|
|
}
|
|
ImGui.endTabBar();
|
|
}
|
|
}
|
|
}
|