Skip to content

Commit

Permalink
V3.9
Browse files Browse the repository at this point in the history
1.Bug fixes
  • Loading branch information
sandtechnology committed Jun 29, 2019
1 parent 0d3146f commit c009655
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Resources/assets/lang/en_US.lang
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gui.title=Unturned ID Generator-Version
gui.button.start=Start Generate
gui.checkbox.workshop=Workshop Items
gui.checkbox.workshop=Workshop Items?
gui.processing=Processing....
gui.error=Sorry,the program ran into a error:
gui.result.cost=Total Time:
Expand All @@ -9,7 +9,7 @@ gui.button.filechoose=Select the game path
gui.button.filechoose.select=Select
gui.button.filechoose.title=Please select the root path of the game

result.null=None
result.null=#Not Found#
unturned.animals=Animals
unturned.item=Items
unturned.objects=Objects
Expand Down
2 changes: 1 addition & 1 deletion Resources/assets/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gui.button.filechoose=选择游戏目录
gui.button.filechoose.select=选择
gui.button.filechoose.title=请选择游戏根目录

result.null=名称未定义
result.null=#未找到#
unturned.animals=动物
unturned.item=物品
unturned.objects=物体
Expand Down
44 changes: 29 additions & 15 deletions src/gui/Displayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@ private static void setUIFont() {
}
}

private void reset() {
pm.setProgress(100);
selectButton.setEnabled(true);
startButton.setEnabled(true);
}
private void initComponents() {
String version = "V3.8";
String version = "V3.9";
//设置默认异常捕获
Thread.setDefaultUncaughtExceptionHandler((t, e) ->
{
out.append(getI18nText("gui.error") + "\n" + t.toString() + "\n");
e.printStackTrace(new PrintWriter(new OutputStreamWriter(new JTextAreaWithInputStream(out), StandardCharsets.UTF_8), true));
pm.setProgress(100);
selectButton.setEnabled(true);
startButton.setEnabled(true);
reset();
});
//将UI设置在所有组件的前面
try {
Expand Down Expand Up @@ -110,11 +113,13 @@ private void setUpComponents() {
path.setText(pathChooser.getSelectedFile().getPath());
}
});
//设置输出区域
//路径显示预排版
path.setColumns(30);
//输出区域预排版
out.setRows(30);
out.setEditable(false);
//设置进度条
pm.setMillisToDecideToPopup(0);
//进度条预排版
pm.setNote("awoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo");
//设置开始按钮事件
startButton.addActionListener((Action) ->
{
Expand All @@ -137,21 +142,25 @@ protected LinkedList<LocalizableItem> doInBackground() throws IOException {
class Visitor extends BATFileVisitor {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (pm.isCanceled()) {
reset();
return FileVisitResult.TERMINATE;
}
publish(file.toString());
super.visitFile(file, attrs);
return pm.isCanceled() ? FileVisitResult.TERMINATE : FileVisitResult.CONTINUE;
return FileVisitResult.CONTINUE;
}
}
//游戏目录:...\steamapps\common\Unturned
Path gamePath = Paths.get(path.getText());
//创意工坊物品目录:...\steamapps\workshop\content\304930
Path workshopPath = Paths.get(gamePath.toFile().getParentFile().getParentFile().getPath(), "workshop", "content", "304930");
//判断创意工坊
if (workShopCheck.isSelected()) {
if (workShopCheck.isSelected() && gamePath.toFile().exists()) {
//创意工坊物品目录:...\steamapps\workshop\content\304930
Path workshopPath = Paths.get(gamePath.toFile().getParentFile().getParentFile().getPath(), "workshop", "content", "304930");
return Visitor.visit(new Visitor(), gamePath, workshopPath);
}
else {
return Visitor.visit(new Visitor(), Paths.get(path.getText()));
return Visitor.visit(new Visitor(), gamePath);
}
}

Expand All @@ -164,6 +173,9 @@ protected void process(List<String> chunks) {
pm.setNote(path);
}
}
else {
reset();
}
}

@Override
Expand Down Expand Up @@ -193,10 +205,12 @@ protected void done() {
}
}
}
pm.setProgress(100);
selectButton.setEnabled(true);
startButton.setEnabled(true);
}
else {
out.setText(getI18nText("result.null"));
}

reset();
}
}.execute();
});
Expand Down
4 changes: 2 additions & 2 deletions src/io/BATFileVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static LinkedList<LocalizableItem> visit(BATFileVisitor visitor, Path...
if (visitor == null) {
visitor = new BATFileVisitor();
}
logger.setLevel(Level.INFO);
logger.setLevel(Level.OFF);
visitor.itemList.clear();
for (Path path : paths) {
Files.walkFileTree(path, visitor);
Expand Down Expand Up @@ -90,7 +90,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {

@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file.endsWith("English.dat")) {
if (file.toFile().exists() && file.endsWith("English.dat")) {
List<String> info = new ArrayList<>();
String path = file.toString();
// 添加路径信息
Expand Down

0 comments on commit c009655

Please sign in to comment.