alt: merge dependency resolving and modpack launching stage

This commit is contained in:
huanghongxun
2020-02-19 21:51:06 +08:00
parent b4ec71d65f
commit 3269841207
2 changed files with 20 additions and 23 deletions

View File

@@ -130,13 +130,13 @@ public final class LauncherHelper {
TaskExecutor executor = Task.runAsync(() -> {
})
.thenComposeAsync(() -> Task.composeAsync(() -> {
.thenComposeAsync(() -> Task.allOf(
Task.composeAsync(null, () -> {
if (setting.isNotCheckGame())
return null;
else
return dependencyManager.checkGameCompletionAsync(version);
}).withStage("launch.state.dependencies"))
.thenComposeAsync(() -> Task.composeAsync(null, () -> {
}), Task.composeAsync(null, () -> {
try {
ModpackConfiguration<?> configuration = ModpackHelper.readModpackConfiguration(repository.getModpackConfiguration(selectedVersion));
if ("Curse".equals(configuration.getType()))
@@ -148,7 +148,7 @@ public final class LauncherHelper {
} catch (IOException e) {
return null;
}
}).withStage("launch.state.modpack"))
})).withStage("launch.state.dependencies"))
.thenComposeAsync(() -> Task.supplyAsync((String) null, () -> {
try {
return account.logIn();
@@ -202,7 +202,6 @@ public final class LauncherHelper {
.cancellableExecutor();
executor.setStages(new LocalizedTaskStages(Lang.immutableListOf(
"launch.state.dependencies",
"launch.state.modpack",
"launch.state.logging_in",
"launch.state.waiting_launching")));
launchingStepsPane.setExecutor(executor, false);

View File

@@ -29,8 +29,6 @@ import org.jackhuang.hmcl.task.TaskExecutor;
import org.jackhuang.hmcl.task.TaskListener;
import org.jackhuang.hmcl.ui.FXUtils;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
@@ -74,7 +72,7 @@ public class TaskExecutorDialogPane extends StackPane {
double finalSpeed = speed;
String finalUnit = unit;
Platform.runLater(() -> {
lblProgress.setText(String.format("%.1f", finalSpeed) + " " + finalUnit);
lblProgress.setText(String.format("%.1f %s", finalSpeed, finalUnit));
});
};
FileDownloadTask.speedEvent.channel(FileDownloadTask.SpeedEvent.class).registerWeak(speedEventHandler);