[gd_scene load_steps=2 format=3 uid="uid://c0t0hiwfc7xfe"] [sub_resource type="GDScript" id="GDScript_8x26a"] script/source = "class_name LeaderboardScoreSubmitPanel extends Panel signal leaderboard_score_submitted(result) signal leaderboard_score_canceled ## EasyLeaderboard API node @export_node_path(EasyLeaderboard, Node) var easy_leaderboard_api_path @export var score_name : String @export var score : float @export var score_metadata = {} @export var allow_cancel : bool = true @onready var easy_leaderboard_api : EasyLeaderboard = get_node(easy_leaderboard_api_path) # Called when the node enters the scene tree for the first time. func _ready(): update_panel_settings() func update_panel_settings(): if not (easy_leaderboard_api is EasyLeaderboard): push_error(\"easy_leaderboard_api_path must point to a valid EasyLeaderboard node\") if !easy_leaderboard_api.leaderboard_score_submitted.is_connected(_on_easy_leaderboard_api_score_submitted): # Add connection for score submit complete! easy_leaderboard_api.leaderboard_score_submitted.connect(_on_easy_leaderboard_api_score_submitted) $ScoreLabel/Value.text = str(score) ($NameLabel/Value as LineEdit).text = score_name if !allow_cancel: ($GridContainer as GridContainer).columns = 1 $GridContainer/CancelContainer.visible = false else: ($GridContainer as GridContainer).columns = 2 $GridContainer/CancelContainer.visible = true func _on_cancel_button_pressed(): leaderboard_score_canceled.emit() func _on_submit_button_pressed(): score_name = $NameLabel/Value.text easy_leaderboard_api.submit_leaderboard_score(score_name, score, score_metadata) func _on_easy_leaderboard_api_score_submitted(result): leaderboard_score_submitted.emit(result) " [node name="LeaderboardScoreSubmitPanel" type="Panel"] offset_left = 398.0 offset_top = 111.0 offset_right = 756.0 offset_bottom = 420.0 script = SubResource("GDScript_8x26a") [node name="SubmitScoreLabel" type="Label" parent="."] offset_left = 110.0 offset_top = 15.0 offset_right = 255.0 offset_bottom = 41.0 text = "Submit your score!" [node name="ScoreLabel" type="Label" parent="."] offset_left = 124.0 offset_top = 62.0 offset_right = 172.0 offset_bottom = 88.0 text = "Score:" [node name="Value" type="Label" parent="ScoreLabel"] offset_left = 54.0 offset_right = 94.0 offset_bottom = 23.0 text = "123456" [node name="NameLabel" type="Label" parent="."] offset_left = 68.0 offset_top = 137.0 offset_right = 119.0 offset_bottom = 163.0 text = "Name:" [node name="Value" type="LineEdit" parent="NameLabel"] offset_left = 68.0 offset_top = -2.0 offset_right = 229.0 offset_bottom = 29.0 placeholder_text = "Player 1" max_length = 64 expand_to_text_length = true caret_blink = true [node name="GridContainer" type="GridContainer" parent="."] offset_left = 80.0 offset_top = 215.0 offset_right = 274.0 offset_bottom = 268.0 columns = 2 [node name="SubmitContainer" type="CenterContainer" parent="GridContainer"] offset_right = 95.0 offset_bottom = 31.0 size_flags_horizontal = 3 [node name="SubmitButton" type="Button" parent="GridContainer/SubmitContainer"] offset_left = 16.0 offset_right = 79.0 offset_bottom = 31.0 text = "Submit" [node name="CancelContainer" type="CenterContainer" parent="GridContainer"] offset_left = 99.0 offset_right = 194.0 offset_bottom = 31.0 size_flags_horizontal = 3 [node name="CancelButton" type="Button" parent="GridContainer/CancelContainer"] offset_left = 17.0 offset_right = 77.0 offset_bottom = 31.0 text = "Cancel " [connection signal="pressed" from="GridContainer/SubmitContainer/SubmitButton" to="." method="_on_submit_button_pressed"] [connection signal="pressed" from="GridContainer/CancelContainer/CancelButton" to="." method="_on_cancel_button_pressed"]