Skip to content

Commit

Permalink
🦄 refactor: 优化切换界面的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
2439905184 committed Sep 12, 2022
1 parent d31733c commit c6070cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
3 changes: 0 additions & 3 deletions GodotLauncher/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 9 additions & 17 deletions GodotLauncher/PP.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c6070cc

Please sign in to comment.