Skip to content

Commit

Permalink
Added support of game.droid and game.ios
Browse files Browse the repository at this point in the history
  • Loading branch information
SheepYhangCN committed Jan 27, 2025
1 parent 3135480 commit 1520a05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion widgets/file_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 1520a05

Please sign in to comment.