Merge branch 'bidouille_de_scoui' into 'master'
Bidouille de scoui See merge request godot_sandbox/Test-client-godot!3
This commit is contained in:
commit
b597f6d545
16 changed files with 230 additions and 232 deletions
|
@ -1,18 +1,9 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scenes/Main.gd" type="Script" id=1]
|
[ext_resource path="res://assets/GUI/loading_screens/new_loading_bg_0.tga" type="Texture" 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_1.tga" type="Texture" 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]
|
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[node name="background_loader" type="Panel"]
|
||||||
|
|
||||||
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"]
|
|
||||||
|
|
||||||
visible = false
|
visible = false
|
||||||
self_modulate = Color( 0, 0, 0, 1 )
|
self_modulate = Color( 0, 0, 0, 1 )
|
||||||
|
@ -28,7 +19,7 @@ size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
_sections_unfolded = [ "Mouse", "Visibility", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Visibility", "custom_constants" ]
|
||||||
|
|
||||||
[node name="center_container" type="MarginContainer" parent="background_loader" index="0"]
|
[node name="center_container" type="MarginContainer" parent="." index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
|
@ -36,12 +27,13 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 2
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
|
_sections_unfolded = [ "Mouse" ]
|
||||||
|
|
||||||
[node name="texture_progress" type="TextureProgress" parent="background_loader/center_container" index="0"]
|
[node name="texture_progress" type="TextureProgress" parent="center_container" index="0"]
|
||||||
|
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
|
@ -52,7 +44,7 @@ margin_right = 1032.0
|
||||||
margin_bottom = 600.0
|
margin_bottom = 600.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 1
|
mouse_filter = 2
|
||||||
mouse_default_cursor_shape = 0
|
mouse_default_cursor_shape = 0
|
||||||
size_flags_horizontal = 1
|
size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
|
@ -63,14 +55,12 @@ page = 0.0
|
||||||
value = 0.0
|
value = 0.0
|
||||||
exp_edit = false
|
exp_edit = false
|
||||||
rounded = false
|
rounded = false
|
||||||
texture_under = ExtResource( 3 )
|
texture_under = ExtResource( 1 )
|
||||||
texture_over = null
|
texture_over = null
|
||||||
texture_progress = ExtResource( 4 )
|
texture_progress = ExtResource( 2 )
|
||||||
radial_fill_degrees = 360.0
|
radial_fill_degrees = 360.0
|
||||||
radial_center_offset = Vector2( 0, 0 )
|
radial_center_offset = Vector2( 0, 0 )
|
||||||
nine_patch_stretch = false
|
nine_patch_stretch = false
|
||||||
_sections_unfolded = [ "Textures" ]
|
_sections_unfolded = [ "Mouse", "Textures" ]
|
||||||
|
|
||||||
[connection signal="character_creation_finished" from="login_scene" to="." method="_on_login_scene_character_creation_finished"]
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
signal logout_button_pressed
|
||||||
|
|
||||||
const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title"
|
const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title"
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
change_title()
|
change_title()
|
||||||
get_tree().get_root().connect("size_changed", self, "on_window_size_changed")
|
get_tree().get_root().connect("size_changed", self, "on_window_size_changed")
|
||||||
|
|
||||||
global.character = get_node( "Game/Character" )
|
$Game/Character.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = global.character_color
|
||||||
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
|
|
||||||
print( str(global.character_name) )
|
print( str(global.character_name) )
|
||||||
print( str(global.character_color) )
|
print( str(global.character_color) )
|
||||||
|
|
||||||
$GUI.pause()
|
$GUI.pause()
|
||||||
global.character_camera.make_current()
|
|
||||||
|
self.connect( "logout_button_pressed", global, "_on_logout_button_pressed" )
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -29,3 +29,8 @@ func change_title():
|
||||||
title = title_node.text.strip_edges()
|
title = title_node.text.strip_edges()
|
||||||
title += " (" + String(OS.get_window_size().x) + "x" + String(OS.get_window_size().y) + ")"
|
title += " (" + String(OS.get_window_size().x) + "x" + String(OS.get_window_size().y) + ")"
|
||||||
OS.set_window_title( title )
|
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" )
|
||||||
|
|
|
@ -16,4 +16,6 @@ _sections_unfolded = [ "Pause" ]
|
||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
_sections_unfolded = [ "Margin", "Mouse", "Pause", "Size Flags", "Theme", "custom_constants" ]
|
_sections_unfolded = [ "Margin", "Mouse", "Pause", "Size Flags", "Theme", "custom_constants" ]
|
||||||
|
|
||||||
|
[connection signal="logout_button_pressed" from="GUI" to="." method="_on_GUI_logout_button_pressed"]
|
||||||
|
|
||||||
|
|
||||||
|
|
128
global.gd
Normal file
128
global.gd
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title"
|
||||||
|
|
||||||
|
var character_name = null
|
||||||
|
var character_color = null
|
||||||
|
var character_sex = null
|
||||||
|
var character_slot = null
|
||||||
|
|
||||||
|
# BG loader
|
||||||
|
var loader
|
||||||
|
var wait_frames
|
||||||
|
var time_max = 10 # msec
|
||||||
|
var current_scene = null
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var root = get_tree().get_root()
|
||||||
|
current_scene = root.get_child(root.get_child_count() -1)
|
||||||
|
|
||||||
|
change_title()
|
||||||
|
get_tree().get_root().connect("size_changed", self, "on_window_size_changed")
|
||||||
|
|
||||||
|
########
|
||||||
|
#### change title ####
|
||||||
|
func on_window_size_changed():
|
||||||
|
change_title()
|
||||||
|
|
||||||
|
func change_title():
|
||||||
|
var title = "Khanat"
|
||||||
|
|
||||||
|
if has_node( WINDOW_TITLE_INPUT ):
|
||||||
|
var title_node = get_node( WINDOW_TITLE_INPUT )
|
||||||
|
if title_node and not title_node.text.strip_edges() == "":
|
||||||
|
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 )
|
||||||
|
########
|
||||||
|
|
||||||
|
########
|
||||||
|
#### scene loading
|
||||||
|
func goto_scene_loading( path ):
|
||||||
|
print( "goto: "+str(path) )
|
||||||
|
|
||||||
|
get_node("background_loader").show()
|
||||||
|
loader = ResourceLoader.load_interactive( path )
|
||||||
|
if loader == null: # check for errors
|
||||||
|
show_error()
|
||||||
|
return
|
||||||
|
|
||||||
|
set_process(true)
|
||||||
|
|
||||||
|
if current_scene:
|
||||||
|
print( "queue_free: "+str(current_scene.name) )
|
||||||
|
current_scene.queue_free() # get rid of the old scene
|
||||||
|
|
||||||
|
wait_frames = 1
|
||||||
|
|
||||||
|
func _process( time ):
|
||||||
|
print( "process" )
|
||||||
|
if loader == null:
|
||||||
|
# no need to process anymore
|
||||||
|
set_process(false)
|
||||||
|
return
|
||||||
|
|
||||||
|
if wait_frames > 0: # wait for frames to let the "loading" animation to show up
|
||||||
|
wait_frames -= 1
|
||||||
|
return
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
print( "poll: "+str((float(loader.get_stage()) / loader.get_stage_count())*100)+"%" )
|
||||||
|
|
||||||
|
# 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 )
|
||||||
|
break
|
||||||
|
elif err == OK:
|
||||||
|
update_progress()
|
||||||
|
pass
|
||||||
|
else: # error during loading
|
||||||
|
show_error()
|
||||||
|
loader = null
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
func update_progress():
|
||||||
|
var progress_texture = get_node("background_loader/center_container/texture_progress")
|
||||||
|
var progress = (float(loader.get_stage()) / loader.get_stage_count()) * progress_texture.max_value
|
||||||
|
|
||||||
|
progress_texture.value = progress
|
||||||
|
|
||||||
|
|
||||||
|
func set_new_scene( scene_resource ):
|
||||||
|
var progress_texture = get_node("background_loader/center_container/texture_progress")
|
||||||
|
|
||||||
|
progress_texture.value = 0
|
||||||
|
|
||||||
|
|
||||||
|
current_scene = scene_resource.instance()
|
||||||
|
get_tree().get_root().add_child(current_scene)
|
||||||
|
|
||||||
|
get_node("background_loader").hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_login_scene_character_creation_finished():
|
||||||
|
var config_file = ConfigFile.new()
|
||||||
|
var err = config_file.load( "user://player.cfg" )
|
||||||
|
if err:
|
||||||
|
print("Error code when loading config file: ", err)
|
||||||
|
|
||||||
|
config_file.set_value(str(global.character_slot), "name", global.character_name)
|
||||||
|
config_file.set_value(str(global.character_slot), "color", global.character_color)
|
||||||
|
|
||||||
|
config_file.save( "user://player.cfg" )
|
||||||
|
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" )
|
||||||
|
get_tree().paused = false
|
||||||
|
########
|
14
global.tscn
Normal file
14
global.tscn
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://global.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://background_loader_scene/background_loader.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
[node name="global" type="Node" index="0"]
|
||||||
|
|
||||||
|
pause_mode = 2
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
_sections_unfolded = [ "Pause" ]
|
||||||
|
|
||||||
|
[node name="background_loader" parent="." index="0" instance=ExtResource( 2 )]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@ signal character_creation_finished
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
global.character_creation_camera = get_node( "character_creation_menu/v_box_container/h_box_container/center_container/character_creation_scene/camera" )
|
$login_menu.show()
|
||||||
|
self.connect( "character_creation_finished", global, "_on_login_scene_character_creation_finished" )
|
||||||
|
|
||||||
|
|
||||||
func _on_login_menu_login_button_pressed():
|
func _on_login_menu_login_button_pressed():
|
||||||
$login_menu.hide()
|
$login_menu.hide()
|
||||||
|
|
|
@ -11,13 +11,13 @@ config_version=3
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Khanat"
|
config/name="Khanat"
|
||||||
run/main_scene="res://scenes/Main.tscn"
|
run/main_scene="res://login_scene/login_scene.tscn"
|
||||||
boot_splash/image="res://assets/GUI/images/new_launcher_bg_0-1.png"
|
boot_splash/image="res://assets/GUI/images/new_launcher_bg_0-1.png"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
global="*res://scenes/global.gd"
|
global="*res://global.tscn"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
extends MarginContainer
|
extends MarginContainer
|
||||||
|
|
||||||
signal character_creation_finished
|
signal logout_button_pressed
|
||||||
|
|
||||||
func _on_Home_setting_pressed():
|
func _on_Home_setting_pressed():
|
||||||
$Home.hide()
|
$Home.hide()
|
||||||
|
@ -89,25 +89,5 @@ func _on_login_menu_login_button_pressed():
|
||||||
$login_menu.hide()
|
$login_menu.hide()
|
||||||
$character_selection_menu.show()
|
$character_selection_menu.show()
|
||||||
|
|
||||||
|
func _on_Home_logout_pressed():
|
||||||
func _on_character_creation_menu_valid_button_pressed():
|
emit_signal( "logout_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()
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
margin_bottom = 600.0
|
margin_bottom = 600.0
|
||||||
mouse_filter = 1
|
|
||||||
_sections_unfolded = [ "Mouse", "Size Flags", "Visibility", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Size Flags", "Visibility", "custom_constants" ]
|
||||||
|
|
||||||
[node name="Settings" parent="." index="2" instance=ExtResource( 5 )]
|
[node name="Settings" parent="." index="2" instance=ExtResource( 5 )]
|
||||||
|
@ -62,7 +61,6 @@ anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
margin_bottom = 600.0
|
margin_bottom = 600.0
|
||||||
mouse_filter = 1
|
|
||||||
_sections_unfolded = [ "Mouse", "Size Flags", "Theme", "custom_constants" ]
|
_sections_unfolded = [ "Mouse", "Size Flags", "Theme", "custom_constants" ]
|
||||||
|
|
||||||
[node name="Help" parent="." index="3" instance=ExtResource( 6 )]
|
[node name="Help" parent="." index="3" instance=ExtResource( 6 )]
|
||||||
|
@ -72,6 +70,8 @@ margin_right = 256.0
|
||||||
margin_bottom = 256.0
|
margin_bottom = 256.0
|
||||||
_sections_unfolded = [ "Margin", "Mouse", "Size Flags", "custom_constants" ]
|
_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="play_pressed" from="Home" to="." method="_on_Home_play_pressed"]
|
||||||
|
|
||||||
[connection signal="setting_pressed" from="Home" to="." method="_on_Home_setting_pressed"]
|
[connection signal="setting_pressed" from="Home" to="." method="_on_Home_setting_pressed"]
|
||||||
|
|
|
@ -2,6 +2,7 @@ extends MarginContainer
|
||||||
|
|
||||||
signal play_pressed
|
signal play_pressed
|
||||||
signal setting_pressed
|
signal setting_pressed
|
||||||
|
signal logout_pressed
|
||||||
|
|
||||||
func _on_PlayButton_pressed():
|
func _on_PlayButton_pressed():
|
||||||
emit_signal("play_pressed" )
|
emit_signal("play_pressed" )
|
||||||
|
@ -12,4 +13,5 @@ func _on_SettingsButton_pressed():
|
||||||
func _on_QuitButton_pressed():
|
func _on_QuitButton_pressed():
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
|
func _on_LogoutButton_pressed():
|
||||||
|
emit_signal("logout_pressed" )
|
||||||
|
|
|
@ -80,7 +80,7 @@ size_flags_horizontal = 1
|
||||||
size_flags_vertical = 1
|
size_flags_vertical = 1
|
||||||
theme = SubResource( 2 )
|
theme = SubResource( 2 )
|
||||||
alignment = 0
|
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"]
|
[node name="Title" type="Label" parent="Menu" index="0"]
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
margin_bottom = 146.0
|
margin_bottom = 103.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
|
@ -116,9 +116,9 @@ anchor_top = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = 470.0
|
margin_left = 470.0
|
||||||
margin_top = 150.0
|
margin_top = 107.0
|
||||||
margin_right = 554.0
|
margin_right = 554.0
|
||||||
margin_bottom = 450.0
|
margin_bottom = 493.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 0
|
mouse_filter = 0
|
||||||
|
@ -139,7 +139,7 @@ anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_top = 42.0
|
margin_top = 42.0
|
||||||
margin_right = 84.0
|
margin_right = 84.0
|
||||||
margin_bottom = 258.0
|
margin_bottom = 344.0
|
||||||
rect_pivot_offset = Vector2( 0, 0 )
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
rect_clip_content = false
|
rect_clip_content = false
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
|
@ -200,7 +200,7 @@ flat = false
|
||||||
align = 1
|
align = 1
|
||||||
_sections_unfolded = [ "Anchor", "Rect", "custom_fonts" ]
|
_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_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
|
@ -220,9 +220,35 @@ toggle_mode = false
|
||||||
enabled_focus_mode = 2
|
enabled_focus_mode = 2
|
||||||
shortcut = null
|
shortcut = null
|
||||||
group = 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"
|
text = "Quit"
|
||||||
flat = false
|
flat = false
|
||||||
align = 1
|
align = 1
|
||||||
|
_sections_unfolded = [ "Mouse" ]
|
||||||
|
|
||||||
[node name="Container" type="MarginContainer" parent="Menu" index="2"]
|
[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/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"]
|
[connection signal="pressed" from="Menu/Buttons/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,12 @@ func _ready():
|
||||||
slot_box.add_child( choose_button )
|
slot_box.add_child( choose_button )
|
||||||
choose_button.set_owner( slot_box )
|
choose_button.set_owner( slot_box )
|
||||||
choose_button.connect( "pressed", self, "_on_choose_pressed", [int(section)] )
|
choose_button.connect( "pressed", self, "_on_choose_pressed", [int(section)] )
|
||||||
|
|
||||||
|
var delete_button = Button.new()
|
||||||
|
delete_button.text = "delete"
|
||||||
|
slot_box.add_child( delete_button )
|
||||||
|
delete_button.set_owner( slot_box )
|
||||||
|
delete_button.connect( "pressed", self, "_on_delete_pressed", [int(section), slot_box] )
|
||||||
|
|
||||||
|
|
||||||
var create_new_characer_button = Button.new()
|
var create_new_characer_button = Button.new()
|
||||||
|
@ -46,7 +52,16 @@ func _on_return_button_pressed():
|
||||||
|
|
||||||
func _on_choose_pressed( slot ):
|
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 parent = node_to_delete.get_parent()
|
||||||
|
parent.remove_child( node_to_delete )
|
||||||
|
|
||||||
func _on_slot0_character_button_pressed():
|
func _on_slot0_character_button_pressed():
|
||||||
emit_signal( "character_selected", 0 )
|
emit_signal( "character_selected", 0 )
|
||||||
|
|
|
@ -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_launcher_bg_0-1.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://assets/GUI/images/new_char.png" type="Texture" id=3]
|
[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_left = 0.0
|
||||||
anchor_top = 0.0
|
anchor_top = 0.0
|
||||||
|
|
|
@ -23,16 +23,10 @@ func set_info_billboard_position():
|
||||||
var above_head = $infos_spatial
|
var above_head = $infos_spatial
|
||||||
player_infos_billboard.get_node("label").text = global.character_name
|
player_infos_billboard.get_node("label").text = global.character_name
|
||||||
var offset = Vector2(-(player_infos_billboard.get_size().x/2), 0)
|
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)))
|
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 = (unprojected_translation + offset)
|
||||||
# player_infos_billboard.rect_position = Vector2( above_head.get_translation().x, above_head.get_translation().y )
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# camera_rotation = $Camera_rotation_helper
|
|
||||||
# camera = $Camera_rotation_helper/Camera
|
|
||||||
camera.make_current()
|
camera.make_current()
|
||||||
|
|
||||||
set_info_billboard_position()
|
set_info_billboard_position()
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
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()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
||||||
|
|
||||||
func on_window_size_changed():
|
|
||||||
change_title()
|
|
||||||
|
|
||||||
func change_title():
|
|
||||||
var title_node = get_node( WINDOW_TITLE_INPUT )
|
|
||||||
var title = "Khanat"
|
|
||||||
if title_node and not title_node.text.strip_edges() == "":
|
|
||||||
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_login_scene_character_creation_finished():
|
|
||||||
var config_file = ConfigFile.new()
|
|
||||||
var err = config_file.load( "user://player.cfg" )
|
|
||||||
if err:
|
|
||||||
print("Error code when loading config file: ", err)
|
|
||||||
|
|
||||||
config_file.set_value(str(global.character_slot), "name", global.character_name)
|
|
||||||
config_file.set_value(str(global.character_slot), "color", global.character_color)
|
|
||||||
|
|
||||||
config_file.save( "user://player.cfg" )
|
|
||||||
print("test")
|
|
||||||
global.goto_scene_loading( "res://game_scene/game_scene.tscn" )
|
|
||||||
|
|
119
scenes/global.gd
119
scenes/global.gd
|
@ -1,119 +0,0 @@
|
||||||
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
|
|
||||||
var character_sex = null
|
|
||||||
var character_slot = null
|
|
||||||
|
|
||||||
# BG loader
|
|
||||||
var loader
|
|
||||||
var wait_frames
|
|
||||||
var time_max = 100 # msec
|
|
||||||
#var current_scene
|
|
||||||
var main_scene = null
|
|
||||||
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_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)
|
|
||||||
|
|
||||||
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):
|
|
||||||
if loader == null:
|
|
||||||
# no need to process anymore
|
|
||||||
set_process(false)
|
|
||||||
return
|
|
||||||
|
|
||||||
if wait_frames > 0: # wait for frames to let the "loading" animation to show up
|
|
||||||
wait_frames -= 1
|
|
||||||
return
|
|
||||||
|
|
||||||
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 )
|
|
||||||
break
|
|
||||||
elif err == OK:
|
|
||||||
# update_progress()
|
|
||||||
pass
|
|
||||||
else: # error during loading
|
|
||||||
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
|
|
||||||
progress_texture.value = progress
|
|
||||||
|
|
||||||
|
|
||||||
# or update a progress animation?
|
|
||||||
# var len = get_node("animation").get_current_animation_length()
|
|
||||||
# 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 ):
|
|
||||||
get_tree().get_root().get_node("Main/background_loader").hide()
|
|
||||||
current_scene = scene_resource.instance()
|
|
||||||
main_scene.add_child(current_scene)
|
|
||||||
|
|
||||||
func goto_scene( path ):
|
|
||||||
# This function will usually be called from a signal callback,
|
|
||||||
# or some other function from the running scene.
|
|
||||||
# Deleting the current scene at this point might be
|
|
||||||
# a bad idea, because it may be inside of a callback or function of it.
|
|
||||||
# The worst case will be a crash or unexpected behavior.
|
|
||||||
|
|
||||||
# The way around this is deferring the load to a later time, when
|
|
||||||
# it is ensured that no code from the current scene is running:
|
|
||||||
|
|
||||||
call_deferred("_deferred_goto_scene", path)
|
|
||||||
|
|
||||||
|
|
||||||
func _deferred_goto_scene( path ):
|
|
||||||
# Immediately free the current scene,
|
|
||||||
# there is no risk here.
|
|
||||||
current_scene.free()
|
|
||||||
|
|
||||||
# Load new scene.
|
|
||||||
var s = ResourceLoader.load( path )
|
|
||||||
|
|
||||||
# Instance the new scene.
|
|
||||||
current_scene = s.instance()
|
|
||||||
|
|
||||||
# Add it to the active scene, as child of root.
|
|
||||||
path.add_child( current_scene )
|
|
||||||
|
|
||||||
# Optional, to make it compatible with the SceneTree.change_scene() API.
|
|
||||||
get_tree().set_current_scene( current_scene )
|
|
Loading…
Reference in a new issue