From c6070cc4c148632315e880e43d7a8cbc6b97d41d Mon Sep 17 00:00:00 2001 From: 2439905184 Date: Mon, 12 Sep 2022 17:53:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=84=20refactor:=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GodotLauncher/Main.tscn | 3 --- GodotLauncher/PP.gd | 26 +++++++++----------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/GodotLauncher/Main.tscn b/GodotLauncher/Main.tscn index 6ffb234..8eb4f5d 100644 --- a/GodotLauncher/Main.tscn +++ b/GodotLauncher/Main.tscn @@ -23,9 +23,6 @@ margin_right = 1046.0 margin_bottom = 654.0 texture = ExtResource( 5 ) expand = true -__meta__ = { -"_edit_lock_": true -} [node name="GameList" type="OptionButton" parent="."] margin_left = 813.0 diff --git a/GodotLauncher/PP.gd b/GodotLauncher/PP.gd index 794f4a1..15df218 100644 --- a/GodotLauncher/PP.gd +++ b/GodotLauncher/PP.gd @@ -14,31 +14,23 @@ func go_TerasologyLauncherNim(): pass func _on_About_pressed(): - $Panel/OssDep.show() - $Panel/Help.hide() - $Panel/Mirror.hide() - pass + switch_show($Panel/OssDep) func _on_Help_pressed(): - $Panel/Help.show() - $Panel/OssDep.hide() - $Panel/Mirror.hide() - pass + switch_show($Panel/Help) func _on_Download_pressed(): - $Panel/Mirror.show() - $Panel/OssDep.hide() - $Panel/Help.hide() + switch_show($Panel/Mirror) pass # 用于重构的切换显示函数,一次只能切换显示一个节点 -func switch_show(node): - var all_node = [$Panel/Help,$Panel/Mirror,$Panel/OssDep] - for iter in node: - - pass +func switch_show(p_node): + var all_node = [$Panel/Help,$Panel/Mirror,$Panel/OssDep,] + for node in all_node: + p_node.show() + if node != p_node: + node.hide() pass func _on_Back_pressed(): self.hide() - pass