Use correct OOP
This commit is contained in:
parent
fc9912fddd
commit
ffad2cee34
2 changed files with 34 additions and 3 deletions
32
assets/Scripts/Models/nel_login_message.gd
Normal file
32
assets/Scripts/Models/nel_login_message.gd
Normal file
|
@ -0,0 +1,32 @@
|
|||
class nel_login_message:
|
||||
var _cmd;
|
||||
var _login;
|
||||
var _password;
|
||||
var _clientApplication;
|
||||
var _cp;
|
||||
var _lg;
|
||||
|
||||
func _init(cmd, login, password, clientApplication, cp, lg):
|
||||
self._cmd = cmd;
|
||||
self._login = login;
|
||||
self._password = password;
|
||||
self._clientApplication = clientApplication;
|
||||
self._cp = cp;
|
||||
self._lg = lg;
|
||||
|
||||
func get_request_string():
|
||||
var request_string = "cmd=" + self._cmd;
|
||||
if self._login != "":
|
||||
request_string += "&login=" + self._login;
|
||||
if self._password != "":
|
||||
request_string += "&password=" + self._password;
|
||||
if self._clientApplication != "":
|
||||
request_string += "&clientApplication=" + self._clientApplication
|
||||
if self._cp != "":
|
||||
request_string += "&cp=" + self._cp
|
||||
if self._lg != "":
|
||||
request_string += "&lg=" + self._lg
|
||||
|
||||
return request_string;
|
||||
|
||||
|
|
@ -18,9 +18,8 @@ func _on_quit_button_pressed():
|
|||
|
||||
|
||||
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)
|
||||
var message = load("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("ask", username, "", "", "", "");
|
||||
$HTTPRequest.request("http://lirria.khaganat.net/login/r2_login.php?" + message.get_request_string());
|
||||
|
||||
|
||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||
|
|
Loading…
Reference in a new issue