Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
发布0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wohaopa committed Aug 7, 2023
1 parent 75cfef7 commit b511f68
Show file tree
Hide file tree
Showing 12 changed files with 5,990 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.github.wohaopa'
version '0.3.0'
version '0.3.1'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Config {
static {
config = new Config();
loadConfig();
// Runtime.getRuntime().addShutdownHook(new Thread(Config::saveConfig));
Runtime.getRuntime().addShutdownHook(new Thread(Config::saveConfig));
}

public static Config getConfig() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,23 @@ public void launchInstance(Auth auth, Consumer<String> callback) {
} else throw new RuntimeException("无法找到启动器:" + information.launcher);
}

public void clean() {
clean0(runDir);
}

private void clean0(File dir) {
if (dir.exists()) {
for (File file : dir.listFiles()) {
if (FileUtil.isSymLink(file)) file.delete();
else if (file.isDirectory()) clean0(file);
}
}
}

public Mapper getMapper() {
Sharer sharer = Sharer.get(information.sharer); // 先拿到sharer
if (sharer == null) Log.warn("未找到Sharer:{}", information.sharer);
if (mapper == null) mapper = new Mapper(null, this);
mapper = new Mapper(null, this);
mapper.update(sharer); // 执行合并文件夹方法
return mapper;
}
Expand Down
13 changes: 0 additions & 13 deletions Core/src/main/resources/log4j2-test.xml

This file was deleted.

12 changes: 11 additions & 1 deletion Core/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout charset="UTF-8" pattern="[%d{HH:mm:ss}][%logger]%-5level %marker:%msg%n"/>
</Console>

<RollingFile name="RollingFile" fileName="logs/latest.log"
filePattern="logs/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="[%d{HH:mm:ss}][%logger]%-5level %marker:%msg%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Root level="INFO">
<Root level="DEBUG">
<AppenderRef ref="Console"/>
<AppenderRef ref="RollingFile"/>
</Root>
</Loggers>
</Configuration>
6 changes: 0 additions & 6 deletions Launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ jar {
'Main-Class': 'com.github.wohaopa.Main'
)
}
}


tasks.register("copyLib", Copy){
from configurations.runtimeClasspath
into "$buildDir/libs"
}
4 changes: 4 additions & 0 deletions UI/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ jar {
}
}

tasks.register("copyLib", Copy){
from configurations.runtimeClasspath
into "$buildDir/libs"
}
5,898 changes: 5,898 additions & 0 deletions UI/logs/latest.log

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions UI/src/main/java/com/github/wohaopa/zplui/scene/InstanceView.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.github.wohaopa.zeropointlanuch.core.Instance;
import com.github.wohaopa.zeropointlanuch.core.ZplDirectory;
import com.github.wohaopa.zeropointlanuch.core.tasks.Scheduler;
import com.github.wohaopa.zeropointlanuch.core.tasks.Task;
import com.github.wohaopa.zeropointlanuch.core.tasks.instances.NewSubInstanceTask;
import com.github.wohaopa.zeropointlanuch.core.tasks.instances.RefreshInstanceTask;
import com.github.wohaopa.zeropointlanuch.core.tasks.instances.ZplExtractTask;
Expand Down Expand Up @@ -125,6 +126,7 @@ public InstanceView() {

var openModsManager = new JFXButton("Mods管理");
{
openModsManager.setDisable(true);
var dialog = new ModsManagerDialog();

openModsManager.setOnAction(event -> {
Expand All @@ -135,6 +137,7 @@ public InstanceView() {

var openMapManager = new JFXButton("映射管理");
{
openMapManager.setDisable(true);
var dialog = new MapManagerDialog();

openMapManager.setOnAction(event -> {
Expand Down Expand Up @@ -195,6 +198,34 @@ public InstanceView() {
DesktopUtils.openFileLocation(instance.insDir);
});
}
var transfer = new JFXButton("迁移旧实例");
{
transfer.setDisable(true);
}

var clean = new JFXButton("清理运行目录");
{
{
clean.setOnAction(event -> {
var msg = new SimpleStringProperty("正在等待...");
var dialog = new DoneDialog("清理运行目录:" + Instances.getSelect().information.name, msg);

dialog.setTransitionType(JFXDialog.DialogTransition.CENTER);
dialog.show(ZplApplication.getRootPane());
var instance = Instances.getSelect();

Scheduler.submitTasks(new Task<>(s -> FXUtils.runFX(() -> msg.setValue(s))) {

@Override
public Object call() {
instance.clean();
accept("完成!");
return null;
}
});
});
}
}

controlView.getChildren()
.addAll(
Expand All @@ -203,6 +234,8 @@ public InstanceView() {
openModsManager,
openMapManager,
refreshInstance,
clean,
transfer,
newSubInstance,
updateVersion,
extractInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ public RootScene() {
var btn = new JFXButton();
btn.setGraphic(baseMyScene.getIcon());
btn.setOnAction(event -> onAdd(baseMyScene.getPane()));
if (baseMyScene instanceof SettingView || baseMyScene instanceof LauncherView
|| baseMyScene instanceof ServerView
if (baseMyScene instanceof LauncherView || baseMyScene instanceof ServerView
|| baseMyScene instanceof ConsoleView) btn.setDisable(true);
menuPane.getChildren().add(btn);
});
Expand Down
28 changes: 25 additions & 3 deletions UI/src/main/java/com/github/wohaopa/zplui/scene/SettingView.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,37 @@

import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;

import com.github.wohaopa.zeropointlanuch.core.Config;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.validation.RegexValidator;

public class SettingView extends BaseMyScene {

public SettingView() {
super(() -> {
var img = new Label("设置");
img.setTextFill(Color.WHITE);
return img;
var root = new VBox();
root.getStyleClass().add("vbox");

var mirror = new JFXTextField();
mirror.getStyleClass().add("zpl-text-field");
mirror.setPromptText("镜像地址");
mirror.setLabelFloat(true);
var regex = new RegexValidator("请输入正确的URL");
regex.setRegexPattern(
"(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?");
mirror.setValidators(regex);
mirror.setText(Config.getConfig().getLibraries_url());
mirror.textProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
Config.getConfig().setLibraries_url(newValue);
}
});

root.getChildren().addAll(mirror);
return root;
});
}

Expand Down
3 changes: 2 additions & 1 deletion UI/src/main/resources/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

.zpl-text-field {
-fx-text-fill: white;
-fx-font-size: 12px;
}

.tab-pane,
Expand Down Expand Up @@ -101,7 +102,7 @@
-fx-text-fill: white;
}

.dialog-content .vbox{
.vbox{
-fx-alignment: center;
-fx-spacing: 25;
}
Expand Down

0 comments on commit b511f68

Please sign in to comment.