Login part I
This commit is contained in:
parent
5599b7a0e8
commit
394a603d6f
2 changed files with 38 additions and 5 deletions
|
@ -7,7 +7,10 @@ func _on_login_button_pressed():
|
|||
|
||||
|
||||
func _on_play_button_pressed():
|
||||
emit_signal( "login_button_pressed" )
|
||||
#emit_signal( "login_button_pressed" )
|
||||
var username = get_node("h_box_container/v_box_container/margin_container/login_box/email_box/email_edit").get_text();
|
||||
if username != null and username != "":
|
||||
do_request(username)
|
||||
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
|
@ -19,3 +22,23 @@ func _on_sound_button_toggled( button_pressed ):
|
|||
global.get_node( "audio_stream_player" ).stop()
|
||||
else:
|
||||
global.get_node( "audio_stream_player" ).play()
|
||||
|
||||
|
||||
func do_request(username):
|
||||
var headers = ["Content-Type: application/json"]
|
||||
#$HTTPRequest.request("http://lirria.khaganat.net/login/r2_login.php?cmd=ask&login=" + username)
|
||||
$HTTPRequest.request("http://lirria.khaganat.net/login/r2_login.php?cmd=ask", headers, true, HTTPClient.METHOD_GET, "&login=" + username)
|
||||
|
||||
|
||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||
var s = body.get_string_from_utf8().split(":")
|
||||
var ctn = s[1]
|
||||
print(ctn)
|
||||
|
||||
|
||||
func _make_post_request(url, data_to_send, use_ssl):
|
||||
# Convert data to json string:
|
||||
var query = JSON.print(data_to_send)
|
||||
# Add 'Content-Type' header:
|
||||
var headers = ["Content-Type: application/json"]
|
||||
$HTTPRequest.request(url, headers, use_ssl, HTTPClient.METHOD_POST, query)
|
||||
|
|
|
@ -62,7 +62,15 @@ theme = ExtResource( 1 )
|
|||
script = ExtResource( 2 )
|
||||
_sections_unfolded = [ "Material", "Theme", "Visibility", "custom_styles" ]
|
||||
|
||||
[node name="background" type="TextureRect" parent="." index="0"]
|
||||
[node name="HTTPRequest" type="HTTPRequest" parent="." index="0"]
|
||||
|
||||
download_file = ""
|
||||
use_threads = false
|
||||
body_size_limit = -1
|
||||
max_redirects = 8
|
||||
_sections_unfolded = [ "Pause" ]
|
||||
|
||||
[node name="background" type="TextureRect" parent="." index="1"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
|
@ -79,7 +87,7 @@ expand = true
|
|||
stretch_mode = 7
|
||||
_sections_unfolded = [ "Visibility" ]
|
||||
|
||||
[node name="OLD_buttons_background" type="TextureRect" parent="." index="1"]
|
||||
[node name="OLD_buttons_background" type="TextureRect" parent="." index="2"]
|
||||
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.0
|
||||
|
@ -97,7 +105,7 @@ texture = ExtResource( 4 )
|
|||
stretch_mode = 0
|
||||
_sections_unfolded = [ "Size Flags" ]
|
||||
|
||||
[node name="center_container" type="CenterContainer" parent="." index="2"]
|
||||
[node name="center_container" type="CenterContainer" parent="." index="3"]
|
||||
|
||||
editor/display_folded = true
|
||||
visible = false
|
||||
|
@ -380,7 +388,7 @@ percent_visible = 1.0
|
|||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="." index="3"]
|
||||
[node name="h_box_container" type="HBoxContainer" parent="." index="4"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
|
@ -921,6 +929,8 @@ texture_normal = ExtResource( 10 )
|
|||
texture_pressed = ExtResource( 11 )
|
||||
_sections_unfolded = [ "Size Flags", "Textures" ]
|
||||
|
||||
[connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]
|
||||
|
||||
[connection signal="pressed" from="center_container/v_box_container/login_button" to="." method="_on_login_button_pressed"]
|
||||
|
||||
[connection signal="pressed" from="center_container/v_box_container/quit_button" to="center_container/v_box_container/quit_button" method="_on_quit_button_pressed"]
|
||||
|
|
Loading…
Reference in a new issue