From 1520a0511376a1dc60c818509a6d5242e8764c55 Mon Sep 17 00:00:00 2001 From: SheepYhangCN Date: Mon, 27 Jan 2025 18:23:42 +0800 Subject: [PATCH] Added support of game.droid and game.ios --- main_window.py | 11 ++++++++--- widgets/file_explorer.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/main_window.py b/main_window.py index 4408de9..623d36c 100644 --- a/main_window.py +++ b/main_window.py @@ -193,19 +193,24 @@ def open_file(self, rel_path): self.tabs.setCurrentWidget(tab) if type == "gm": - data_path, ext = rel_path.split('.win/',1) + ext_using = ".win" + if (rel_path.contains(".droid")): + ext_using = ".droid" + elif (rel_path.contains(".ios")): + ext_using = ".ios" + data_path, ext = rel_path.split(ext_using+'/',1) ext, id = ext.split('/',1) editor_class = self.editor_types.get(ext) if rel_path in self.current_editors: self.tabs.setCurrentWidget(self.current_editors[rel_path]) return - data_path = data_path + ".win" + data_path = data_path + ext_using editor = editor_class(self.file_explorer.data[0][data_path], self.file_explorer.data[1][data_path], id) tab = QWidget() tab.rel_path = rel_path layout = QVBoxLayout(tab) layout.addWidget(editor) - save_btn = QPushButton("写入 data.win") + save_btn = QPushButton("写入 data") target_path = os.path.join(self.project_manager.current_project['target'], data_path) save_btn.clicked.connect(lambda: fs.save_file_gm(self, target_path, self.file_explorer.data[1][data_path])) layout.addWidget(save_btn) diff --git a/widgets/file_explorer.py b/widgets/file_explorer.py index b61c3d2..b720229 100644 --- a/widgets/file_explorer.py +++ b/widgets/file_explorer.py @@ -108,7 +108,7 @@ def _populate_tree(self, parent, path, base_data): node.setText(0, item_name) if os.path.isdir(item_path): self._populate_tree(node, item_path, base_data) - elif item_name.endswith('.win'): + elif item_name.endswith('.win') or item_name.endswith('.droid') or item_name.endswith('.ios'): self._populate_tree_gm(node, item_path, base_data) else: rel_path = os.path.relpath(item_path, base_data['source'])