nettoyage commentaire obsoletes et ajout d'un bouton deconnexion (WIP).

This commit is contained in:
osquallo 2018-08-08 15:48:37 +02:00
parent d7070c14e5
commit f6e00035e8
12 changed files with 90 additions and 76 deletions

View file

@ -1,20 +1,20 @@
extends Node
signal logout_button_pressed
const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title"
func _ready():
change_title()
get_tree().get_root().connect("size_changed", self, "on_window_size_changed")
global.character = get_node( "Game/Character" )
global.character_camera = get_node( "Game/Character/Camera_rotation_helper/Camera" )
global.character.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = global.character_color
$Game/Character.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = global.character_color
print( str(global.character_name) )
print( str(global.character_color) )
$GUI.pause()
global.character_camera.make_current()
self.connect( "logout_button_pressed", self.get_parent(), "_on_logout_button_pressed" )
func _process(delta):
pass
@ -29,3 +29,8 @@ func change_title():
title = title_node.text.strip_edges()
title += " (" + String(OS.get_window_size().x) + "x" + String(OS.get_window_size().y) + ")"
OS.set_window_title( title )
func _on_GUI_logout_button_pressed():
emit_signal( "logout_button_pressed" )
# global.goto_scene_loading( "res://login_scene/login_scene.tscn" )

View file

@ -16,4 +16,6 @@ _sections_unfolded = [ "Pause" ]
pause_mode = 2
_sections_unfolded = [ "Margin", "Mouse", "Pause", "Size Flags", "Theme", "custom_constants" ]
[connection signal="logout_button_pressed" from="GUI" to="." method="_on_GUI_logout_button_pressed"]

View file

@ -4,7 +4,11 @@ signal character_creation_finished
func _ready():
global.character_creation_camera = get_node( "character_creation_menu/v_box_container/h_box_container/center_container/character_creation_scene/camera" )
print("login_scene_ready")
$login_menu.show()
self.connect( "character_creation_finished", self.get_parent(), "_on_login_scene_character_creation_finished" )
func _on_login_menu_login_button_pressed():
$login_menu.hide()

View file

@ -1,6 +1,6 @@
extends MarginContainer
signal character_creation_finished
signal logout_button_pressed
func _on_Home_setting_pressed():
$Home.hide()
@ -89,25 +89,5 @@ func _on_login_menu_login_button_pressed():
$login_menu.hide()
$character_selection_menu.show()
func _on_character_creation_menu_valid_button_pressed():
$character_creation_menu.hide()
$HUD.show()
pause()
emit_signal( "character_creation_finished" )
func _on_character_selection_menu_character_selected(slot):
print( "selected character slot "+str( slot )+"." )
$character_selection_menu.hide()
$character_creation_menu.show()
func _on_character_creation_menu_return_button_pressed():
$character_creation_menu.hide()
$character_selection_menu.show()
func _on_character_selection_menu_return_button_pressed():
$login_menu.show()
$character_selection_menu.hide()
func _on_Home_logout_pressed():
emit_signal( "logout_button_pressed" )

View file

@ -52,7 +52,6 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1024.0
margin_bottom = 600.0
mouse_filter = 1
_sections_unfolded = [ "Mouse", "Size Flags", "Visibility", "custom_constants" ]
[node name="Settings" parent="." index="2" instance=ExtResource( 5 )]
@ -62,7 +61,6 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1024.0
margin_bottom = 600.0
mouse_filter = 1
_sections_unfolded = [ "Mouse", "Size Flags", "Theme", "custom_constants" ]
[node name="Help" parent="." index="3" instance=ExtResource( 6 )]
@ -72,6 +70,8 @@ margin_right = 256.0
margin_bottom = 256.0
_sections_unfolded = [ "Margin", "Mouse", "Size Flags", "custom_constants" ]
[connection signal="logout_pressed" from="Home" to="." method="_on_Home_logout_pressed"]
[connection signal="play_pressed" from="Home" to="." method="_on_Home_play_pressed"]
[connection signal="setting_pressed" from="Home" to="." method="_on_Home_setting_pressed"]

View file

@ -2,6 +2,7 @@ extends MarginContainer
signal play_pressed
signal setting_pressed
signal logout_pressed
func _on_PlayButton_pressed():
emit_signal("play_pressed" )
@ -12,4 +13,5 @@ func _on_SettingsButton_pressed():
func _on_QuitButton_pressed():
get_tree().quit()
func _on_LogoutButton_pressed():
emit_signal("logout_pressed" )

View file

@ -80,7 +80,7 @@ size_flags_horizontal = 1
size_flags_vertical = 1
theme = SubResource( 2 )
alignment = 0
_sections_unfolded = [ "Grow Direction", "Rect", "Theme", "custom_constants" ]
_sections_unfolded = [ "Grow Direction", "Mouse", "Rect", "Theme", "custom_constants" ]
[node name="Title" type="Label" parent="Menu" index="0"]
@ -89,7 +89,7 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1024.0
margin_bottom = 146.0
margin_bottom = 103.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
@ -116,9 +116,9 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 470.0
margin_top = 150.0
margin_top = 107.0
margin_right = 554.0
margin_bottom = 450.0
margin_bottom = 493.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -139,7 +139,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 42.0
margin_right = 84.0
margin_bottom = 258.0
margin_bottom = 344.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -200,7 +200,7 @@ flat = false
align = 1
_sections_unfolded = [ "Anchor", "Rect", "custom_fonts" ]
[node name="QuitButton" type="Button" parent="Menu/Buttons/VBoxContainer" index="2"]
[node name="LogoutButton" type="Button" parent="Menu/Buttons/VBoxContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
@ -220,9 +220,35 @@ toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Logout"
flat = false
align = 1
_sections_unfolded = [ "Focus", "Mouse" ]
[node name="QuitButton" type="Button" parent="Menu/Buttons/VBoxContainer" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 258.0
margin_right = 84.0
margin_bottom = 302.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Quit"
flat = false
align = 1
_sections_unfolded = [ "Mouse" ]
[node name="Container" type="MarginContainer" parent="Menu" index="2"]
@ -294,6 +320,8 @@ _sections_unfolded = [ "Size Flags", "custom_colors", "custom_constants", "custo
[connection signal="pressed" from="Menu/Buttons/VBoxContainer/SettingsButton" to="." method="_on_SettingsButton_pressed"]
[connection signal="pressed" from="Menu/Buttons/VBoxContainer/LogoutButton" to="." method="_on_LogoutButton_pressed"]
[connection signal="pressed" from="Menu/Buttons/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"]

View file

@ -4,7 +4,7 @@
[ext_resource path="res://assets/GUI/images/new_launcher_bg_0-1.png" type="Texture" id=2]
[ext_resource path="res://assets/GUI/images/new_char.png" type="Texture" id=3]
[node name="character_selection_menu" type="Control" index="0"]
[node name="character_selection_menu" type="Control"]
anchor_left = 0.0
anchor_top = 0.0

View file

@ -23,16 +23,10 @@ func set_info_billboard_position():
var above_head = $infos_spatial
player_infos_billboard.get_node("label").text = global.character_name
var offset = Vector2(-(player_infos_billboard.get_size().x/2), 0)
# var offset = Vector2( 0.0, 0.0 )
# player_infos_billboard.rect_position = (camera.unproject_position(above_head.get_translation()) - offset)
var unprojected_translation = camera.unproject_position(above_head.global_transform.xform(Vector3(0,0,0)))
# player_infos_billboard.rect_position = Vector2( unprojected_translation.x, unprojected_translation.y
player_infos_billboard.rect_position = (unprojected_translation + offset)
# player_infos_billboard.rect_position = Vector2( above_head.get_translation().x, above_head.get_translation().y )
func _ready():
# camera_rotation = $Camera_rotation_helper
# camera = $Camera_rotation_helper/Camera
camera.make_current()
set_info_billboard_position()

View file

@ -1,16 +1,14 @@
extends Node
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title"
func _ready():
change_title()
get_tree().get_root().connect("size_changed", self, "on_window_size_changed")
global.character_creation_camera.make_current()
global.goto_first_scene_loading( "res://login_scene/login_scene.tscn" )
# if global.character_creation_camera:
# global.character_creation_camera.make_current()
@ -44,3 +42,5 @@ func _on_login_scene_character_creation_finished():
print("test")
global.goto_scene_loading( "res://game_scene/game_scene.tscn" )
func _on_logout_button_pressed():
global.goto_scene_loading( "res://login_scene/login_scene.tscn" )

View file

@ -1,18 +1,15 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/Main.gd" type="Script" id=1]
[ext_resource path="res://login_scene/login_scene.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/GUI/loading_screens/new_loading_bg_0.tga" type="Texture" id=3]
[ext_resource path="res://assets/GUI/loading_screens/new_loading_bg_1.tga" type="Texture" id=4]
[ext_resource path="res://assets/GUI/loading_screens/new_loading_bg_0.tga" type="Texture" id=2]
[ext_resource path="res://assets/GUI/loading_screens/new_loading_bg_1.tga" type="Texture" id=3]
[node name="Main" type="Node"]
[node name="Main" type="Node" index="0"]
script = ExtResource( 1 )
_sections_unfolded = [ "Pause" ]
[node name="login_scene" parent="." index="0" instance=ExtResource( 2 )]
[node name="background_loader" type="Panel" parent="." index="1"]
[node name="background_loader" type="Panel" parent="." index="0"]
visible = false
self_modulate = Color( 0, 0, 0, 1 )
@ -63,14 +60,12 @@ page = 0.0
value = 0.0
exp_edit = false
rounded = false
texture_under = ExtResource( 3 )
texture_under = ExtResource( 2 )
texture_over = null
texture_progress = ExtResource( 4 )
texture_progress = ExtResource( 3 )
radial_fill_degrees = 360.0
radial_center_offset = Vector2( 0, 0 )
nine_patch_stretch = false
_sections_unfolded = [ "Textures" ]
[connection signal="character_creation_finished" from="login_scene" to="." method="_on_login_scene_character_creation_finished"]

View file

@ -1,10 +1,6 @@
extends Node
var current_scene = null
var character = null
var character_camera = null
var character_creation_mesh = null
var character_creation_camera = null
var character_name = null
var character_color = null
@ -21,24 +17,28 @@ func _ready():
var root = get_tree().get_root()
# current_scene = root.get_child(root.get_child_count() -1)
current_scene = root.get_node( "Main/login_scene" )
# character = get_tree().get_root().get_node( "Main/Game/Character" )
# character_camera = get_tree().get_root().get_node( "Main/Game/Character/Camera_rotation_helper/Camera" )
# character_creation_camera = get_tree().get_root().get_node( "Main/login_scene/character_creation_menu/v_box_container/h_box_container/center_container/character_creation_scene/camera" )
main_scene = root.get_node( "Main" )
func goto_first_scene_loading( path ):
get_tree().get_root().get_node("Main/background_loader").show()
loader = ResourceLoader.load_interactive( path )
if loader == null: # check for errors
# show_error()
return
set_process(true)
wait_frames = 1
func goto_scene_loading( path ):
get_tree().get_root().get_node("Main/background_loader").show()
loader = ResourceLoader.load_interactive( path )
if loader == null: # check for errors
show_error()
# show_error()
return
set_process(true)
current_scene.queue_free() # get rid of the old scene
# start your "loading..." animation
# get_node("animation").play("loading")
wait_frames = 1
func _process(time):
@ -53,13 +53,13 @@ func _process(time):
var t = OS.get_ticks_msec()
while OS.get_ticks_msec() < t + time_max: # use "time_max" to control how much time we block this thread
# poll your loader
var err = loader.poll()
update_progress()
if err == ERR_FILE_EOF: # load finished
# update_progress()
var resource = loader.get_resource()
loader = null
set_new_scene( resource )
@ -71,7 +71,6 @@ func _process(time):
show_error()
loader = null
break
func update_progress():
var progress_texture = get_tree().get_root().get_node("Main/background_loader/center_container/texture_progress")
var progress = (float(loader.get_stage()) / loader.get_stage_count()) * progress_texture.max_value
@ -83,10 +82,15 @@ func update_progress():
# call this on a paused animation. use "true" as the second parameter to force the animation to update
# get_node("animation").seek(progress * len, true)
func set_new_scene( scene_resource ):
func set_new_scene( scene_resource ):
var progress_texture = get_tree().get_root().get_node("Main/background_loader/center_container/texture_progress")
progress_texture.value = 0
get_tree().get_root().get_node("Main/background_loader").hide()
current_scene = scene_resource.instance()
main_scene.add_child(current_scene)
# get_tree().set_current_scene( current_scene )
func goto_scene( path ):
# This function will usually be called from a signal callback,