Preliminary support for registering.
This commit is contained in:
parent
2de2459411
commit
b2353c109e
4 changed files with 59 additions and 5 deletions
20
assets/Scripts/Models/nel_register_form.gd
Normal file
20
assets/Scripts/Models/nel_register_form.gd
Normal file
|
@ -0,0 +1,20 @@
|
|||
class nel_register_form:
|
||||
var _username;
|
||||
var _password;
|
||||
var _email;
|
||||
var _terms_accepted;
|
||||
|
||||
func _init(username, password, email, terms_accepted):
|
||||
self._username = username;
|
||||
self._password = password;
|
||||
self._email = email;
|
||||
self._terms_accepted = terms_accepted;
|
||||
|
||||
func get_form_data():
|
||||
return {
|
||||
"Username": self._username,
|
||||
"Password": self._password,
|
||||
"ConfirmPass": self._password,
|
||||
"Email": self._email,
|
||||
"TaC": 1 if self._terms_accepted else 0
|
||||
}
|
|
@ -3,7 +3,7 @@ class nel_server_info:
|
|||
var _shardIp;
|
||||
var _ringStartAdress;
|
||||
var _ringAddress;
|
||||
var _patchVersion
|
||||
var _patchVersion;
|
||||
var _backupPatchUrls;
|
||||
var _patchUrls;
|
||||
|
||||
|
@ -16,4 +16,4 @@ class nel_server_info:
|
|||
self._ringAddress = temp[0];
|
||||
self._patchVersion = temp[1];
|
||||
self._backupPatchUrls = params[5];
|
||||
self._patchUrls = params[6];
|
||||
self._patchUrls = params[6];
|
||||
|
|
|
@ -15,3 +15,37 @@ func _on_cancel_button_pressed():
|
|||
|
||||
func _on_license_button_pressed():
|
||||
emit_signal( "license_button_pressed" )
|
||||
# No error so login was successful.
|
||||
|
||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||
var s = body.get_string_from_utf8();
|
||||
print(s);
|
||||
emit_signal( "cancel_button_pressed");
|
||||
# if(s[0] != "0"):
|
||||
# var server_info_script = load("res://assets/Scripts/Models/nel_server_info.gd");
|
||||
# var server_info = server_info_script.nel_server_info.new(body.get_string_from_utf8());
|
||||
#
|
||||
|
||||
|
||||
func _on_register_button_pressed():
|
||||
var username = get_node("h_box_container/v_box_container/center_container/register_box/login_box/login_edit").get_text();
|
||||
var password = get_node("h_box_container/v_box_container/center_container/register_box/password_box/password_edit").get_text();
|
||||
var password_confirm = get_node("h_box_container/v_box_container/center_container/register_box/password_confirm_box/password_edit").get_text();
|
||||
var email = get_node("h_box_container/v_box_container/center_container/register_box/email_box/email_edit").get_text();
|
||||
var license_accepted = get_node("h_box_container/v_box_container/center_container/register_box/license_box/check_box").is_pressed();
|
||||
|
||||
if (username != null and username != ""):
|
||||
if(password != null and password != ""):
|
||||
if(password_confirm != null and password_confirm != ""):
|
||||
if(password_confirm == password):
|
||||
if(email != null and email != ""):
|
||||
if(license_accepted == true):
|
||||
print("Doing request");
|
||||
var body = load("res://assets/Scripts/Models/nel_register_form.gd").nel_register_form.new(username, password, email, license_accepted);
|
||||
$HTTPRequest.request("http://149.91.80.160/ams/index.php?action=add_user", "", true,HTTPClient.METHOD_POST,body.get_form_data());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# emit_signal( "cancel_button_pressed" )
|
||||
|
|
|
@ -13,7 +13,7 @@ func _ready():
|
|||
$login_menu.show()
|
||||
$register_menu.hide()
|
||||
$license_menu.hide()
|
||||
|
||||
|
||||
func _on_login_menu_login_button_pressed():
|
||||
$login_menu.hide()
|
||||
$character_selection_menu.show()
|
||||
|
@ -27,7 +27,7 @@ func _on_character_selection_menu_character_selected( slot ):
|
|||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
|
||||
|
||||
character.slot = slot
|
||||
character.pseudo = config_file.get_value( str(slot), "name", "player" )
|
||||
character.gender = config_file.get_value( str(slot), "gender", 1 )
|
||||
|
@ -36,7 +36,7 @@ func _on_character_selection_menu_character_selected( slot ):
|
|||
character.ears_size = config_file.get_value( str(slot), "ears_size", 0.0 )
|
||||
character.eyes_color = config_file.get_value( str(slot), "eyes_color", Color( 0.0, 1.0, 0.0, 1.0 ) )
|
||||
character.update()
|
||||
|
||||
|
||||
emit_signal( "character_creation_finished" )
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue