2022-09-04 21:21:24 +02:00
|
|
|
package io.gitlab.jfronny.inceptum.imgui.window;
|
2021-10-27 22:00:08 +02:00
|
|
|
|
2022-01-18 19:22:26 +01:00
|
|
|
import imgui.ImGui;
|
2022-09-04 21:21:24 +02:00
|
|
|
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;
|
2021-10-27 22:00:08 +02:00
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
public class NewInstanceWindow extends Window {
|
2022-06-11 13:10:47 +02:00
|
|
|
private final InstanceManageControls imc = new InstanceManageControls(null, null);
|
2022-09-04 21:21:24 +02:00
|
|
|
|
2021-10-27 22:00:08 +02:00
|
|
|
public NewInstanceWindow() {
|
|
|
|
super("New Instance");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void draw() {
|
2022-01-18 19:22:26 +01:00
|
|
|
if (ImGui.beginTabBar("NewInstanceBar")) {
|
|
|
|
if (ImGui.beginTabItem("New")) {
|
|
|
|
imc.snapshotsBox();
|
2022-09-04 21:21:24 +02:00
|
|
|
imc.versionBox(R::nop);
|
2022-01-18 19:22:26 +01:00
|
|
|
imc.nameBox("OK", name -> {
|
|
|
|
try {
|
2022-01-19 19:14:13 +01:00
|
|
|
GuiUtil.createInstance(new SetupStepInfo(imc.getVersionInfo(),
|
2022-01-18 19:22:26 +01:00
|
|
|
imc.getLoaderInfo(),
|
|
|
|
name,
|
2022-01-19 19:14:13 +01:00
|
|
|
Steps.createProcessState()));
|
2022-01-18 19:22:26 +01:00
|
|
|
} catch (IOException e) {
|
|
|
|
Utils.LOGGER.error("Could not initialize instance creation", e);
|
|
|
|
}
|
|
|
|
close();
|
|
|
|
});
|
|
|
|
ImGui.endTabItem();
|
2021-10-27 22:00:08 +02:00
|
|
|
}
|
2022-01-27 17:05:32 +01:00
|
|
|
if (ImGui.beginTabItem("Import")) {
|
2022-08-02 16:55:16 +02:00
|
|
|
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();
|
2022-01-27 17:05:32 +01:00
|
|
|
ImGui.text("Importing CurseForge or Modrinth packs is not yet implemented");
|
|
|
|
//TODO generic importer based on zip contents and file name ("mrpack")
|
2022-01-18 19:22:26 +01:00
|
|
|
ImGui.endTabItem();
|
|
|
|
}
|
|
|
|
ImGui.endTabBar();
|
|
|
|
}
|
2021-10-27 22:00:08 +02:00
|
|
|
}
|
|
|
|
}
|