update screen connection - just show network communication
This commit is contained in:
parent
4611d9a3b0
commit
3a8dcf0619
19 changed files with 636 additions and 499 deletions
Binary file not shown.
|
@ -46,12 +46,13 @@ func connect_to_server(host, port, user_addr, user_key, user_id, lang):
|
|||
#send_system_login(host, port, user_addr, user_key, user_id, lang)
|
||||
|
||||
func _process(delta):
|
||||
_networkconnection.process(delta)
|
||||
var data = _networkconnection.get_server_messages()
|
||||
#print("******* data:", data.size(), data)
|
||||
if data.size() > 0:
|
||||
var ele = data.pop_front()
|
||||
print("*** ele:" , ele)
|
||||
#_networkconnection.process(delta)
|
||||
#var data = _networkconnection.get_server_messages()
|
||||
##print("******* data:", data.size(), data)
|
||||
#if data.size() > 0:
|
||||
# var ele = data.pop_front()
|
||||
# print("*** ele:" , ele)
|
||||
pass
|
||||
|
||||
func _exit_tree():
|
||||
print("[net_low_level] End")
|
||||
|
|
|
@ -6,167 +6,184 @@ signal register_button_pressed
|
|||
var _username
|
||||
var _password
|
||||
|
||||
func _ready():
|
||||
$wait_connexion.hide()
|
||||
|
||||
func _on_login_button_pressed():
|
||||
emit_signal( "login_button_pressed" )
|
||||
emit_signal( "login_button_pressed" )
|
||||
|
||||
|
||||
func _on_play_button_pressed():
|
||||
var username = $h_box_container/v_box_container/margin_container/login_box/email_box/email_edit.get_text();
|
||||
var password = $h_box_container/v_box_container/margin_container/login_box/password_box/password_edit.get_text();
|
||||
if username != null and username != "" and password != null and password != "":
|
||||
do_request_salt(username, password)
|
||||
$wait_connexion.show()
|
||||
|
||||
var username = $h_box_container/v_box_container/margin_container/login_box/email_box/email_edit.get_text();
|
||||
var password = $h_box_container/v_box_container/margin_container/login_box/password_box/password_edit.get_text();
|
||||
if username != null and username != "" and password != null and password != "":
|
||||
do_request_salt(username, password)
|
||||
else:
|
||||
$wait_connexion.hide()
|
||||
$error_dialog/v_box_container/label.text = "Username or Password empty"
|
||||
$error_dialog.popup_centered()
|
||||
|
||||
|
||||
func _on_play_without_connexion_pressed():
|
||||
emit_signal( "login_button_pressed" )
|
||||
emit_signal( "login_button_pressed" )
|
||||
|
||||
# Step get salt
|
||||
|
||||
func do_request_salt(username, password):
|
||||
#var message = load("res://assets/Scripts/Models/nel_login_message.gd")
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
#if message:
|
||||
_username = username
|
||||
_password = password
|
||||
var message = preload("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
#message = message.nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
var url_login = connexion.get_url_login();
|
||||
$HTTPSalt.request(url_login + "?" + message.get_request_salt());
|
||||
#$HTTPRequest.request(url_login + "?" + message.get_request_salt());
|
||||
print("[login_menu] URL:" + url_login + "?" + message.get_request_salt());
|
||||
#var message = load("res://assets/Scripts/Models/nel_login_message.gd")
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
#if message:
|
||||
_username = username
|
||||
_password = password
|
||||
var message = preload("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
#message = message.nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
var url_login = connexion.get_url_login();
|
||||
$HTTPSalt.request(url_login + "?" + message.get_request_salt());
|
||||
#$HTTPRequest.request(url_login + "?" + message.get_request_salt());
|
||||
print("[login_menu] URL:" + url_login + "?" + message.get_request_salt());
|
||||
|
||||
|
||||
func _on_HTTPSalt_request_completed(result, response_code, headers, body):
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] response_code:" + str(response_code))
|
||||
if response_code != 200: # || ProjectSettings.get_setting("khaganat/debug_mode"):
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] Impossible to connect")
|
||||
#emit_signal( "login_button_pressed" )
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect"
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
var s = body.get_string_from_utf8().split(":")
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] return:'" + str(text) + "'")
|
||||
if(s[0] == "1"):
|
||||
print("[login_menu] salt:'" + str(s[1]) + "'")
|
||||
var message = preload("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
var url_login = connexion.get_url_login();
|
||||
print("[login_menu] URL:" + url_login + "?" + message.get_request_string(str(s[1])));
|
||||
$HTTPRequest.request(url_login + "?" + message.get_request_string(str(s[1])));
|
||||
else:
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] error to connect")
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^(\\d+)[:](?<comment>.+)$")
|
||||
var search = regex.search(s[0])
|
||||
if search:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + search.get_string("comment")
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + str(s[0])
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] response_code:" + str(response_code))
|
||||
if response_code != 200: # || ProjectSettings.get_setting("khaganat/debug_mode"):
|
||||
$wait_connexion.hide()
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] Impossible to connect")
|
||||
#emit_signal( "login_button_pressed" )
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect"
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
var s = body.get_string_from_utf8().split(":")
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] return:'" + str(text) + "'")
|
||||
if(s[0] == "1"):
|
||||
print("[login_menu] salt:'" + str(s[1]) + "'")
|
||||
var message = preload("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
var url_login = connexion.get_url_login();
|
||||
print("[login_menu] URL:" + url_login + "?" + message.get_request_string(str(s[1])));
|
||||
$HTTPRequest.request(url_login + "?" + message.get_request_string(str(s[1])));
|
||||
else:
|
||||
$wait_connexion.hide()
|
||||
print("[login_menu:_on_HTTPSalt_request_completed] error to connect")
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^(\\d+)[:](?<comment>.+)$")
|
||||
var search = regex.search(s[0])
|
||||
if search:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + search.get_string("comment")
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + str(s[0])
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
|
||||
# Step Login
|
||||
|
||||
func do_request(username, password):
|
||||
var message = preload("res://assets/Scripts/Models/nel_login_message.gd")
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
if message:
|
||||
var url_login
|
||||
message = message.nel_login_message.new("https-login", username, password, "Lirria", "2", "en")
|
||||
url_login = connexion.get_url_login();
|
||||
$HTTPRequest.request(url_login + "?" + message.get_request_string());
|
||||
print("Login to URL:" + url_login + "?" + message.get_request_string());
|
||||
var message = preload("res://assets/Scripts/Models/nel_login_message.gd")
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
if message:
|
||||
var url_login
|
||||
message = message.nel_login_message.new("https-login", username, password, "Lirria", "2", "en")
|
||||
url_login = connexion.get_url_login();
|
||||
$HTTPRequest.request(url_login + "?" + message.get_request_string());
|
||||
print("Login to URL:" + url_login + "?" + message.get_request_string());
|
||||
|
||||
|
||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] response_code:" + str(response_code))
|
||||
if response_code != 200: # || ProjectSettings.get_setting("khaganat/debug_mode"):
|
||||
# emit_signal( "login_button_pressed" )
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] Impossible to connect")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect"
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
var lines = body.get_string_from_utf8().split("\n")
|
||||
if lines.size() != 2:
|
||||
print("[login_menu] Impossible to connect (bad return)")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect (bad return)"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
var line1 = lines[0].split("#")
|
||||
var line2 = lines[1].split("#")
|
||||
#print("[login_menu:_on_HTTPRequest_request_completed] return:'" + str(text) + "'" + str(lines.size()) + "'" + str(line1.size()) + "'" + str(line2.size()))
|
||||
if line1[0] != "1":
|
||||
print("[login_menu] Impossible to connect (return" + line1[0] + ")")
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^(\\d+)[:](?<comment>.+)$")
|
||||
var search = regex.search(line1[0])
|
||||
if search:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + search.get_string("comment")
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + str(line1[0])
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
if line1.size() < 5:
|
||||
print("[login_menu] Impossible to connect (bad return 1st line, size:" + str(line1.size()) + ")")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect (bad return 1st line, size:" + str(line1.size()) + ")"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
if line2.size() != 3:
|
||||
print("[login_menu] Impossible to connect (bad return 2nd line, size:" + str(line2.size()) + ")")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect (bad return 2nd line, size:" + str(line2.size()) + ")"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
var server_info_script = preload("res://assets/Scripts/Models/nel_server_info.gd");
|
||||
print("[login_menu] " + str(body.get_string_from_utf8()))
|
||||
var state = line1[0]
|
||||
var cookie = line1[1]
|
||||
var fsaddr = line1[2]
|
||||
var khaganat = fsaddr.split(":")
|
||||
var khaganat_host = khaganat[0]
|
||||
var khaganat_port = int(khaganat[1])
|
||||
var ringmainurl = line1[3]
|
||||
var fartp = line1[4]
|
||||
var stat = "0"
|
||||
if line1.size() >= 6:
|
||||
stat = line1[5]
|
||||
var r2serverversion = line2[0]
|
||||
var r2backuppatchurl = line2[1]
|
||||
var r2patchurl = line2[2]
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] response_code:" + str(response_code))
|
||||
if response_code != 200: # || ProjectSettings.get_setting("khaganat/debug_mode"):
|
||||
$wait_connexion.hide()
|
||||
# emit_signal( "login_button_pressed" )
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] Impossible to connect")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect"
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
var lines = body.get_string_from_utf8().split("\n")
|
||||
if lines.size() != 2:
|
||||
$wait_connexion.hide()
|
||||
print("[login_menu] Impossible to connect (bad return)")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect (bad return)"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
var line1 = lines[0].split("#")
|
||||
var line2 = lines[1].split("#")
|
||||
#print("[login_menu:_on_HTTPRequest_request_completed] return:'" + str(text) + "'" + str(lines.size()) + "'" + str(line1.size()) + "'" + str(line2.size()))
|
||||
if line1[0] != "1":
|
||||
$wait_connexion.hide()
|
||||
print("[login_menu] Impossible to connect (return" + line1[0] + ")")
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^(\\d+)[:](?<comment>.+)$")
|
||||
var search = regex.search(line1[0])
|
||||
if search:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + search.get_string("comment")
|
||||
$error_dialog.popup_centered()
|
||||
else:
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect\n" + str(line1[0])
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
if line1.size() < 5:
|
||||
$wait_connexion.hide()
|
||||
print("[login_menu] Impossible to connect (bad return 1st line, size:" + str(line1.size()) + ")")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect (bad return 1st line, size:" + str(line1.size()) + ")"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
if line2.size() != 3:
|
||||
$wait_connexion.hide()
|
||||
print("[login_menu] Impossible to connect (bad return 2nd line, size:" + str(line2.size()) + ")")
|
||||
$error_dialog/v_box_container/label.text = "Impossible to connect (bad return 2nd line, size:" + str(line2.size()) + ")"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
var server_info_script = preload("res://assets/Scripts/Models/nel_server_info.gd");
|
||||
print("[login_menu] " + str(body.get_string_from_utf8()))
|
||||
var state = line1[0]
|
||||
var cookie = line1[1]
|
||||
var fsaddr = line1[2]
|
||||
var khaganat = fsaddr.split(":")
|
||||
var khaganat_host = khaganat[0]
|
||||
var khaganat_port = int(khaganat[1])
|
||||
var ringmainurl = line1[3]
|
||||
var fartp = line1[4]
|
||||
var stat = "0"
|
||||
if line1.size() >= 6:
|
||||
stat = line1[5]
|
||||
var r2serverversion = line2[0]
|
||||
var r2backuppatchurl = line2[1]
|
||||
var r2patchurl = line2[2]
|
||||
|
||||
var cookieSplit = cookie.split("|")
|
||||
if cookieSplit.size() != 3:
|
||||
$error_dialog/v_box_container/label.text = "Impossible de se connecter (bad cookies size:" + str(cookieSplit.size()) + ")"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
var UserAddr = cookieSplit[0]
|
||||
var UserKey = cookieSplit[1]
|
||||
var UserId = cookieSplit[2]
|
||||
var cookieSplit = cookie.split("|")
|
||||
if cookieSplit.size() != 3:
|
||||
$wait_connexion.hide()
|
||||
$error_dialog/v_box_container/label.text = "Impossible de se connecter (bad cookies size:" + str(cookieSplit.size()) + ")"
|
||||
$error_dialog.popup_centered()
|
||||
return
|
||||
var UserAddr = cookieSplit[0]
|
||||
var UserKey = cookieSplit[1]
|
||||
var UserId = cookieSplit[2]
|
||||
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] state:" + state + ", cookie:" + cookie + ", fsaddr:" + fsaddr + ", ringmainurl:" + ringmainurl + ", fartp:" + fartp + ", stat:" + stat + ", r2serverversion:" + r2serverversion + ", r2backuppatchurl:" + r2backuppatchurl + ", r2patchurl:" + r2patchurl)
|
||||
var server_info = server_info_script.nel_server_info.new(body.get_string_from_utf8());
|
||||
var connexion = load("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
var lang = connexion.get_language()
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] khaganat_host:" + khaganat_host + ", khaganat_port:" + str(khaganat_port))
|
||||
net_low_level.connect_to_server(khaganat_host, khaganat_port, UserAddr, UserKey, UserId, lang)
|
||||
|
||||
emit_signal( "login_button_pressed" )
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] state:" + state + ", cookie:" + cookie + ", fsaddr:" + fsaddr + ", ringmainurl:" + ringmainurl + ", fartp:" + fartp + ", stat:" + stat + ", r2serverversion:" + r2serverversion + ", r2backuppatchurl:" + r2backuppatchurl + ", r2patchurl:" + r2patchurl)
|
||||
var server_info = server_info_script.nel_server_info.new(body.get_string_from_utf8());
|
||||
var connexion = load("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
var lang = connexion.get_language()
|
||||
print("[login_menu:_on_HTTPRequest_request_completed] khaganat_host:" + khaganat_host + ", khaganat_port:" + str(khaganat_port))
|
||||
net_low_level.connect_to_server(khaganat_host, khaganat_port, UserAddr, UserKey, UserId, lang)
|
||||
$wait_connexion.hide()
|
||||
emit_signal( "login_button_pressed" )
|
||||
|
||||
|
||||
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)
|
||||
# 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)
|
||||
|
||||
|
||||
func _on_register_button_pressed():
|
||||
emit_signal( "register_button_pressed" )
|
||||
emit_signal( "register_button_pressed" )
|
||||
|
||||
|
||||
func _on_error_dialog_button_pressed():
|
||||
get_node("error_dialog").hide()
|
||||
get_node("error_dialog").hide()
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://assets/GUI/themes/login_theme.theme" type="Theme" id=1]
|
||||
[ext_resource path="res://gui_scene/GUI/login/login_menu.gd" type="Script" id=2]
|
||||
[ext_resource path="res://assets/GUI/images/Login-Khanat-background.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/GUI/fonts/ryzom.ttf" type="DynamicFontData" id=4]
|
||||
[ext_resource path="res://login_scene/wait_connexion.tscn" type="PackedScene" id=5]
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id=1]
|
||||
|
||||
|
@ -22,6 +23,9 @@ anchor_bottom = 1.0
|
|||
theme = ExtResource( 1 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="wait_connexion" parent="." instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[node name="HTTPSalt" type="HTTPRequest" parent="."]
|
||||
|
||||
[node name="HTTPRequest" type="HTTPRequest" parent="."]
|
||||
|
|
|
@ -7,197 +7,197 @@ signal register_account_created
|
|||
|
||||
|
||||
func _on_sound_button_toggled( button_pressed ):
|
||||
emit_signal( "sound_button_toggled", button_pressed )
|
||||
emit_signal( "sound_button_toggled", button_pressed )
|
||||
|
||||
|
||||
func _on_cancel_button_pressed():
|
||||
emit_signal( "cancel_button_pressed" )
|
||||
emit_signal( "cancel_button_pressed" )
|
||||
|
||||
|
||||
func _on_license_button_pressed():
|
||||
emit_signal( "license_button_pressed" )
|
||||
emit_signal( "license_button_pressed" )
|
||||
|
||||
|
||||
func _on_check_box_pressed():
|
||||
do_enable_register_button();
|
||||
do_enable_register_button();
|
||||
|
||||
|
||||
func do_enable_register_button():
|
||||
var username = get_node("h_box_container/v_box_container/center_container/register_box/login_box/login_edit").get_text();
|
||||
var register = get_node('h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2')
|
||||
var password = get_node("h_box_container/v_box_container/center_container/register_box/password_box/password_edit").get_text();
|
||||
var confirmed = 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 cur_state = get_node('h_box_container/v_box_container/center_container/register_box/license_box/check_box').is_pressed()
|
||||
var username = get_node("h_box_container/v_box_container/center_container/register_box/login_box/login_edit").get_text();
|
||||
var register = get_node('h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2')
|
||||
var password = get_node("h_box_container/v_box_container/center_container/register_box/password_box/password_edit").get_text();
|
||||
var confirmed = 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 cur_state = get_node('h_box_container/v_box_container/center_container/register_box/license_box/check_box').is_pressed()
|
||||
|
||||
if username == null or username == "":
|
||||
#print("Register : username empty");
|
||||
register.disabled = true
|
||||
elif password == null or password == "":
|
||||
#print("Register : password empty");
|
||||
register.disabled = true
|
||||
elif confirmed == null or confirmed == "":
|
||||
#print("Register : confirmed empty");
|
||||
register.disabled = true
|
||||
elif password != confirmed:
|
||||
#print("Register : password != confirmed");
|
||||
register.disabled = true
|
||||
elif email == null or email == "":
|
||||
#print("Register : email empty");
|
||||
register.disabled = true
|
||||
elif cur_state == false:
|
||||
#print("Register : unchecked condition");
|
||||
register.disabled = true
|
||||
else:
|
||||
register.disabled = false
|
||||
if username == null or username == "":
|
||||
#print("Register : username empty");
|
||||
register.disabled = true
|
||||
elif password == null or password == "":
|
||||
#print("Register : password empty");
|
||||
register.disabled = true
|
||||
elif confirmed == null or confirmed == "":
|
||||
#print("Register : confirmed empty");
|
||||
register.disabled = true
|
||||
elif password != confirmed:
|
||||
#print("Register : password != confirmed");
|
||||
register.disabled = true
|
||||
elif email == null or email == "":
|
||||
#print("Register : email empty");
|
||||
register.disabled = true
|
||||
elif cur_state == false:
|
||||
#print("Register : unchecked condition");
|
||||
register.disabled = true
|
||||
else:
|
||||
register.disabled = false
|
||||
|
||||
|
||||
func _on_play_button_pressed():
|
||||
var username = $h_box_container/v_box_container/center_container/register_box/login_box/login_edit.get_text();
|
||||
var password = $h_box_container/v_box_container/center_container/register_box/password_box/password_edit.get_text();
|
||||
var confirmed = $h_box_container/v_box_container/center_container/register_box/password_confirm_box/password_edit.get_text();
|
||||
var email = $h_box_container/v_box_container/center_container/register_box/email_box/email_edit.get_text();
|
||||
var cur_state = $h_box_container/v_box_container/center_container/register_box/license_box/check_box.is_pressed()
|
||||
var enregister = $h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2
|
||||
var tac = "off";
|
||||
if cur_state == true:
|
||||
tac = "on";
|
||||
if username != null and username != "" and password != null and password != "" and confirmed != null and confirmed != "" and email != null and email != "":
|
||||
do_request(username, password, confirmed, email, tac)
|
||||
var username = $h_box_container/v_box_container/center_container/register_box/login_box/login_edit.get_text();
|
||||
var password = $h_box_container/v_box_container/center_container/register_box/password_box/password_edit.get_text();
|
||||
var confirmed = $h_box_container/v_box_container/center_container/register_box/password_confirm_box/password_edit.get_text();
|
||||
var email = $h_box_container/v_box_container/center_container/register_box/email_box/email_edit.get_text();
|
||||
var cur_state = $h_box_container/v_box_container/center_container/register_box/license_box/check_box.is_pressed()
|
||||
var enregister = $h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2
|
||||
var tac = "off";
|
||||
if cur_state == true:
|
||||
tac = "on";
|
||||
if username != null and username != "" and password != null and password != "" and confirmed != null and confirmed != "" and email != null and email != "":
|
||||
do_request(username, password, confirmed, email, tac)
|
||||
|
||||
|
||||
func do_request(username, password, confirmed, email, tac):
|
||||
var script_register = load("res://assets/Scripts/Models/nel_register.gd")
|
||||
var script_connexion = load("res://assets/Scripts/Config/connexion.gd")
|
||||
var connexion = script_connexion.connexion.new()
|
||||
var url_register = connexion.get_url_register()
|
||||
var valid_certificate = connexion.get_valid_certificate()
|
||||
var request_data = script_register.nel_register.new(username, password, confirmed, email, tac)
|
||||
#print("url:" + str(url_register))
|
||||
#print("headers:" + str(request_data.get_headers()))
|
||||
#print("data:" + str(request_data.get_param_add_user_string()))
|
||||
# Ignore redirect 302 (because khaganat response 302 when account is created !)
|
||||
$HTTPRequest.set_max_redirects(0)
|
||||
var err = $HTTPRequest.request(url_register,
|
||||
request_data.get_headers(),
|
||||
valid_certificate,
|
||||
HTTPClient.METHOD_POST,
|
||||
request_data.get_param_add_user_string()
|
||||
);
|
||||
match err:
|
||||
0:
|
||||
print("[Register] Send command")
|
||||
get_node("wait_dialog").popup_centered()
|
||||
_:
|
||||
print("[Register] Command not sended : Failure! (code:" + str(err) + ")")
|
||||
var comment_last = get_node('h_box_container/v_box_container/center_container/register_box/comment_last')
|
||||
var script_register = load("res://assets/Scripts/Models/nel_register.gd")
|
||||
var script_connexion = load("res://assets/Scripts/Config/connexion.gd")
|
||||
var connexion = script_connexion.connexion.new()
|
||||
var url_register = connexion.get_url_register()
|
||||
var valid_certificate = connexion.get_valid_certificate()
|
||||
var request_data = script_register.nel_register.new(username, password, confirmed, email, tac)
|
||||
#print("url:" + str(url_register))
|
||||
#print("headers:" + str(request_data.get_headers()))
|
||||
#print("data:" + str(request_data.get_param_add_user_string()))
|
||||
# Ignore redirect 302 (because khaganat response 302 when account is created !)
|
||||
$HTTPRequest.set_max_redirects(0)
|
||||
var err = $HTTPRequest.request(url_register,
|
||||
request_data.get_headers(),
|
||||
valid_certificate,
|
||||
HTTPClient.METHOD_POST,
|
||||
request_data.get_param_add_user_string()
|
||||
);
|
||||
match err:
|
||||
0:
|
||||
print("[Register] Send command")
|
||||
get_node("wait_dialog").popup_centered()
|
||||
_:
|
||||
print("[Register] Command not sended : Failure! (code:" + str(err) + ")")
|
||||
var comment_last = get_node('h_box_container/v_box_container/center_container/register_box/comment_last')
|
||||
|
||||
comment_last.text = "Impossible de créer votre compte (Erreur dans l'envoie de la requette)"
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible de créer votre compte\nErreur dans l'envoie de la requette\n"
|
||||
get_node("error_dialog").popup_centered()
|
||||
comment_last.text = "Impossible de créer votre compte (Erreur dans l'envoie de la requette)"
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible de créer votre compte\nErreur dans l'envoie de la requette\n"
|
||||
get_node("error_dialog").popup_centered()
|
||||
|
||||
|
||||
func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
|
||||
var pos
|
||||
var search
|
||||
var enregister = $h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2
|
||||
var comment_last = $h_box_container/v_box_container/center_container/register_box/comment_last
|
||||
var comment_username = $h_box_container/v_box_container/center_container/register_box/login_box/comment
|
||||
var comment_password = $h_box_container/v_box_container/center_container/register_box/password_box/comment
|
||||
var comment_confirm_password = $h_box_container/v_box_container/center_container/register_box/password_confirm_box/comment
|
||||
var comment_email = $h_box_container/v_box_container/center_container/register_box/email_box/comment
|
||||
var regex = RegEx.new()
|
||||
var pos
|
||||
var search
|
||||
var enregister = $h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2
|
||||
var comment_last = $h_box_container/v_box_container/center_container/register_box/comment_last
|
||||
var comment_username = $h_box_container/v_box_container/center_container/register_box/login_box/comment
|
||||
var comment_password = $h_box_container/v_box_container/center_container/register_box/password_box/comment
|
||||
var comment_confirm_password = $h_box_container/v_box_container/center_container/register_box/password_confirm_box/comment
|
||||
var comment_email = $h_box_container/v_box_container/center_container/register_box/email_box/comment
|
||||
var regex = RegEx.new()
|
||||
|
||||
comment_username.text = ""
|
||||
comment_password.text = ""
|
||||
comment_confirm_password.text = ""
|
||||
comment_email.text = ""
|
||||
comment_last.text = ""
|
||||
comment_last.add_color_override("font_color", "000000")
|
||||
comment_username.text = ""
|
||||
comment_password.text = ""
|
||||
comment_confirm_password.text = ""
|
||||
comment_email.text = ""
|
||||
comment_last.text = ""
|
||||
comment_last.add_color_override("font_color", "000000")
|
||||
|
||||
print("[Register] result:" + str(result) + ", response_code:" + str(response_code))
|
||||
if result == HTTPRequest.RESULT_REDIRECT_LIMIT_REACHED and response_code == 302:
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("info_dialog/v_box_container/label").text = "Compte créé"
|
||||
get_node("info_dialog").popup_centered()
|
||||
return
|
||||
print("[Register] result:" + str(result) + ", response_code:" + str(response_code))
|
||||
if result == HTTPRequest.RESULT_REDIRECT_LIMIT_REACHED and response_code == 302:
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("info_dialog/v_box_container/label").text = "Compte créé"
|
||||
get_node("info_dialog").popup_centered()
|
||||
return
|
||||
|
||||
if result == HTTPRequest.RESULT_SUCCESS and response_code != 200:
|
||||
comment_last.text = "Serveur a renvoyé une erreur (code retour HTTP:" + str(response_code) + ")"
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible de créer le compte\nCode retour HTTP:" + str(response_code)
|
||||
get_node("error_dialog").popup_centered()
|
||||
return
|
||||
if result == HTTPRequest.RESULT_SUCCESS and response_code != 200:
|
||||
comment_last.text = "Serveur a renvoyé une erreur (code retour HTTP:" + str(response_code) + ")"
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible de créer le compte\nCode retour HTTP:" + str(response_code)
|
||||
get_node("error_dialog").popup_centered()
|
||||
return
|
||||
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("wait_dialog").hide()
|
||||
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
regex.compile("^(\\d+)[:]")
|
||||
var tab = text.split(":", true,2)
|
||||
if tab.size() > 1 :
|
||||
if regex.search(tab[0]):
|
||||
if int(tab[0]) != 1:
|
||||
comment_last.text = "Serveur a renvoyé une erreur (Code retour:" + str(tab[0]) + ", message:" + tab[1] +")"
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("error_dialog/v_box_container/label").text = "Serveur a renvoyé une erreur\nCode retour:" + str(tab[0]) + "\nMessage:" + tab[1]
|
||||
get_node("error_dialog").popup_centered()
|
||||
print("[Register] Failed to register (Code retour:" + str(tab[0]) + ", message:" + tab[1] +")")
|
||||
return
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
regex.compile("^(\\d+)[:]")
|
||||
var tab = text.split(":", true,2)
|
||||
if tab.size() > 1 :
|
||||
if regex.search(tab[0]):
|
||||
if int(tab[0]) != 1:
|
||||
comment_last.text = "Serveur a renvoyé une erreur (Code retour:" + str(tab[0]) + ", message:" + tab[1] +")"
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
get_node("wait_dialog").hide()
|
||||
get_node("error_dialog/v_box_container/label").text = "Serveur a renvoyé une erreur\nCode retour:" + str(tab[0]) + "\nMessage:" + tab[1]
|
||||
get_node("error_dialog").popup_centered()
|
||||
print("[Register] Failed to register (Code retour:" + str(tab[0]) + ", message:" + tab[1] +")")
|
||||
return
|
||||
|
||||
tab = text.rsplit("\n")
|
||||
regex.compile(">(?<comment>.+)</")
|
||||
tab = text.rsplit("\n")
|
||||
regex.compile(">(?<comment>.+)</")
|
||||
|
||||
for item in tab:
|
||||
pos = item.find("comment-Username")
|
||||
search = regex.search(item)
|
||||
if pos > 0 and search:
|
||||
comment_username.text = search.get_string("comment")
|
||||
print("[Register] Username issue : " + comment_username.text)
|
||||
pos = item.find("comment-Password")
|
||||
if pos > 0 and search:
|
||||
comment_password.text = search.get_string("comment")
|
||||
print("[Register] Password issue : " + comment_password.text)
|
||||
pos = item.find("comment-ConfirmPass")
|
||||
if pos > 0 and search:
|
||||
comment_confirm_password.text = search.get_string("comment")
|
||||
print("[Register] ConfirmPass issue : " + comment_confirm_password.text)
|
||||
pos = item.find("comment-Email")
|
||||
if pos > 0 and search:
|
||||
comment_email.text = search.get_string("comment")
|
||||
print("[Register] Email issue : " + comment_email.text)
|
||||
pos = item.find("comment-Tac")
|
||||
if pos > 0 and search:
|
||||
comment_last.text = search.get_string("comment")
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
print("[Register] Issue : " + comment_last.text)
|
||||
for item in tab:
|
||||
pos = item.find("comment-Username")
|
||||
search = regex.search(item)
|
||||
if pos > 0 and search:
|
||||
comment_username.text = search.get_string("comment")
|
||||
print("[Register] Username issue : " + comment_username.text)
|
||||
pos = item.find("comment-Password")
|
||||
if pos > 0 and search:
|
||||
comment_password.text = search.get_string("comment")
|
||||
print("[Register] Password issue : " + comment_password.text)
|
||||
pos = item.find("comment-ConfirmPass")
|
||||
if pos > 0 and search:
|
||||
comment_confirm_password.text = search.get_string("comment")
|
||||
print("[Register] ConfirmPass issue : " + comment_confirm_password.text)
|
||||
pos = item.find("comment-Email")
|
||||
if pos > 0 and search:
|
||||
comment_email.text = search.get_string("comment")
|
||||
print("[Register] Email issue : " + comment_email.text)
|
||||
pos = item.find("comment-Tac")
|
||||
if pos > 0 and search:
|
||||
comment_last.text = search.get_string("comment")
|
||||
comment_last.add_color_override("font_color", "b51111")
|
||||
print("[Register] Issue : " + comment_last.text)
|
||||
|
||||
|
||||
func _on_login_edit_text_changed(new_text):
|
||||
do_enable_register_button();
|
||||
do_enable_register_button();
|
||||
|
||||
|
||||
func _on_password_edit_text_changed(new_text):
|
||||
do_enable_register_button();
|
||||
do_enable_register_button();
|
||||
|
||||
|
||||
func _on_email_edit_text_changed(new_text):
|
||||
do_enable_register_button();
|
||||
do_enable_register_button();
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
$HTTPRequest.cancel_request()
|
||||
get_node("wait_dialog").hide()
|
||||
$HTTPRequest.cancel_request()
|
||||
get_node("wait_dialog").hide()
|
||||
|
||||
|
||||
func _on_info_dialog_button_pressed():
|
||||
get_node("info_dialog").hide()
|
||||
hide()
|
||||
# _on_register_menu_register_button_pressed
|
||||
emit_signal( "register_account_created" )
|
||||
get_node("info_dialog").hide()
|
||||
hide()
|
||||
# _on_register_menu_register_button_pressed
|
||||
emit_signal( "register_account_created" )
|
||||
|
||||
func _on_error_dialog_button_pressed():
|
||||
get_node("error_dialog").hide()
|
||||
get_node("error_dialog").hide()
|
||||
|
|
|
@ -24,33 +24,33 @@ var character_preview
|
|||
|
||||
func _ready():
|
||||
|
||||
var popup_node = $margin_container/v_box_container/generate_name_box/region_menu
|
||||
var popup = popup_node.get_popup()
|
||||
popup.add_item( "Khanat" )
|
||||
popup.add_item( "Culno" )
|
||||
popup.add_item( "Tcara" )
|
||||
popup_node.selected = 1
|
||||
var popup_node = $margin_container/v_box_container/generate_name_box/region_menu
|
||||
var popup = popup_node.get_popup()
|
||||
popup.add_item( "Khanat" )
|
||||
popup.add_item( "Culno" )
|
||||
popup.add_item( "Tcara" )
|
||||
popup_node.selected = 1
|
||||
|
||||
self.character_preview = self.get_node( "../../../viewport/character" )
|
||||
self.character_preview = self.get_node( "../../../viewport/character" )
|
||||
|
||||
|
||||
func _on_return_button_pressed():
|
||||
emit_signal( "return_button_pressed" )
|
||||
emit_signal( "return_button_pressed" )
|
||||
|
||||
|
||||
func _on_valid_button_pressed():
|
||||
emit_signal( "creation_button_pressed" )
|
||||
emit_signal( "creation_button_pressed" )
|
||||
|
||||
func show_error( string ):
|
||||
$margin_container/v_box_container/error_label.set( "custom_colors/font_color", Color( 1, 0, 0, 1 ))
|
||||
$margin_container/v_box_container/error_label.text = string
|
||||
$margin_container/v_box_container/error_label.set( "custom_colors/font_color", Color( 1, 0, 0, 1 ))
|
||||
$margin_container/v_box_container/error_label.text = string
|
||||
|
||||
func show_help( string ):
|
||||
$margin_container/v_box_container/error_label.set( "custom_colors/font_color", Color( 0, 1, 0, 1 ))
|
||||
$margin_container/v_box_container/error_label.text = string
|
||||
$margin_container/v_box_container/error_label.set( "custom_colors/font_color", Color( 0, 1, 0, 1 ))
|
||||
$margin_container/v_box_container/error_label.text = string
|
||||
|
||||
func _on_character_creation_box_visibility_changed():
|
||||
emit_signal( "character_preview_need_update" )
|
||||
emit_signal( "character_preview_need_update" )
|
||||
# self.character_preview.pseudo = $margin_container/v_box_container/name_box/line_edit.text
|
||||
# self.character_preview.gender = $margin_container/v_box_container/sexe_box/h_box_container/sex_bar.value
|
||||
# if self.character_preview.gender == 1:
|
||||
|
@ -63,44 +63,44 @@ func _on_character_creation_box_visibility_changed():
|
|||
# self.character_preview.update()
|
||||
|
||||
func _on_generate_name_pressed():
|
||||
var nb_syllabes = $margin_container/v_box_container/generate_name_box/nb_syllabe.value
|
||||
var nb_noms = $margin_container/v_box_container/generate_name_box/nb_nom.value
|
||||
var region = $margin_container/v_box_container/generate_name_box/region_menu.text
|
||||
var nb_syllabes = $margin_container/v_box_container/generate_name_box/nb_syllabe.value
|
||||
var nb_noms = $margin_container/v_box_container/generate_name_box/nb_nom.value
|
||||
var region = $margin_container/v_box_container/generate_name_box/region_menu.text
|
||||
|
||||
var name = ""
|
||||
var trad = ""
|
||||
for nom_index in range( 0, nb_noms ):
|
||||
for syllabe_index in range( 0, nb_syllabes ):
|
||||
if region == "Culno":
|
||||
var index = randi()%len(syllabes_culno)
|
||||
name += syllabes_culno[ index ]
|
||||
trad += syllabes_culno_trad[ index ]
|
||||
elif region == "Tcara":
|
||||
var index = randi()%len(syllabes_tcara)
|
||||
name += syllabes_tcara[ index ]
|
||||
trad += syllabes_tcara_trad[ index ]
|
||||
else:
|
||||
var index = randi()%len(syllabes_khanat)
|
||||
name += syllabes_khanat[ index ]
|
||||
trad += syllabes_khanat_trad[ index ]
|
||||
if nom_index+1 < nb_noms:
|
||||
name += " "
|
||||
trad += " / "
|
||||
var name = ""
|
||||
var trad = ""
|
||||
for nom_index in range( 0, nb_noms ):
|
||||
for syllabe_index in range( 0, nb_syllabes ):
|
||||
if region == "Culno":
|
||||
var index = randi()%len(syllabes_culno)
|
||||
name += syllabes_culno[ index ]
|
||||
trad += syllabes_culno_trad[ index ]
|
||||
elif region == "Tcara":
|
||||
var index = randi()%len(syllabes_tcara)
|
||||
name += syllabes_tcara[ index ]
|
||||
trad += syllabes_tcara_trad[ index ]
|
||||
else:
|
||||
var index = randi()%len(syllabes_khanat)
|
||||
name += syllabes_khanat[ index ]
|
||||
trad += syllabes_khanat_trad[ index ]
|
||||
if nom_index+1 < nb_noms:
|
||||
name += " "
|
||||
trad += " / "
|
||||
|
||||
$margin_container/v_box_container/name_box/line_edit.text = name
|
||||
self.show_help( trad )
|
||||
$margin_container/v_box_container/name_box/line_edit.text = name
|
||||
self.show_help( trad )
|
||||
|
||||
|
||||
func _on_sex_bar_value_changed( value ):
|
||||
emit_signal( "sex_bar_changed", value )
|
||||
emit_signal( "sex_bar_changed", value )
|
||||
|
||||
func _on_size_bar_value_changed( value ):
|
||||
emit_signal( "size_bar_changed", value )
|
||||
emit_signal( "size_bar_changed", value )
|
||||
|
||||
func _on_ears_size_value_changed(value):
|
||||
emit_signal( "ears_size_bar_changed", value )
|
||||
emit_signal( "ears_size_bar_changed", value )
|
||||
|
||||
func _on_eyes_color_color_changed(color):
|
||||
emit_signal( "eyes_color_changed", color )
|
||||
emit_signal( "eyes_color_changed", color )
|
||||
|
||||
|
||||
|
|
|
@ -21,256 +21,256 @@ func _ready():
|
|||
# $viewport/character/face_camera.make_current()
|
||||
|
||||
|
||||
self.character_preview = $viewport/character
|
||||
self.character_preview.set_default_values()
|
||||
self.character_preview = $viewport/character
|
||||
self.character_preview.set_default_values()
|
||||
# self.character_preview.get_node( "Camera_rotation_helper/face_camera" ).make_current()
|
||||
self.character_preview.get_node( "face_camera" ).make_current()
|
||||
self.character_preview.get_node( "face_camera" ).make_current()
|
||||
|
||||
self.character_mesh = $viewport/character.get_node("suzanne/mesh")
|
||||
self.character_mesh = $viewport/character.get_node("suzanne/mesh")
|
||||
# self.character_face_camera = $viewport/character/Camera_rotation_helper/face_camera
|
||||
self.character_box = $margin_container/character_box
|
||||
self.character_creation_box = $margin_container/character_box/character_creation_box
|
||||
self.name_input = self.character_box.get_node( "character_creation_box/margin_container/v_box_container/name_box/line_edit" )
|
||||
self.character_box = $margin_container/character_box
|
||||
self.character_creation_box = $margin_container/character_box/character_creation_box
|
||||
self.name_input = self.character_box.get_node( "character_creation_box/margin_container/v_box_container/name_box/line_edit" )
|
||||
|
||||
self.character_preview.update()
|
||||
self.character_preview.update()
|
||||
|
||||
update_character_slots()
|
||||
update_character_slots()
|
||||
|
||||
|
||||
|
||||
func update_character_slots():
|
||||
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
|
||||
var useds_slot = []
|
||||
var last_slot = 0
|
||||
for section in config_file.get_sections():
|
||||
useds_slot.append( int(section) )
|
||||
if not self.character_box.has_node( "character_slots/slots_box/slot_box_"+section ):
|
||||
last_slot = int(section)
|
||||
var useds_slot = []
|
||||
var last_slot = 0
|
||||
for section in config_file.get_sections():
|
||||
useds_slot.append( int(section) )
|
||||
if not self.character_box.has_node( "character_slots/slots_box/slot_box_"+section ):
|
||||
last_slot = int(section)
|
||||
|
||||
var character_name = config_file.get_value( section, "name" )
|
||||
if not character_name:
|
||||
character_name = "NameNotFound"
|
||||
var character_name = config_file.get_value( section, "name" )
|
||||
if not character_name:
|
||||
character_name = "NameNotFound"
|
||||
|
||||
var slot_box = HBoxContainer.new()
|
||||
slot_box.name = "slot_box_"+section
|
||||
slot_box.size_flags_horizontal = SIZE_FILL
|
||||
slot_box.size_flags_vertical = SIZE_EXPAND
|
||||
slot_box.set( "custom_constants/separation", 8)
|
||||
self.character_box.get_node( "character_slots/slots_box/" ).add_child( slot_box )
|
||||
slot_box.connect( "mouse_entered", self, "_on_name_mouse_entered_pressed", [int(section)] )
|
||||
var slot_box = HBoxContainer.new()
|
||||
slot_box.name = "slot_box_"+section
|
||||
slot_box.size_flags_horizontal = SIZE_FILL
|
||||
slot_box.size_flags_vertical = SIZE_EXPAND
|
||||
slot_box.set( "custom_constants/separation", 8)
|
||||
self.character_box.get_node( "character_slots/slots_box/" ).add_child( slot_box )
|
||||
slot_box.connect( "mouse_entered", self, "_on_name_mouse_entered_pressed", [int(section)] )
|
||||
|
||||
var label_name = Label.new()
|
||||
label_name.text = character_name
|
||||
label_name.size_flags_horizontal = SIZE_EXPAND
|
||||
slot_box.add_child( label_name )
|
||||
var label_name = Label.new()
|
||||
label_name.text = character_name
|
||||
label_name.size_flags_horizontal = SIZE_EXPAND
|
||||
slot_box.add_child( label_name )
|
||||
|
||||
var choose_button = Button.new()
|
||||
choose_button.text = "Choisir"
|
||||
slot_box.add_child( choose_button )
|
||||
choose_button.connect( "pressed", self, "_on_choose_pressed", [int(section)] )
|
||||
choose_button.connect( "mouse_entered", self, "_on_name_mouse_entered_pressed", [int(section)] )
|
||||
var choose_button = Button.new()
|
||||
choose_button.text = "Choisir"
|
||||
slot_box.add_child( choose_button )
|
||||
choose_button.connect( "pressed", self, "_on_choose_pressed", [int(section)] )
|
||||
choose_button.connect( "mouse_entered", self, "_on_name_mouse_entered_pressed", [int(section)] )
|
||||
|
||||
var delete_button = Button.new()
|
||||
delete_button.text = "Supprimer"
|
||||
slot_box.add_child( delete_button )
|
||||
delete_button.connect( "pressed", self, "_on_delete_pressed", [int(section), slot_box] )
|
||||
delete_button.connect( "mouse_entered", self, "_on_name_mouse_entered_pressed", [int(section)] )
|
||||
var delete_button = Button.new()
|
||||
delete_button.text = "Supprimer"
|
||||
slot_box.add_child( delete_button )
|
||||
delete_button.connect( "pressed", self, "_on_delete_pressed", [int(section), slot_box] )
|
||||
delete_button.connect( "mouse_entered", self, "_on_name_mouse_entered_pressed", [int(section)] )
|
||||
|
||||
|
||||
if self.character_box.has_node( "character_slots/creation_button" ):
|
||||
self.character_box.get_node( "character_slots/creation_button" ).free()
|
||||
if self.character_box.has_node( "character_slots/creation_button" ):
|
||||
self.character_box.get_node( "character_slots/creation_button" ).free()
|
||||
|
||||
var index = 0
|
||||
while index in useds_slot:
|
||||
index += 1
|
||||
var next_slot = index
|
||||
var create_new_characer_button = Button.new()
|
||||
create_new_characer_button.name = "creation_button"
|
||||
create_new_characer_button.text = "Créer"
|
||||
create_new_characer_button.hint_tooltip = "Create a new character"
|
||||
self.character_box.get_node( "character_slots/slots_box/" ).add_child( create_new_characer_button )
|
||||
create_new_characer_button.connect( "pressed", self, "_on_create_pressed", [next_slot] )
|
||||
var index = 0
|
||||
while index in useds_slot:
|
||||
index += 1
|
||||
var next_slot = index
|
||||
var create_new_characer_button = Button.new()
|
||||
create_new_characer_button.name = "creation_button"
|
||||
create_new_characer_button.text = "Créer"
|
||||
create_new_characer_button.hint_tooltip = "Create a new character"
|
||||
self.character_box.get_node( "character_slots/slots_box/" ).add_child( create_new_characer_button )
|
||||
create_new_characer_button.connect( "pressed", self, "_on_create_pressed", [next_slot] )
|
||||
|
||||
func _on_create_pressed( slot ):
|
||||
self.character_preview.slot = slot
|
||||
self.character_box.get_node( "character_slots" ).hide()
|
||||
self.character_box.get_node( "character_creation_box" ).show()
|
||||
self.character_preview.update()
|
||||
self.character_preview.slot = slot
|
||||
self.character_box.get_node( "character_slots" ).hide()
|
||||
self.character_box.get_node( "character_creation_box" ).show()
|
||||
self.character_preview.update()
|
||||
|
||||
func _on_choose_pressed( slot ):
|
||||
emit_signal( "character_selected", slot )
|
||||
emit_signal( "character_selected", slot )
|
||||
|
||||
|
||||
func _on_delete_pressed( slot, node_to_delete ):
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
config_file.erase_section( str(slot) )
|
||||
config_file.save( "user://player.cfg" )
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
config_file.erase_section( str(slot) )
|
||||
config_file.save( "user://player.cfg" )
|
||||
|
||||
var parent = node_to_delete.get_parent()
|
||||
parent.remove_child( node_to_delete )
|
||||
var parent = node_to_delete.get_parent()
|
||||
parent.remove_child( node_to_delete )
|
||||
|
||||
update_character_slots()
|
||||
update_character_slots()
|
||||
|
||||
|
||||
func _on_name_mouse_entered_pressed( slot ):
|
||||
$viewport/character.show()
|
||||
preview_slot = slot
|
||||
update_preview()
|
||||
$viewport/character.show()
|
||||
preview_slot = slot
|
||||
update_preview()
|
||||
|
||||
func update_preview():
|
||||
var slot = preview_slot
|
||||
var slot = preview_slot
|
||||
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
if config_file.has_section( str(slot) ):
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
if config_file.has_section( str(slot) ):
|
||||
|
||||
self.character_preview.slot = slot
|
||||
self.character_preview.slot = slot
|
||||
|
||||
# name
|
||||
var pseudo = config_file.get_value( str(slot), "name", "Player" )
|
||||
self.character_preview.pseudo = pseudo
|
||||
# name
|
||||
var pseudo = config_file.get_value( str(slot), "name", "Player" )
|
||||
self.character_preview.pseudo = pseudo
|
||||
|
||||
# gender
|
||||
var gender = config_file.get_value( str(slot), "gender", 1 )
|
||||
self.character_preview.gender = gender
|
||||
# gender
|
||||
var gender = config_file.get_value( str(slot), "gender", 1 )
|
||||
self.character_preview.gender = gender
|
||||
|
||||
# Color
|
||||
var color = config_file.get_value( str(slot), "color", Color( 1, 0.25, 0.25, 1 ) )
|
||||
self.character_preview.color = color
|
||||
# Color
|
||||
var color = config_file.get_value( str(slot), "color", Color( 1, 0.25, 0.25, 1 ) )
|
||||
self.character_preview.color = color
|
||||
|
||||
# Size
|
||||
var size = config_file.get_value( str(slot), "size", 1.0 )
|
||||
self.character_preview.size = size
|
||||
# Size
|
||||
var size = config_file.get_value( str(slot), "size", 1.0 )
|
||||
self.character_preview.size = size
|
||||
|
||||
# Ears size
|
||||
var ears_size = config_file.get_value( str(slot), "ears_size", 0.0 )
|
||||
self.character_preview.ears_size = ears_size
|
||||
# Ears size
|
||||
var ears_size = config_file.get_value( str(slot), "ears_size", 0.0 )
|
||||
self.character_preview.ears_size = ears_size
|
||||
|
||||
# Eyes color
|
||||
var eyes_color = config_file.get_value( str(slot), "eyes_color", Color( 0.0, 1.0, 0.0, 1.0 ) )
|
||||
self.character_preview.eyes_color = eyes_color
|
||||
# Eyes color
|
||||
var eyes_color = config_file.get_value( str(slot), "eyes_color", Color( 0.0, 1.0, 0.0, 1.0 ) )
|
||||
self.character_preview.eyes_color = eyes_color
|
||||
|
||||
self.character_preview.update()
|
||||
self.character_preview.update()
|
||||
|
||||
|
||||
func _on_character_slots_return_button_pressed():
|
||||
emit_signal( "return_button_pressed" )
|
||||
emit_signal( "return_button_pressed" )
|
||||
|
||||
func _on_character_creation_box_return_button_pressed():
|
||||
self.character_box.get_node( "character_slots" ).show()
|
||||
self.character_box.get_node( "character_creation_box" ).hide()
|
||||
self.character_box.get_node( "character_slots" ).show()
|
||||
self.character_box.get_node( "character_creation_box" ).hide()
|
||||
|
||||
func _on_character_creation_box_creation_button_pressed():
|
||||
if not self.name_input.text or self.name_input.text == "":
|
||||
self.character_box.get_node( "character_creation_box" ).show_error( "You need to choose a character's name." )
|
||||
return
|
||||
self.character_preview.pseudo = self.name_input.text
|
||||
if not self.name_input.text or self.name_input.text == "":
|
||||
self.character_box.get_node( "character_creation_box" ).show_error( "You need to choose a character's name." )
|
||||
return
|
||||
self.character_preview.pseudo = self.name_input.text
|
||||
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
config_file.set_value( str(self.character_preview.slot), "name", self.character_preview.pseudo)
|
||||
config_file.set_value( str(self.character_preview.slot), "gender", self.character_preview.gender)
|
||||
config_file.set_value( str(self.character_preview.slot), "color", self.character_preview.color)
|
||||
config_file.set_value( str(self.character_preview.slot), "size", self.character_preview.size)
|
||||
config_file.set_value( str(self.character_preview.slot), "ears_size", self.character_preview.ears_size)
|
||||
config_file.set_value( str(self.character_preview.slot), "eyes_color", self.character_preview.eyes_color)
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://player.cfg" )
|
||||
if err:
|
||||
print("Error code when loading player config file: ", err)
|
||||
config_file.set_value( str(self.character_preview.slot), "name", self.character_preview.pseudo)
|
||||
config_file.set_value( str(self.character_preview.slot), "gender", self.character_preview.gender)
|
||||
config_file.set_value( str(self.character_preview.slot), "color", self.character_preview.color)
|
||||
config_file.set_value( str(self.character_preview.slot), "size", self.character_preview.size)
|
||||
config_file.set_value( str(self.character_preview.slot), "ears_size", self.character_preview.ears_size)
|
||||
config_file.set_value( str(self.character_preview.slot), "eyes_color", self.character_preview.eyes_color)
|
||||
|
||||
config_file.save( "user://player.cfg" )
|
||||
config_file.save( "user://player.cfg" )
|
||||
|
||||
self.character_box.get_node( "character_slots" ).show()
|
||||
self.character_box.get_node( "character_creation_box" ).hide()
|
||||
update_character_slots()
|
||||
self.character_box.get_node( "character_slots" ).show()
|
||||
self.character_box.get_node( "character_creation_box" ).hide()
|
||||
update_character_slots()
|
||||
|
||||
func _on_character_creation_box_character_preview_need_update():
|
||||
self.character_preview.pseudo = self.character_creation_box.get_node( "margin_container/v_box_container/name_box/line_edit" ).text
|
||||
self.character_preview.gender = self.character_creation_box.get_node( "margin_container/v_box_container/sexe_box/h_box_container/sex_bar" ).value
|
||||
if self.character_preview.gender == 1:
|
||||
self.character_preview.color = Color( 1.0, 0.25, 0.25, 1.0 )
|
||||
else:
|
||||
self.character_preview.color = Color( 0.0, 0.0, 1.0, 1.0 )
|
||||
self.character_preview.size = self.character_creation_box.get_node( "margin_container/v_box_container/size_box/h_box_container/size_bar" ).value
|
||||
self.character_preview.ears_size = self.character_creation_box.get_node( "margin_container/v_box_container/ears_size_box/ears_size" ).value
|
||||
self.character_preview.eyes_color = self.character_creation_box.get_node( "margin_container/v_box_container/eyes_color_box/eyes_color" ).color
|
||||
self.character_preview.update()
|
||||
self.character_preview.pseudo = self.character_creation_box.get_node( "margin_container/v_box_container/name_box/line_edit" ).text
|
||||
self.character_preview.gender = self.character_creation_box.get_node( "margin_container/v_box_container/sexe_box/h_box_container/sex_bar" ).value
|
||||
if self.character_preview.gender == 1:
|
||||
self.character_preview.color = Color( 1.0, 0.25, 0.25, 1.0 )
|
||||
else:
|
||||
self.character_preview.color = Color( 0.0, 0.0, 1.0, 1.0 )
|
||||
self.character_preview.size = self.character_creation_box.get_node( "margin_container/v_box_container/size_box/h_box_container/size_bar" ).value
|
||||
self.character_preview.ears_size = self.character_creation_box.get_node( "margin_container/v_box_container/ears_size_box/ears_size" ).value
|
||||
self.character_preview.eyes_color = self.character_creation_box.get_node( "margin_container/v_box_container/eyes_color_box/eyes_color" ).color
|
||||
self.character_preview.update()
|
||||
|
||||
|
||||
func _on_character_creation_box_sex_bar_changed( value ):
|
||||
if value == 0:
|
||||
self.character_preview.gender = 0
|
||||
self.character_preview.color = Color( 0.0, 0.0, 1.0, 1.0 )
|
||||
else:
|
||||
self.character_preview.gender = 1
|
||||
self.character_preview.color = Color( 1.0, 0.25, 0.25, 1.0 )
|
||||
self.character_preview.update()
|
||||
if value == 0:
|
||||
self.character_preview.gender = 0
|
||||
self.character_preview.color = Color( 0.0, 0.0, 1.0, 1.0 )
|
||||
else:
|
||||
self.character_preview.gender = 1
|
||||
self.character_preview.color = Color( 1.0, 0.25, 0.25, 1.0 )
|
||||
self.character_preview.update()
|
||||
|
||||
func _on_character_creation_box_size_bar_changed( value ):
|
||||
self.character_preview.size = value
|
||||
self.character_preview.update()
|
||||
self.character_preview.size = value
|
||||
self.character_preview.update()
|
||||
|
||||
func _on_character_creation_box_ears_size_bar_changed( value ):
|
||||
self.character_preview.ears_size = value
|
||||
self.character_preview.update()
|
||||
self.character_preview.ears_size = value
|
||||
self.character_preview.update()
|
||||
|
||||
func _on_character_creation_box_eyes_color_changed(value):
|
||||
self.character_preview.eyes_color = value
|
||||
self.character_preview.update()
|
||||
self.character_preview.eyes_color = value
|
||||
self.character_preview.update()
|
||||
|
||||
func _process( delta ):
|
||||
|
||||
if turn_direction == "left":
|
||||
self.character_mesh.rotation.y -= delta
|
||||
elif turn_direction == "right":
|
||||
self.character_mesh.rotation.y += delta
|
||||
if turn_direction == "left":
|
||||
self.character_mesh.rotation.y -= delta
|
||||
elif turn_direction == "right":
|
||||
self.character_mesh.rotation.y += delta
|
||||
|
||||
if zoom_direction == "front":
|
||||
$viewport/character/face_camera.size += delta
|
||||
elif zoom_direction == "back":
|
||||
$viewport/character/face_camera.size -= delta
|
||||
if zoom_direction == "front":
|
||||
$viewport/character/face_camera.size += delta
|
||||
elif zoom_direction == "back":
|
||||
$viewport/character/face_camera.size -= delta
|
||||
|
||||
func _on_turn_left_button_down():
|
||||
turn_direction = "left"
|
||||
turn_direction = "left"
|
||||
func _on_turn_left_button_up():
|
||||
turn_direction = null
|
||||
turn_direction = null
|
||||
|
||||
func _on_turn_right_button_down():
|
||||
turn_direction = "right"
|
||||
turn_direction = "right"
|
||||
func _on_turn_right_button_up():
|
||||
turn_direction = null
|
||||
turn_direction = null
|
||||
|
||||
func _on_zoom_out_button_down():
|
||||
zoom_direction = "front"
|
||||
zoom_direction = "front"
|
||||
func _on_zoom_out_button_up():
|
||||
zoom_direction = null
|
||||
zoom_direction = null
|
||||
|
||||
func _on_zoom_in_button_down():
|
||||
zoom_direction = "back"
|
||||
zoom_direction = "back"
|
||||
func _on_zoom_in_button_up():
|
||||
zoom_direction = null
|
||||
zoom_direction = null
|
||||
|
||||
|
||||
func _on_lights_button_up():
|
||||
$viewport/character/face_lights.hide()
|
||||
$viewport/character/face_lights.hide()
|
||||
func _on_lights_button_down():
|
||||
$viewport/character/face_lights.show()
|
||||
$viewport/character/face_lights.show()
|
||||
|
||||
|
||||
func _on_lights_toggled(button_pressed):
|
||||
if button_pressed:
|
||||
$viewport/character/face_lights.show()
|
||||
else:
|
||||
$viewport/character/face_lights.hide()
|
||||
if button_pressed:
|
||||
$viewport/character/face_lights.show()
|
||||
else:
|
||||
$viewport/character/face_lights.hide()
|
||||
|
||||
func _on_character_preview_image_resized():
|
||||
$viewport.size = $margin_container/character_box/v_box_container/character_preview_image.rect_size
|
||||
$viewport.size = $margin_container/character_box/v_box_container/character_preview_image.rect_size
|
||||
|
|
|
@ -23,6 +23,9 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 1 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="viewport" type="Viewport" parent="."]
|
||||
size = Vector2( 1024, 1024 )
|
||||
|
@ -39,7 +42,6 @@ projection = 1
|
|||
size = 2.0
|
||||
|
||||
[node name="face_lights" type="Spatial" parent="viewport/character"]
|
||||
editor/display_folded = true
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.27005, 0 )
|
||||
|
||||
[node name="face_light_right" type="OmniLight" parent="viewport/character/face_lights"]
|
||||
|
@ -108,7 +110,6 @@ expand = true
|
|||
stretch_mode = 6
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="margin_container/character_box/v_box_container"]
|
||||
editor/display_folded = true
|
||||
margin_left = 227.0
|
||||
margin_top = 672.0
|
||||
margin_right = 403.0
|
||||
|
|
|
@ -3,4 +3,4 @@ extends MarginContainer
|
|||
signal return_button_pressed
|
||||
|
||||
func _on_return_button_pressed():
|
||||
emit_signal( "return_button_pressed" )
|
||||
emit_signal( "return_button_pressed" )
|
||||
|
|
|
@ -14,11 +14,13 @@ func _ready():
|
|||
$register_menu.hide()
|
||||
$license_menu.hide()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_login_menu_login_button_pressed():
|
||||
print("[login_scene] Launch game")
|
||||
$login_menu.hide()
|
||||
$character_selection_menu.show()
|
||||
$message_system.show()
|
||||
# $character_selection_menu.show()
|
||||
|
||||
func _on_character_selection_menu_return_button_pressed():
|
||||
$login_menu.show()
|
||||
|
@ -60,36 +62,42 @@ func _on_login_menu_register_button_pressed():
|
|||
$register_menu.show()
|
||||
$license_menu.hide()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_register_menu_cancel_button_pressed():
|
||||
$login_menu.show()
|
||||
$register_menu.hide()
|
||||
$license_menu.hide()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_register_menu_license_button_pressed():
|
||||
$login_menu.hide()
|
||||
$register_menu.hide()
|
||||
$license_menu.show()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_license_menu_return_button_pressed():
|
||||
$login_menu.hide()
|
||||
$register_menu.show()
|
||||
$license_menu.hide()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_register_menu_register_account_created():
|
||||
$login_menu.show()
|
||||
$register_menu.hide()
|
||||
$license_menu.hide()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_Settings_menu_return_pressed():
|
||||
$login_menu.show()
|
||||
$register_menu.hide()
|
||||
$license_menu.hide()
|
||||
$settings_menu.hide()
|
||||
$message_system.hide()
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
$login_menu.hide()
|
||||
|
@ -97,3 +105,4 @@ func _on_settings_button_pressed():
|
|||
$license_menu.hide()
|
||||
$settings_menu.load_settings()
|
||||
$settings_menu.show()
|
||||
$message_system.hide()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=13 format=2]
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://login_scene/login_scene.gd" type="Script" id=1]
|
||||
[ext_resource path="res://login_scene/character_selection_menu.tscn" type="PackedScene" id=2]
|
||||
|
@ -12,6 +12,7 @@
|
|||
[ext_resource path="res://assets/GUI/images/Login-Khanat-help-button.png" type="Texture" id=10]
|
||||
[ext_resource path="res://assets/GUI/images/Login-Khanat-settings-button.png" type="Texture" id=11]
|
||||
[ext_resource path="res://assets/GUI/images/Login-Khanat-quit-button.png" type="Texture" id=12]
|
||||
[ext_resource path="res://login_scene/message_system.tscn" type="PackedScene" id=13]
|
||||
|
||||
[node name="login_scene" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
@ -29,6 +30,9 @@ visible = false
|
|||
[node name="license_menu" parent="." instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[node name="message_system" parent="." instance=ExtResource( 13 )]
|
||||
visible = false
|
||||
|
||||
[node name="settings_menu" parent="." instance=ExtResource( 6 )]
|
||||
visible = false
|
||||
|
||||
|
@ -44,6 +48,9 @@ anchor_right = 1.0
|
|||
margin_bottom = 61.0
|
||||
rect_min_size = Vector2( 0, 61 )
|
||||
alignment = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="sound_button" type="TextureButton" parent="buttons"]
|
||||
margin_left = 1052.0
|
||||
|
@ -72,6 +79,7 @@ margin_bottom = 61.0
|
|||
texture_normal = ExtResource( 12 )
|
||||
[connection signal="character_selected" from="character_selection_menu" to="." method="_on_character_selection_menu_character_selected"]
|
||||
[connection signal="return_button_pressed" from="character_selection_menu" to="." method="_on_character_selection_menu_return_button_pressed"]
|
||||
[connection signal="login_button_pressed" from="login_menu" to="." method="_on_login_menu_login_button_pressed"]
|
||||
[connection signal="cancel_button_pressed" from="register_menu" to="." method="_on_register_menu_cancel_button_pressed"]
|
||||
[connection signal="license_button_pressed" from="register_menu" to="." method="_on_register_menu_license_button_pressed"]
|
||||
[connection signal="register_account_created" from="register_menu" to="." method="_on_register_menu_register_account_created"]
|
||||
|
|
31
login_scene/message_system.gd
Normal file
31
login_scene/message_system.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
extends Control
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
var _networkconnection = NetworkConnection.new()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
_networkconnection.process(delta)
|
||||
var data = _networkconnection.get_server_messages()
|
||||
##print("******* data:", data.size(), data)
|
||||
if data.size() > 0:
|
||||
# just to see last message (normally cleanned each time we read message)
|
||||
while data.size() > 10:
|
||||
var ele = data.pop_front()
|
||||
print("*** remove:" , ele)
|
||||
var message = "tick :" + String(_networkconnection.get_server_tick()) + '\n'
|
||||
for i in range(0, data.size()):
|
||||
message += String(data[i]) + '\n'
|
||||
$label.text = message
|
||||
|
||||
func _show():
|
||||
pass
|
29
login_scene/message_system.tscn
Normal file
29
login_scene/message_system.tscn
Normal file
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://assets/GUI/themes/login_theme.theme" type="Theme" id=1]
|
||||
[ext_resource path="res://assets/GUI/images/settings-Khanat-background.png" type="Texture" id=2]
|
||||
[ext_resource path="res://login_scene/message_system.gd" type="Script" id=3]
|
||||
|
||||
[node name="message_system" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="texture_rect" type="TextureRect" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="label" type="Label" parent="."]
|
||||
margin_left = 301.0
|
||||
margin_top = 171.0
|
||||
margin_right = 1015.0
|
||||
margin_bottom = 605.0
|
||||
theme = ExtResource( 1 )
|
||||
text = "Server connecter"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
24
login_scene/wait_connexion.tscn
Normal file
24
login_scene/wait_connexion.tscn
Normal file
|
@ -0,0 +1,24 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/GUI/themes/login_theme.theme" type="Theme" id=1]
|
||||
[ext_resource path="res://assets/GUI/images/register-Khanat-background.png" type="Texture" id=2]
|
||||
|
||||
[node name="wait_connexion" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="texture_rect" type="TextureRect" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="label" type="Label" parent="."]
|
||||
margin_left = 519.333
|
||||
margin_top = 325.351
|
||||
margin_right = 696.333
|
||||
margin_bottom = 342.351
|
||||
theme = ExtResource( 1 )
|
||||
text = "Wait connexion to server"
|
|
@ -32,6 +32,7 @@ void NetworkConnection::_bind_methods()
|
|||
ClassDB::bind_method(D_METHOD("get_state"), &NetworkConnection::get_state);
|
||||
ClassDB::bind_method(D_METHOD("connect_to_server"), &NetworkConnection::connect_to_server);
|
||||
ClassDB::bind_method(D_METHOD("get_server_messages"), &NetworkConnection::get_server_messages);
|
||||
ClassDB::bind_method(D_METHOD("get_server_tick"), &NetworkConnection::get_server_tick);
|
||||
ClassDB::bind_method(D_METHOD("terminate_network_connection"), &NetworkConnection::terminate_network_connection);
|
||||
//ClassDB::bind_method(D_METHOD("get_master_message_description_node"), &NetworkConnection::get_master_message_description_node);
|
||||
}
|
||||
|
@ -96,6 +97,11 @@ Variant NetworkConnection::get_server_messages()
|
|||
return NetworkConnectionCore::get_singleton()->get_server_messages();
|
||||
}
|
||||
|
||||
Variant NetworkConnection::get_server_tick()
|
||||
{
|
||||
return NetworkConnectionCore::get_singleton()->get_server_tick();
|
||||
}
|
||||
|
||||
void NetworkConnection::terminate_network_connection()
|
||||
{
|
||||
NetworkConnectionCore::terminate_connexion();
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
int get_state();
|
||||
|
||||
Variant get_server_messages();
|
||||
Variant get_server_tick();
|
||||
|
||||
void terminate_network_connection();
|
||||
|
||||
|
|
|
@ -205,6 +205,11 @@ Variant NetworkConnectionCore::get_server_messages()
|
|||
return _network_data._server_messages;
|
||||
}
|
||||
|
||||
Variant NetworkConnectionCore::get_server_tick()
|
||||
{
|
||||
return _network_data._current_received_number;
|
||||
}
|
||||
|
||||
bool NetworkConnectionCore::is_active()
|
||||
{
|
||||
DBG_PRINT("is_active ..");
|
||||
|
|
|
@ -92,6 +92,7 @@ public:
|
|||
bool connected();
|
||||
|
||||
Variant get_server_messages();
|
||||
Variant get_server_tick();
|
||||
|
||||
static bool is_active();
|
||||
static void terminate_connexion();
|
||||
|
|
|
@ -25,7 +25,7 @@ config/icon="res://icon.png"
|
|||
global="*res://global.tscn"
|
||||
character="*res://game_scene/Game/Character/Character.tscn"
|
||||
net_low_level="*res://assets/Scripts/Network/net_low_level.gd"
|
||||
msg="*res://assets/Scripts/Definition/msg.gd"
|
||||
msg="res://assets/Scripts/Definition/msg.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
|
|
Loading…
Reference in a new issue