Add a class to store the server result data
This commit is contained in:
parent
ec58b28375
commit
f08e154e6f
2 changed files with 23 additions and 3 deletions
16
assets/Scripts/Models/nel_server_info.gd
Normal file
16
assets/Scripts/Models/nel_server_info.gd
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class nel_server_info:
|
||||||
|
var _cookie;
|
||||||
|
var _shardIp;
|
||||||
|
var _ringStartAdress;
|
||||||
|
var _ringAddress;
|
||||||
|
var _unknowAdress;
|
||||||
|
var _patchAddress;
|
||||||
|
|
||||||
|
func _init(connexionResultString):
|
||||||
|
var params = connexionResultString.split('#');
|
||||||
|
_cookie = params[1];
|
||||||
|
_shardIp = params[2];
|
||||||
|
_ringStartAdress = params[3];
|
||||||
|
_ringAddress = params[4];
|
||||||
|
_unknowAdress = params[5];
|
||||||
|
_patchAddress = params[6];
|
|
@ -33,11 +33,15 @@ func do_request(username, password):
|
||||||
|
|
||||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||||
var s = body.get_string_from_utf8().split(":")
|
var s = body.get_string_from_utf8().split(":")
|
||||||
var ctn = s[0]
|
if(s[0] != "0"):
|
||||||
# No error so login was successful.
|
var server_info_script = load("res://assets/Scripts/Models/nel_server_info.gd");
|
||||||
if(ctn != "0"):
|
var server_info = server_info_script.nel_server_info.new(body.get_string_from_utf8());
|
||||||
|
print(server_info._cookie)
|
||||||
|
print(server_info._shardIp)
|
||||||
emit_signal( "login_button_pressed" )
|
emit_signal( "login_button_pressed" )
|
||||||
|
|
||||||
|
# No error so login was successful.
|
||||||
|
|
||||||
|
|
||||||
func _make_post_request(url, data_to_send, use_ssl):
|
func _make_post_request(url, data_to_send, use_ssl):
|
||||||
# Convert data to json string:
|
# Convert data to json string:
|
||||||
|
|
Loading…
Reference in a new issue