adding loader msg.xml and correct message when login/register error are detected
This commit is contained in:
parent
d8ccda03c0
commit
be7dbb08b6
16 changed files with 361 additions and 1341 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -15,3 +15,9 @@ export_presets.cfg
|
|||
# Ignore binary & package
|
||||
*.bin
|
||||
*.pck
|
||||
|
||||
# Ignore lib gdnaive
|
||||
libgdnative.*.so
|
||||
|
||||
# Ignore temp
|
||||
temp/
|
||||
|
|
|
@ -32,16 +32,16 @@ func add_child_to_content( node):
|
|||
# else:
|
||||
# .add_child( node )
|
||||
# prints(self.get_name()+" just fathered", node.get_name())
|
||||
|
||||
|
||||
func add_window_part( node ):
|
||||
add_child( node )
|
||||
|
||||
|
||||
func set_mouse_pass_to_children( node ):
|
||||
for child in node.get_children():
|
||||
set_mouse_pass_to_children( child )
|
||||
if node is Control:
|
||||
node.mouse_filter = MOUSE_FILTER_PASS
|
||||
|
||||
|
||||
#func _ready():
|
||||
func _enter_tree():
|
||||
########
|
||||
|
@ -49,7 +49,7 @@ func _enter_tree():
|
|||
# The interal elements structure is:
|
||||
# self - MarginContainer
|
||||
# background - NinePatchRect
|
||||
# parts - VBoxContainer
|
||||
# parts - VBoxContainer
|
||||
# header_box - MarginContainer
|
||||
# header - HBoxContainer
|
||||
# quit - TextureButton
|
||||
|
@ -68,13 +68,13 @@ func _enter_tree():
|
|||
# self
|
||||
self.size_flags_horizontal = SIZE_EXPAND
|
||||
self.size_flags_vertical = SIZE_EXPAND
|
||||
|
||||
|
||||
self.set( "custom_constants/margin_right", 0)
|
||||
self.set( "custom_constants/margin_top", 0)
|
||||
self.set( "custom_constants/margin_left", 0)
|
||||
self.set( "custom_constants/margin_bottom", 0)
|
||||
|
||||
|
||||
|
||||
|
||||
self.connect ( "gui_input", self, "_on_window_gui_input" )
|
||||
###
|
||||
###
|
||||
|
@ -85,30 +85,34 @@ func _enter_tree():
|
|||
background.name = "background"
|
||||
if not background_texture:
|
||||
var background_image = Image.new()
|
||||
if not background_image.load( "res://addons/ui_window/background_default.jpg" ) == OK :
|
||||
var stream_texture = load('res://addons/ui_window/background_default.jpg')
|
||||
if not stream_texture :
|
||||
print("Erreur lors du chargement de l'image: "+str("res://addons/ui_window/background_default.jpg") )
|
||||
else:
|
||||
background_image = stream_texture.get_data()
|
||||
background.texture = ImageTexture.new()
|
||||
background.texture.create_from_image( background_image )
|
||||
else:
|
||||
background.texture = background_texture
|
||||
|
||||
|
||||
background.texture.flags = Texture.FLAG_FILTER | Texture.FLAG_REPEAT
|
||||
background.axis_stretch_horizontal = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||
background.axis_stretch_vertical = NinePatchRect.AXIS_STRETCH_MODE_TILE
|
||||
|
||||
|
||||
background.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
background.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
|
||||
|
||||
background.region_rect = Rect2( 0, 0, 0, 0 )
|
||||
background.patch_margin_left = 4
|
||||
background.patch_margin_top = 32
|
||||
background.patch_margin_right = 4
|
||||
background.patch_margin_bottom = 4
|
||||
|
||||
|
||||
background.self_modulate = background_color
|
||||
|
||||
|
||||
self.add_window_part( background )
|
||||
# background.set_owner( self )
|
||||
print("[ui_window:3]")
|
||||
# background.set_owner( self )
|
||||
###
|
||||
###
|
||||
# parts
|
||||
|
@ -119,7 +123,7 @@ func _enter_tree():
|
|||
parts.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
parts.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
self.add_window_part( parts )
|
||||
# parts.set_owner( self )
|
||||
# parts.set_owner( self )
|
||||
###
|
||||
###
|
||||
# header_box
|
||||
|
@ -129,18 +133,18 @@ func _enter_tree():
|
|||
header_box.name = "header_box"
|
||||
header_box.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
header_box.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
|
||||
header_box.set( "custom_constants/margin_right", 4)
|
||||
header_box.set( "custom_constants/margin_top", 4)
|
||||
header_box.set( "custom_constants/margin_left", 4)
|
||||
header_box.set( "custom_constants/margin_bottom", 4)
|
||||
|
||||
|
||||
if is_movable:
|
||||
header_box.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
parts.add_child( header_box )
|
||||
# header_box.set_owner( parts )
|
||||
# header_box.set_owner( parts )
|
||||
header_box.connect ( "gui_input", self, "_on_Header_gui_input" )
|
||||
###
|
||||
###
|
||||
###
|
||||
# header
|
||||
var header
|
||||
|
@ -152,7 +156,7 @@ func _enter_tree():
|
|||
if is_movable:
|
||||
header.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
header_box.add_child( header )
|
||||
# header.set_owner( header_box )
|
||||
# header.set_owner( header_box )
|
||||
###
|
||||
###
|
||||
# quit
|
||||
|
@ -162,15 +166,16 @@ func _enter_tree():
|
|||
quit_button.name = "quit"
|
||||
quit_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
quit_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
|
||||
var tex_quit = ImageTexture.new()
|
||||
var img_quit = Image.new()
|
||||
img_quit.load( "res://assets/GUI/images/button_quit.png" )
|
||||
var stream_texture = load( "res://assets/GUI/images/button_quit.png")
|
||||
img_quit = stream_texture.get_data()
|
||||
tex_quit.create_from_image( img_quit )
|
||||
quit_button.texture_normal = tex_quit
|
||||
|
||||
|
||||
header.add_child( quit_button )
|
||||
# quit_button.set_owner( header )
|
||||
# quit_button.set_owner( header )
|
||||
quit_button.connect ( "pressed", self, "_on_Quit_pressed" )
|
||||
###
|
||||
# close
|
||||
|
@ -180,15 +185,16 @@ func _enter_tree():
|
|||
close_button.name = "close"
|
||||
close_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
close_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
|
||||
var tex_close = ImageTexture.new()
|
||||
var img_close = Image.new()
|
||||
img_close.load( "res://assets/GUI/images/button_close.png" )
|
||||
var stream_texture = load("res://assets/GUI/images/button_close.png")
|
||||
img_close = stream_texture.get_data()
|
||||
tex_close.create_from_image( img_close )
|
||||
close_button.texture_normal = tex_close
|
||||
|
||||
|
||||
header.add_child( close_button )
|
||||
# close_button.set_owner( header )
|
||||
# close_button.set_owner( header )
|
||||
close_button.connect ( "pressed", self, "_on_Close_pressed" )
|
||||
###
|
||||
# open
|
||||
|
@ -198,15 +204,16 @@ func _enter_tree():
|
|||
open_button.name = "open"
|
||||
open_button.size_flags_horizontal = SIZE_SHRINK_END
|
||||
open_button.size_flags_vertical = SIZE_SHRINK_CENTER
|
||||
|
||||
|
||||
var tex_open = ImageTexture.new()
|
||||
var img_open = Image.new()
|
||||
img_open.load( "res://assets/GUI/images/button_open.png" )
|
||||
var stream_texture = load("res://assets/GUI/images/button_open.png")
|
||||
img_open = stream_texture.get_data()
|
||||
tex_open.create_from_image( img_open )
|
||||
open_button.texture_normal = tex_open
|
||||
open_button.visible = false
|
||||
header.add_child( open_button )
|
||||
# open_button.set_owner( header )
|
||||
# open_button.set_owner( header )
|
||||
open_button.connect ( "pressed", self, "_on_Open_pressed" )
|
||||
###
|
||||
###
|
||||
|
@ -221,7 +228,7 @@ func _enter_tree():
|
|||
if is_movable:
|
||||
title_label.mouse_default_cursor_shape = CURSOR_MOVE
|
||||
header.add_child( title_label )
|
||||
# title_label.set_owner( header )
|
||||
# title_label.set_owner( header )
|
||||
###
|
||||
###
|
||||
# Content
|
||||
|
@ -236,8 +243,8 @@ func _enter_tree():
|
|||
content_box.set( "custom_constants/margin_left", 8)
|
||||
content_box.set( "custom_constants/margin_bottom", 8)
|
||||
parts.add_child( content_box )
|
||||
# content_box.set_owner( parts )
|
||||
###
|
||||
# content_box.set_owner( parts )
|
||||
###
|
||||
###
|
||||
# content_box/scroll_container
|
||||
var content_scroll_container
|
||||
|
@ -248,7 +255,7 @@ func _enter_tree():
|
|||
content_scroll_container.size_flags_vertical = SIZE_FILL
|
||||
content_scroll_container.scroll_deadzone = 0
|
||||
content_box.add_child( content_scroll_container )
|
||||
# content_scroll_container.set_owner( content_box )
|
||||
# content_scroll_container.set_owner( content_box )
|
||||
###
|
||||
###
|
||||
# content
|
||||
|
@ -259,10 +266,10 @@ func _enter_tree():
|
|||
content.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
content.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
content_scroll_container.add_child( content )
|
||||
# content.set_owner( content_scroll_container )
|
||||
###
|
||||
|
||||
|
||||
# content.set_owner( content_scroll_container )
|
||||
###
|
||||
|
||||
|
||||
###
|
||||
# Footer
|
||||
var footer_box
|
||||
|
@ -276,8 +283,8 @@ func _enter_tree():
|
|||
footer_box.set( "custom_constants/margin_left", content_margin.position.x)
|
||||
footer_box.set( "custom_constants/margin_bottom", content_margin.size.y)
|
||||
parts.add_child( footer_box )
|
||||
# footer_box.set_owner( parts )
|
||||
###
|
||||
# footer_box.set_owner( parts )
|
||||
###
|
||||
###
|
||||
# footer_box/footer
|
||||
var footer
|
||||
|
@ -287,7 +294,7 @@ func _enter_tree():
|
|||
footer.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
footer.size_flags_vertical = SIZE_EXPAND_FILL
|
||||
footer_box.add_child( footer )
|
||||
# footer.set_owner( footer_box )
|
||||
# footer.set_owner( footer_box )
|
||||
###
|
||||
###
|
||||
# footer_label
|
||||
|
@ -308,27 +315,28 @@ func _enter_tree():
|
|||
resize_button.name = "resize"
|
||||
resize_button.size_flags_horizontal = SIZE_FILL | SIZE_SHRINK_END
|
||||
resize_button.size_flags_vertical = SIZE_SHRINK_END
|
||||
|
||||
|
||||
var tex_resize = ImageTexture.new()
|
||||
var img_resize = Image.new()
|
||||
img_resize.load( "res://assets/GUI/images/button_resize.png" )
|
||||
var stream_texture = load("res://assets/GUI/images/button_resize.png")
|
||||
img_resize = stream_texture.get_data()
|
||||
tex_resize.create_from_image( img_resize )
|
||||
resize_button.texture_normal = tex_resize
|
||||
resize_button.mouse_default_cursor_shape = CURSOR_FDIAGSIZE
|
||||
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
|
||||
resize_button.action_mode = Button.ACTION_MODE_BUTTON_PRESS
|
||||
footer.add_child( resize_button )
|
||||
# resize_button.set_owner( footer )
|
||||
# resize_button.set_owner( footer )
|
||||
resize_button.connect ( "pressed", self, "_on_Resize_pressed" )
|
||||
###er_label.set_owner( footer )
|
||||
###er_label.set_owner( footer )
|
||||
###
|
||||
|
||||
|
||||
current_rect_size = self.rect_min_size
|
||||
|
||||
|
||||
if is_borderless:
|
||||
$background.region_rect = Rect2( $background.patch_margin_left-1
|
||||
, $background.patch_margin_top-1
|
||||
, 256-($background.patch_margin_left+$background.patch_margin_right)+2
|
||||
, 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 )
|
||||
, 256-($background.patch_margin_top+$background.patch_margin_bottom)+2 )
|
||||
$background.patch_margin_left = 1
|
||||
$background.patch_margin_top = 1
|
||||
$background.patch_margin_right = 1
|
||||
|
@ -338,10 +346,10 @@ func _enter_tree():
|
|||
open_button.visible = false
|
||||
quit_button.visible = false
|
||||
title_label.visible = false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if not is_resizable:
|
||||
if not has_footer:
|
||||
footer_box.visible = false
|
||||
|
@ -355,21 +363,21 @@ func _ready():
|
|||
if child.name.begins_with( "footer_" ):
|
||||
if footer_box.get_node("footer").has_node("footer_label"):
|
||||
footer_box.get_node("footer").remove_child( footer_box.get_node("footer").get_node("footer_label") )
|
||||
|
||||
|
||||
self.remove_child( child )
|
||||
get_footer().add_child( child )
|
||||
get_footer().move_child( child, 0 )
|
||||
else:
|
||||
self.remove_child( child )
|
||||
get_content().add_child( child )
|
||||
|
||||
|
||||
set_mouse_pass_to_children( self )
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if size_changed:
|
||||
self.rect_size = Vector2( clamp( self.rect_size.x, min_size.x, self.rect_size.x ), clamp( self.rect_size.y, min_size.y, self.rect_size.y ) )
|
||||
size_changed = false
|
||||
|
||||
|
||||
func _on_Window_mouse_entered():
|
||||
print("mouse_entered")
|
||||
|
||||
|
@ -403,8 +411,8 @@ func close():
|
|||
footer_box.visible = false
|
||||
current_rect_size = self.rect_size
|
||||
self.rect_size = Vector2( 0, 0 )
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_Close_pressed():
|
||||
close()
|
||||
|
||||
|
@ -421,7 +429,7 @@ func open():
|
|||
content_box.visible = true
|
||||
footer_box.visible = true
|
||||
self.rect_size = current_rect_size
|
||||
|
||||
|
||||
func _on_Open_pressed():
|
||||
open()
|
||||
|
||||
|
@ -429,34 +437,34 @@ func _on_Resize_pressed():
|
|||
is_resizing = true
|
||||
|
||||
func _input( event ):
|
||||
if is_resizable:
|
||||
if is_resizable:
|
||||
if is_resizing and event is InputEventMouseButton and not event.pressed:
|
||||
is_resizing = false
|
||||
if event is InputEventMouseMotion and is_resizing:
|
||||
var delta = event.relative
|
||||
self.rect_size += delta
|
||||
size_changed = true
|
||||
|
||||
|
||||
func check_if_clicked( event ):
|
||||
if not is_moving and event is InputEventMouseButton and event.is_pressed() and not event.is_echo() and event.button_index == 1 :
|
||||
emit_signal( "window_clicked", self )
|
||||
|
||||
|
||||
func _on_Header_gui_input( event ):
|
||||
|
||||
|
||||
check_if_clicked( event )
|
||||
|
||||
if is_movable:
|
||||
|
||||
if is_movable:
|
||||
if is_moving and event is InputEventMouseButton and not event.pressed:
|
||||
is_moving = false
|
||||
is_moving = false
|
||||
elif not is_moving and event is InputEventMouseButton and event.pressed:
|
||||
is_moving = true
|
||||
is_moving = true
|
||||
if event is InputEventMouseMotion and is_moving:
|
||||
var delta = event.relative
|
||||
self.rect_position += delta
|
||||
|
||||
func _on_window_gui_input( event ):
|
||||
check_if_clicked( event )
|
||||
|
||||
|
||||
func load_from_file( config_file ):
|
||||
if config_file.has_section( self.name ):
|
||||
self.rect_position = config_file.get_value( self.name, "position" )
|
||||
|
@ -471,20 +479,19 @@ func load_from_file( config_file ):
|
|||
|
||||
|
||||
func save_to_file( config_file ):
|
||||
|
||||
|
||||
var is_open = content_box.visible
|
||||
|
||||
config_file.set_value(self.name, "position", self.rect_position)
|
||||
|
||||
|
||||
if not is_open:
|
||||
config_file.set_value(self.name, "size", current_rect_size)
|
||||
else:
|
||||
config_file.set_value(self.name, "size", self.rect_size)
|
||||
|
||||
|
||||
if is_open:
|
||||
config_file.set_value(self.name, "opened", true)
|
||||
else:
|
||||
config_file.set_value(self.name, "opened", false)
|
||||
|
||||
|
||||
config_file.set_value(self.name, "borderless", is_borderless)
|
||||
|
|
@ -6,6 +6,7 @@ extends Node
|
|||
|
||||
var _msg_xml = XMLParser.new()
|
||||
var _msg_md5sum
|
||||
var _msg_data = {}
|
||||
|
||||
func open_message_xml():
|
||||
var file = File.new()
|
||||
|
@ -31,28 +32,40 @@ func read_all_node():
|
|||
#while i < _msg_xml.get_attribute_count():
|
||||
# print(" -- Attribut Name:" + _msg_xml.get_attribute_name(i) + " Value:" + _msg_xml.get_attribute_value(i))
|
||||
# i += 1
|
||||
if _msg_xml.get_node_type() != XMLParser.NODE_ELEMENT:
|
||||
ret = _msg_xml.read()
|
||||
continue
|
||||
|
||||
match _msg_xml.get_node_name():
|
||||
"branch":
|
||||
i = 0
|
||||
while i < _msg_xml.get_attribute_count() and _msg_xml.get_attribute_name(i) != "name":
|
||||
i += 1
|
||||
if i < _msg_xml.get_attribute_count():
|
||||
print(_msg_xml.get_attribute_value(i))
|
||||
branch = _msg_xml.get_attribute_value(i)
|
||||
#print(branch + " " + str(_msg_xml.get_node_type()))
|
||||
_msg_data[branch] = []
|
||||
"leaf":
|
||||
i = 0
|
||||
while i < _msg_xml.get_attribute_count() and _msg_xml.get_attribute_name(i) != "name":
|
||||
i += 1
|
||||
if i < _msg_xml.get_attribute_count():
|
||||
print(branch + ":" + _msg_xml.get_attribute_value(i))
|
||||
|
||||
|
||||
leaf = _msg_xml.get_attribute_value(i)
|
||||
#print(branch + ":" + leaf + str(_msg_xml.get_node_type()))
|
||||
_msg_data[branch].append(leaf)
|
||||
ret = _msg_xml.read()
|
||||
print("Branch:" + str(_msg_data.size()))
|
||||
for key in _msg_data:
|
||||
print(" " + key + ":" + str(_msg_data[key].size()))
|
||||
for leaf in _msg_data[key]:
|
||||
print(" " + key + ":" + leaf)
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
open_message_xml()
|
||||
read_all_node()
|
||||
print("[msg] ready")
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
|
|
|
@ -29,7 +29,7 @@ class nel_register:
|
|||
self._confirmed = confirmed
|
||||
self._email = email
|
||||
self._tac = tac
|
||||
self._url_encoding = load("res://assets/Scripts/Tools/url_encoding.gd").url_encoding.new()
|
||||
self._url_encoding = preload("res://assets/Scripts/Tools/url_encoding.gd").url_encoding.new()
|
||||
|
||||
func get_request():
|
||||
return "/ams/index.php?page=register"
|
||||
|
|
|
@ -76,6 +76,9 @@ var _queue_message_system
|
|||
var _khaganat_host = "localhost"
|
||||
var _khaganat_port = "47851"
|
||||
|
||||
onready var BitStream = preload("res://bitstream.gdns")
|
||||
onready var BitSet = preload("res://bitset.gdns")
|
||||
|
||||
func _ready():
|
||||
_current_received_number = 0
|
||||
_last_received_number = 0
|
||||
|
@ -85,7 +88,7 @@ func _ready():
|
|||
_connection_state = TCONNECTIONSTATE.NOTINITIALISED
|
||||
_socketUDP = PacketPeerUDP.new()
|
||||
_queue_message_system = Array()
|
||||
_long_ack_bit_field = preload("res://bitset.gdns").new()
|
||||
_long_ack_bit_field = BitSet.new()
|
||||
_long_ack_bit_field.resize(512)
|
||||
_last_ack_in_long_ack = 0
|
||||
_latest_sync = 0
|
||||
|
@ -96,7 +99,7 @@ func _ready():
|
|||
_quit_id = 0
|
||||
|
||||
func send_system_login(user_addr, user_key, user_id, lang):
|
||||
var msgout = preload("res://bitstream.gdns").new()
|
||||
var msgout = BitStream.new()
|
||||
msgout.put_sint32(_current_received_number)
|
||||
msgout.put_bool(true)
|
||||
msgout.put_uint8(CLFECOMMON.SYSTEM_LOGIN_CODE)
|
||||
|
@ -113,7 +116,7 @@ func send_system_login(user_addr, user_key, user_id, lang):
|
|||
_connection_state = TCONNECTIONSTATE.CONNECTED
|
||||
|
||||
func send_system_sync():
|
||||
var msgout = preload("res://bitstream.gdns").new()
|
||||
var msgout = BitStream.new()
|
||||
msgout.put_sint32(_current_received_number)
|
||||
msgout.put_bool(true)
|
||||
msgout.put_uint8(CLFECOMMON.SYSTEM_ACK_SYNC_CODE)
|
||||
|
@ -124,7 +127,7 @@ func send_system_sync():
|
|||
_queue_message_system.append(msgout)
|
||||
|
||||
func send_system_ack_probe():
|
||||
var msgout = preload("res://bitstream.gdns").new()
|
||||
var msgout = BitStream.new()
|
||||
msgout.put_sint32(_current_received_number)
|
||||
msgout.put_bool(true)
|
||||
msgout.put_uint8(CLFECOMMON.SYSTEM_ACK_PROBE_CODE)
|
||||
|
@ -140,7 +143,7 @@ func send_system_ack_probe():
|
|||
|
||||
func send_system_quit():
|
||||
# TODO - check why we send quit_id
|
||||
var msgout = preload("res://bitstream.gdns").new()
|
||||
var msgout = BitStream.new()
|
||||
_quit_id += 1
|
||||
msgout.put_sint32(_current_received_number)
|
||||
msgout.put_bool(true)
|
||||
|
@ -154,7 +157,7 @@ func send_system_quit():
|
|||
return
|
||||
|
||||
func send_systemm_disconnect():
|
||||
var msgout = preload("res://bitstream.gdns").new()
|
||||
var msgout = BitStream.new()
|
||||
msgout.put_sint32(_current_received_number)
|
||||
msgout.put_bool(true)
|
||||
msgout.put_uint8(CLFECOMMON.SYSTEM_DISCONNECTION_CODE)
|
||||
|
@ -166,10 +169,11 @@ func send_systemm_disconnect():
|
|||
|
||||
func disconnect_server():
|
||||
print("[net_low_level:disconnect_server] Disconnect")
|
||||
if _socketUDP:
|
||||
if typeof(_socketUDP) != TYPE_NIL:
|
||||
send_systemm_disconnect()
|
||||
print("[net_low_level:disconnect_server] Send disconnect to server")
|
||||
_socketUDP.close()
|
||||
_socketUDP = null
|
||||
|
||||
func set_khaganat_server(host, port):
|
||||
_khaganat_host = host
|
||||
|
@ -179,6 +183,8 @@ func connect_to_server(user_addr, user_key, user_id):
|
|||
var connexion = load("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
var lang = connexion.get_language()
|
||||
print("[net_low_level:connect_to_server] prepare:" + str(_khaganat_host) + ":" + str(_khaganat_port))
|
||||
if typeof(_socketUDP) == TYPE_NIL:
|
||||
_socketUDP = PacketPeerUDP.new()
|
||||
_socketUDP.set_dest_address(_khaganat_host, _khaganat_port)
|
||||
send_system_login(user_addr, user_key, user_id, lang)
|
||||
|
||||
|
@ -189,7 +195,7 @@ func decode_system_message(msgin):
|
|||
CLFECOMMON.SYSTEM_LOGIN_CODE:
|
||||
pass
|
||||
CLFECOMMON.SYSTEM_SYNC_CODE:
|
||||
var hexa = load("res://assets/Scripts/Tools/hexa.gd").new()
|
||||
var hexa = preload("res://assets/Scripts/Tools/hexa.gd").new()
|
||||
var synchronize = msgin.get_uint32()
|
||||
var stime = msgin.get_sint64()
|
||||
_latest_sync = msgin.get_uint32()
|
||||
|
@ -229,11 +235,12 @@ func decode_normal_message(msgin):
|
|||
func analyze_message_received(msgbytes):
|
||||
# khanat-opennel-code/code/ryzom/server/src/frontend_service/fe_receive_sub.cpp:769 void CFeReceiveSub::handleReceivedMsg( CClientHost *clienthost )
|
||||
_update_time = OS.get_ticks_msec()
|
||||
var msgin = preload("res://bitstream.gdns").new()
|
||||
var msgin = BitStream.new()
|
||||
msgin.put_data(msgbytes)
|
||||
_current_received_number = msgin.get_sint32()
|
||||
var system_mode = msgin.get_bool()
|
||||
print("[net_low_level:analyze_message_received] Tick:" + str(_current_received_number) + ", Mode:" + str(system_mode) + ", Size:" + str(msgin.size()))
|
||||
if ProjectSettings.get_setting("khaganat/debug_mode"):
|
||||
print("[net_low_level:analyze_message_received] Tick:" + str(_current_received_number) + ", Mode:" + str(system_mode) + ", Size:" + str(msgin.size()))
|
||||
if system_mode:
|
||||
print("[net_low_level:analyze_message_received] System Mode")
|
||||
if _current_received_number > _last_received_number + 1:
|
||||
|
@ -277,6 +284,8 @@ func analyze_message_received(msgbytes):
|
|||
decode_normal_message(msgin)
|
||||
|
||||
func _process(delta):
|
||||
if typeof(_socketUDP) == TYPE_NIL:
|
||||
return
|
||||
var max_read = 10
|
||||
if _connection_state == TCONNECTIONSTATE.NOTINITIALISED:
|
||||
return
|
||||
|
@ -286,7 +295,8 @@ func _process(delta):
|
|||
return
|
||||
if _queue_message_system.size() > 0:
|
||||
var msgout = _queue_message_system.pop_front()
|
||||
print("[net_low_level:_process] Send data system (" + str(msgout.size()) + ", " + msgout.show() + ")" )
|
||||
if ProjectSettings.get_setting("khaganat/debug_mode"):
|
||||
print("[net_low_level:_process] Send data system (" + str(msgout.size()) + ", " + msgout.show() + ")" )
|
||||
_socketUDP.put_packet(msgout.get_data())
|
||||
|
||||
if _latest_probes.size() > 0:
|
||||
|
@ -298,4 +308,5 @@ func _process(delta):
|
|||
analyze_message_received(msgbytes)
|
||||
|
||||
func _exit_tree():
|
||||
print("[net_low_level] End")
|
||||
disconnect_server()
|
|
@ -27,7 +27,7 @@ custom_template/debug=""
|
|||
|
||||
name="khaganat.linux.32"
|
||||
platform="Linux/X11"
|
||||
runnable=true
|
||||
runnable=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
|
|
|
@ -15,7 +15,7 @@ func _ready():
|
|||
func _input( event ):
|
||||
if event.is_action_pressed( "ui_music_controls" ):
|
||||
$Windows/Music.visible = not $Windows/Music.visible
|
||||
|
||||
|
||||
|
||||
func _on_SaveHUD_pressed():
|
||||
var config_file = ConfigFile.new()
|
||||
|
|
|
@ -5,12 +5,12 @@ var current_song = ""
|
|||
var current_position = 0.0
|
||||
var popup
|
||||
|
||||
func _ready():
|
||||
for song in $Songs.get_children():
|
||||
func _ready():
|
||||
for song in $Songs.get_children():
|
||||
songs_list.append( song.name )
|
||||
if $Songs.get_child_count() > 0:
|
||||
current_song = songs_list[0]
|
||||
|
||||
|
||||
|
||||
popup = $SongsSelector.get_popup()
|
||||
for song in songs_list:
|
||||
|
@ -30,7 +30,7 @@ func set_pause():
|
|||
get_node( "Songs" ).get_node( current_song ).stop()
|
||||
else:
|
||||
current_position = 0.0
|
||||
|
||||
|
||||
$Buttons/Pause.text = "Play"
|
||||
$Title.text = "Musiques (Paused):"
|
||||
|
||||
|
@ -41,7 +41,7 @@ func set_stop():
|
|||
$Buttons/Pause.pressed = false
|
||||
$Buttons/Pause.text = "Play"
|
||||
$Title.text = "Musiques (Stopped):"
|
||||
|
||||
|
||||
func _on_Pause_toggled(button_pressed):
|
||||
if button_pressed:
|
||||
set_play()
|
||||
|
@ -56,7 +56,7 @@ func _on_SongsSelector_item_selected(ID):
|
|||
if not current_song == new_song:
|
||||
set_stop()
|
||||
current_song = popup.get_item_text(ID)
|
||||
|
||||
|
||||
func _on_song_finished():
|
||||
print("test")
|
||||
set_stop()
|
|
@ -64,7 +64,6 @@ custom_colors/font_color = Color( 0.494118, 0.411765, 0.658824, 1 )
|
|||
custom_colors/font_color_hover = Color( 0.863051, 0.203209, 1, 1 )
|
||||
custom_colors/font_color_pressed = Color( 0.673295, 0.508021, 1, 1 )
|
||||
text = "Stop"
|
||||
|
||||
[connection signal="item_selected" from="SongsSelector" to="." method="_on_SongsSelector_item_selected"]
|
||||
[connection signal="toggled" from="Buttons/Pause" to="." method="_on_Pause_toggled"]
|
||||
[connection signal="pressed" from="Buttons/Stop" to="." method="_on_Stop_pressed"]
|
||||
|
|
|
@ -11,8 +11,8 @@ func _on_login_button_pressed():
|
|||
|
||||
|
||||
func _on_play_button_pressed():
|
||||
var username = get_node("h_box_container/v_box_container/margin_container/login_box/email_box/email_edit").get_text();
|
||||
var password = get_node("h_box_container/v_box_container/margin_container/login_box/password_box/password_edit").get_text();
|
||||
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)
|
||||
|
||||
|
@ -24,11 +24,11 @@ func _on_play_without_connexion_pressed():
|
|||
|
||||
func do_request_salt(username, password):
|
||||
#var message = load("res://assets/Scripts/Models/nel_login_message.gd")
|
||||
var connexion = load("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
var connexion = preload("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
#if message:
|
||||
_username = username
|
||||
_password = password
|
||||
var message = load("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
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());
|
||||
|
@ -37,28 +37,41 @@ func do_request_salt(username, password):
|
|||
|
||||
|
||||
func _on_HTTPSalt_request_completed(result, response_code, headers, body):
|
||||
if response_code != 200 || ProjectSettings.get_setting("kaghanat/debug_mode"):
|
||||
emit_signal( "login_button_pressed" )
|
||||
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 = load("res://assets/Scripts/Models/nel_login_message.gd").nel_login_message.new("https-login", _username, _password, "Lirria", "2", "en")
|
||||
var connexion = load("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
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:
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible de se connecter"
|
||||
get_node("error_dialog").popup_centered()
|
||||
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 = load("res://assets/Scripts/Models/nel_login_message.gd")
|
||||
var connexion = load("res://assets/Scripts/Config/connexion.gd").connexion.new()
|
||||
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")
|
||||
|
@ -68,35 +81,46 @@ func do_request(username, password):
|
|||
|
||||
|
||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||
if response_code != 200 || ProjectSettings.get_setting("kaghanat/debug_mode"):
|
||||
emit_signal( "login_button_pressed" )
|
||||
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)")
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible to connect (bad return)"
|
||||
get_node("error_dialog").popup_centered()
|
||||
$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] + ")")
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible to connect (return :" + str(line1[0]) + ")"
|
||||
get_node("error_dialog").popup_centered()
|
||||
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()) + ")")
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible to connect (bad return 1st line, size:" + str(line1.size()) + ")"
|
||||
get_node("error_dialog").popup_centered()
|
||||
$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()) + ")")
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible to connect (bad return 2nd line, size:" + str(line2.size()) + ")"
|
||||
get_node("error_dialog").popup_centered()
|
||||
$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 = load("res://assets/Scripts/Models/nel_server_info.gd");
|
||||
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]
|
||||
|
@ -115,8 +139,8 @@ func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
|||
|
||||
var cookieSplit = cookie.split("|")
|
||||
if cookieSplit.size() != 3:
|
||||
get_node("error_dialog/v_box_container/label").text = "Impossible de se connecter (bad cookies size:" + str(cookieSplit.size()) + ")"
|
||||
get_node("error_dialog").popup_centered()
|
||||
$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]
|
||||
|
@ -129,6 +153,7 @@ func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
|||
|
||||
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)
|
||||
|
|
|
@ -215,7 +215,6 @@ margin_bottom = 33.0
|
|||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
text = "Ok"
|
||||
|
||||
[connection signal="request_completed" from="HTTPSalt" to="." method="_on_HTTPSalt_request_completed"]
|
||||
[connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]
|
||||
[connection signal="pressed" from="h_box_container/v_box_container/margin_container/login_box/email_box/email_label_box/register_button" to="." method="_on_register_button_pressed"]
|
||||
|
|
|
@ -53,12 +53,12 @@ func do_enable_register_button():
|
|||
|
||||
|
||||
func _on_play_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 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 enregister = get_node('h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2')
|
||||
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";
|
||||
|
@ -102,12 +102,12 @@ func do_request(username, password, confirmed, email, tac):
|
|||
func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
|
||||
var pos
|
||||
var search
|
||||
var enregister = get_node('h_box_container/v_box_container/center_container/register_box/h_box_container/register_button2')
|
||||
var comment_last = get_node('h_box_container/v_box_container/center_container/register_box/comment_last')
|
||||
var comment_username = get_node('h_box_container/v_box_container/center_container/register_box/login_box/comment')
|
||||
var comment_password = get_node('h_box_container/v_box_container/center_container/register_box/password_box/comment')
|
||||
var comment_confirm_password = get_node('h_box_container/v_box_container/center_container/register_box/password_confirm_box/comment')
|
||||
var comment_email = get_node('h_box_container/v_box_container/center_container/register_box/email_box/comment')
|
||||
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 = ""
|
||||
|
@ -135,7 +135,7 @@ func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
|
|||
get_node("wait_dialog").hide()
|
||||
|
||||
var text = str2var(body.get_string_from_utf8())
|
||||
regex.compile("(\\d+)")
|
||||
regex.compile("^(\\d+)[:]")
|
||||
var tab = text.split(":", true,2)
|
||||
if tab.size() > 1 :
|
||||
if regex.search(tab[0]):
|
||||
|
@ -145,6 +145,7 @@ func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
|
|||
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")
|
||||
|
|
|
@ -28,7 +28,6 @@ expand = true
|
|||
stretch_mode = 7
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
|
@ -342,7 +341,6 @@ margin_bottom = 114.0
|
|||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
text = "Ok"
|
||||
|
||||
[connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]
|
||||
[connection signal="text_changed" from="h_box_container/v_box_container/center_container/register_box/login_box/login_edit" to="." method="_on_login_edit_text_changed"]
|
||||
[connection signal="text_changed" from="h_box_container/v_box_container/center_container/register_box/password_box/password_edit" to="." method="_on_password_edit_text_changed"]
|
||||
|
|
|
@ -17,15 +17,15 @@ var zoom_direction = null
|
|||
|
||||
|
||||
func _ready():
|
||||
|
||||
|
||||
# $viewport/character/face_camera.make_current()
|
||||
|
||||
|
||||
|
||||
|
||||
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_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
|
||||
|
@ -37,25 +37,25 @@ func _ready():
|
|||
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 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 slot_box = HBoxContainer.new()
|
||||
slot_box.name = "slot_box_"+section
|
||||
slot_box.size_flags_horizontal = SIZE_FILL
|
||||
|
@ -63,29 +63,29 @@ func update_character_slots():
|
|||
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 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)] )
|
||||
|
||||
|
||||
|
||||
if self.character_box.has_node( "character_slots/creation_button" ):
|
||||
self.character_box.get_node( "character_slots/creation_button" ).free()
|
||||
|
||||
var index = 0
|
||||
|
||||
var index = 0
|
||||
while index in useds_slot:
|
||||
index += 1
|
||||
var next_slot = index
|
||||
|
@ -101,49 +101,49 @@ func _on_create_pressed( 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 )
|
||||
|
||||
|
||||
func _on_delete_pressed( slot, node_to_delete ):
|
||||
|
||||
|
||||
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 parent = node_to_delete.get_parent()
|
||||
parent.remove_child( node_to_delete )
|
||||
|
||||
|
||||
update_character_slots()
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_name_mouse_entered_pressed( slot ):
|
||||
$viewport/character.show()
|
||||
preview_slot = slot
|
||||
update_preview()
|
||||
|
||||
|
||||
func update_preview():
|
||||
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) ):
|
||||
|
||||
|
||||
self.character_preview.slot = slot
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
# Color
|
||||
var color = config_file.get_value( str(slot), "color", Color( 1, 0.25, 0.25, 1 ) )
|
||||
self.character_preview.color = color
|
||||
|
@ -151,21 +151,21 @@ func update_preview():
|
|||
# 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
|
||||
|
||||
|
||||
# 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()
|
||||
|
||||
|
||||
func _on_character_slots_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()
|
||||
|
@ -186,9 +186,9 @@ func _on_character_creation_box_creation_button_pressed():
|
|||
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" )
|
||||
|
||||
|
||||
self.character_box.get_node( "character_slots" ).show()
|
||||
self.character_box.get_node( "character_creation_box" ).hide()
|
||||
update_character_slots()
|
||||
|
@ -225,10 +225,10 @@ func _on_character_creation_box_ears_size_bar_changed( value ):
|
|||
|
||||
func _on_character_creation_box_eyes_color_changed(value):
|
||||
self.character_preview.eyes_color = value
|
||||
self.character_preview.update()
|
||||
|
||||
self.character_preview.update()
|
||||
|
||||
func _process( delta ):
|
||||
|
||||
|
||||
if turn_direction == "left":
|
||||
self.character_mesh.rotation.y -= delta
|
||||
elif turn_direction == "right":
|
||||
|
@ -238,7 +238,7 @@ func _process( delta ):
|
|||
$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"
|
||||
func _on_turn_left_button_up():
|
||||
|
@ -271,6 +271,6 @@ func _on_lights_toggled(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
|
||||
|
|
|
@ -10,7 +10,7 @@ func _ready():
|
|||
$Menus/TabContainer/Display/ScrollContainer/VBoxContainer/CurrentScreen/SpinBox.value = OS.current_screen
|
||||
|
||||
load_settings()
|
||||
|
||||
|
||||
|
||||
func _on_font_size_bar_value_changed(value):
|
||||
$Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( value )
|
||||
|
@ -27,17 +27,17 @@ func load_settings():
|
|||
config_file.save( "user://settings.cfg" )
|
||||
elif not err == OK:
|
||||
print("Error code when loading config file: ", err)
|
||||
|
||||
|
||||
global.font_size = config_file.get_value( "theme", "font_size" )
|
||||
if $Menus.get_theme():
|
||||
$Menus.get_theme().default_font.size = global.font_size
|
||||
$Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value = global.font_size
|
||||
$Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( global.font_size )
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_ReturnButton_pressed():
|
||||
|
||||
|
||||
var config_file = ConfigFile.new()
|
||||
var err = config_file.load( "user://settings.cfg" )
|
||||
if err:
|
||||
|
@ -53,7 +53,7 @@ func _on_ReturnButton_pressed():
|
|||
func _on_Title_text_changed(new_text):
|
||||
# ----------------------------------
|
||||
# Changing windows title
|
||||
var new_title = "Khanat"
|
||||
var new_title = "Khanat"
|
||||
new_text = new_text.strip_edges()
|
||||
if not new_text == "":
|
||||
new_title = new_text
|
||||
|
@ -65,7 +65,7 @@ func _on_Fullscreen_toggled(button_pressed):
|
|||
if ProjectSettings.has_setting( "display/window/size/fullscreen" ):
|
||||
ProjectSettings.set_setting("display/window/size/fullscreen", button_pressed)
|
||||
OS.window_fullscreen = ProjectSettings.get_setting("display/window/size/fullscreen")
|
||||
|
||||
|
||||
func _on_Borderless_toggled(button_pressed):
|
||||
if ProjectSettings.has_setting( "display/window/size/borderless" ):
|
||||
ProjectSettings.set_setting("display/window/size/borderless", button_pressed)
|
||||
|
@ -84,3 +84,7 @@ func _on_AlwaysOnTop_toggled(button_pressed):
|
|||
|
||||
func _on_SpinBox_value_changed(value):
|
||||
OS.current_screen = value
|
||||
|
||||
|
||||
func _on_FluteButton_pressed():
|
||||
pass # Replace with function body.
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue