Skip to content

Commit

Permalink
menu signal connect
Browse files Browse the repository at this point in the history
  • Loading branch information
@-note authored and @-note committed Feb 2, 2018
1 parent 704a14b commit 2c7e09c
Show file tree
Hide file tree
Showing 7 changed files with 450 additions and 41 deletions.
53 changes: 23 additions & 30 deletions Menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,37 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

extends Panel
var data
var konec = 16
var lang = "cs"

func options():
func _ready():
pass


func _on_LinkButton_pressed():
OS.shell_open("https://github.com/Couple-quest/Couple-quest")

func _on_start_pressed():
get_tree().change_scene("res://hra.tscn")

func _on_set_pressed():
get_node("set/Možnosti").popup()

func quit():
func _on_exit_pressed():
get_tree().quit()

func start():
get_tree().change_scene("res://hra.tscn")
func _on_HScrollBar_value_changed(value):
get_node("set/Možnosti/delka/HScrollBar/curLen").set_text(str(value))
get_node("/root/global").fin = value

func _ready():
get_node("start").connect("pressed",self,"start")
get_node("set").connect("pressed",self,"options")
get_node("set/Možnosti/delka/HScrollBar").connect("value_changed",self,"hChange")
get_node("set/Možnosti/jazyk/OptionButton").connect("item_selected",self,"jazyk")
get_node("set/Možnosti/jazyk/OptionButton").select(global.langid)
get_node("set/Možnosti/balicek/OptionButton").connect("item_selected",self,"balik")
get_node("exit").connect("pressed",self,"quit")

func hChange(konec):
get_node("set/Možnosti/delka/HScrollBar/curLen").set_text(str(konec))
get_node("/root/global").fin = konec

func jazyk(lang):
var sel = get_node("set/Možnosti/jazyk/OptionButton").get_item_text(lang)
func _on_OptionButton_item_selected(ID):
get_node("/root/global").balik = ID


func _on_OptionButtonL_item_selected( ID ):
var sel = get_node("set/Možnosti/jazyk/OptionButton").get_item_text(ID)
get_node("/root/global").jazyk = sel
get_node("/root/global").langid = lang
get_node("/root/global").langid = ID
TranslationServer.set_locale(sel)
get_tree().reload_current_scene()

func balik(data):
var sel = get_node("set/Možnosti/balicek/OptionButton").get_item_text(data)
get_node("/root/global").balik = sel


func _on_LinkButton_pressed():
OS.shell_open("https://github.com/Couple-quest/Couple-quest")
pass
get_node("set/Možnosti/jazyk/OptionButton").select(global.langid)
16 changes: 15 additions & 1 deletion Menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_fonts" ]

[node name="OptionButton" type="OptionButton" parent="set/Možnosti/jazyk" index="0"]
[node name="OptionButtonL" type="OptionButton" parent="set/Možnosti/jazyk" index="0"]

anchor_left = 0.0
anchor_top = 0.0
Expand Down Expand Up @@ -402,6 +402,20 @@ flat = false
align = 1
_sections_unfolded = [ "Theme", "custom_fonts" ]

[connection signal="pressed" from="start" to="." method="_on_start_pressed"]

[connection signal="pressed" from="set" to="." method="_on_set_pressed"]

[connection signal="item_selected" from="set/Možnosti/balicek/OptionButton" to="." method="_on_OptionButton_item_selected"]

[connection signal="value_changed" from="set/Možnosti/delka/HScrollBar" to="." method="_on_HScrollBar_value_changed"]

[connection signal="item_selected" from="set/Možnosti/jazyk/OptionButtonL" to="." method="_on_OptionButton_item_selected"]

[connection signal="item_selected" from="set/Možnosti/jazyk/OptionButtonL" to="." method="_on_OptionButtonL_item_selected"]

[connection signal="pressed" from="set/Možnosti/LinkButton" to="." method="_on_LinkButton_pressed"]

[connection signal="pressed" from="exit" to="." method="_on_exit_pressed"]


Loading

0 comments on commit 2c7e09c

Please sign in to comment.