From f8a76a8fdd5bb11c210ae62789ee802fb17fc7ba Mon Sep 17 00:00:00 2001 From: osquallo Date: Sat, 25 Aug 2018 08:36:37 +0200 Subject: [PATCH] Divers essai et ajustement de l'ecran de creation/selection de perso. --- dispensaire_gridmap/dispensaire_gridmap.tscn | 4 +- dispensaire_scenes/dispensaire_scenes.tscn | 5 +- game_scene/game_scene.gd | 5 +- global.gd | 14 +-- global.tscn | 2 +- login_scene/character_creation_box.gd | 5 +- login_scene/character_creation_box.tscn | 1 + login_scene/character_selection_menu.gd | 11 +-- login_scene/character_selection_menu.tscn | 93 ++++++++++---------- scenes/Game/Character/Character.gd | 4 +- scenes/Game/Character/Character.tscn | 3 +- scenes/Game/Game.tscn | 12 +-- 12 files changed, 72 insertions(+), 87 deletions(-) diff --git a/dispensaire_gridmap/dispensaire_gridmap.tscn b/dispensaire_gridmap/dispensaire_gridmap.tscn index 7dc7d90..75dad8c 100644 --- a/dispensaire_gridmap/dispensaire_gridmap.tscn +++ b/dispensaire_gridmap/dispensaire_gridmap.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://assets/Game/basekits/Kit_dispensaire.meshlib" type="MeshLibrary" id=1] [ext_resource path="res://scenes/Game/portail/portail.tscn" type="PackedScene" id=2] -[node name="dispensaire_gridmap" type="Node"] +[node name="dispensaire_gridmap" type="Node" index="0"] [node name="start_position" type="Spatial" parent="." index="0"] @@ -23,7 +23,7 @@ cell_scale = 1.0 collision_layer = 1 collision_mask = 1 data = { -"cells": PoolIntArray( 3, 0, 655361, 5, 0, 655361, 65535, 0, 1074790403, 2, 65534, 1, 4, 65534, 1, 0, 65535, 1441797, 1, 65535, 1441797, 2, 65535, 1441798, 3, 65535, 1048582, 4, 65535, 1441798, 5, 65535, 1048582, 6, 65535, 1441793, 65535, 65535, 1048578 ) +"cells": PoolIntArray( 3, 0, 655361, 5, 0, 655361, 65535, 0, 1048579, 2, 65534, 1073741825, 4, 65534, 1, 0, 65535, 1441797, 1, 65535, 1441797, 2, 65535, 1441798, 3, 65535, 537919494, 4, 65535, 1441798, 5, 65535, 537919494, 6, 65535, 1075183617, 65535, 65535, 1048578 ) } _sections_unfolded = [ "Cell" ] __meta__ = { diff --git a/dispensaire_scenes/dispensaire_scenes.tscn b/dispensaire_scenes/dispensaire_scenes.tscn index 77e7c00..ec80dca 100644 --- a/dispensaire_scenes/dispensaire_scenes.tscn +++ b/dispensaire_scenes/dispensaire_scenes.tscn @@ -6,15 +6,14 @@ [ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor2wDoLRAA01.tscn" type="PackedScene" id=4] [ext_resource path="res://scenes/Game/portail/portail.tscn" type="PackedScene" id=5] -[node name="dispensaire_scenes" type="Node"] +[node name="dispensaire_scenes" type="Node" index="0"] [node name="world" type="Spatial" parent="." index="0"] -editor/display_folded = true - [node name="DisCor1wDoLRAA01" parent="world" index="0" instance=ExtResource( 1 )] transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, -1, 0, 0 ) +_sections_unfolded = [ "material" ] [node name="DisCor2wDoLAA01" parent="world/DisCor1wDoLRAA01" index="1" instance=ExtResource( 2 )] diff --git a/game_scene/game_scene.gd b/game_scene/game_scene.gd index 0f45ee6..30afe9f 100644 --- a/game_scene/game_scene.gd +++ b/game_scene/game_scene.gd @@ -7,10 +7,13 @@ const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer func _ready(): get_tree().get_root().connect("size_changed", self, "on_window_size_changed") - + global.get_node("GUI").show() global.get_node("GUI").play() + character.show_third_person_camera() + character.get_node( "infos_spatial" ).show() + func _process(delta): pass diff --git a/global.gd b/global.gd index 387fdde..e7731db 100644 --- a/global.gd +++ b/global.gd @@ -174,19 +174,9 @@ func set_new_scene( scene_resource ): 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(character.slot), "name", character.pseudo) -# config_file.set_value(str(character.slot), "color", character.color) -# config_file.set_value(str(character.slot), "size", character.size) -# -# config_file.save( "user://player.cfg" ) + self.change_level( "game", "res://game_scene/game_scene.tscn", null, get_tree().get_root().get_node("login_scene") ) - character.show_third_person_camera() - character.get_node( "infos_spatial" ).show() + func _on_logout_button_pressed(): self.change_level( "login", "res://login_scene/login_scene.tscn", null, current_map ) diff --git a/global.tscn b/global.tscn index aa1c2d8..5de1b0e 100644 --- a/global.tscn +++ b/global.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://background_loader_scene/background_loader.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/GUI/GUI.tscn" type="PackedScene" id=3] -[node name="global" type="Node" index="0"] +[node name="global" type="Node"] pause_mode = 2 script = ExtResource( 1 ) diff --git a/login_scene/character_creation_box.gd b/login_scene/character_creation_box.gd index e9aaa21..144f295 100644 --- a/login_scene/character_creation_box.gd +++ b/login_scene/character_creation_box.gd @@ -37,23 +37,20 @@ func _on_generate_name_pressed(): var nb_syllabes = $margin_container/v_box_container/generate_name_box/nb_syllabe.value var nb_noms = $margin_container/v_box_container/generate_name_box/nb_nom.value var region = $margin_container/v_box_container/generate_name_box/region_menu.text - print("region: "+str(region) ) + var name = "" var trad = "" for nom_index in range( 0, nb_noms ): for syllabe_index in range( 0, nb_syllabes ): if region == "Culno": - print("Culno") var index = randi()%len(syllabes_culno) name += syllabes_culno[ index ] trad += syllabes_culno_trad[ index ] elif region == "Tcara": - print("Tcara") var index = randi()%len(syllabes_tcara) name += syllabes_tcara[ index ] trad += syllabes_tcara_trad[ index ] else: - print("Khanat") var index = randi()%len(syllabes_khanat) name += syllabes_khanat[ index ] trad += syllabes_khanat_trad[ index ] diff --git a/login_scene/character_creation_box.tscn b/login_scene/character_creation_box.tscn index 7cb7261..041e2f1 100644 --- a/login_scene/character_creation_box.tscn +++ b/login_scene/character_creation_box.tscn @@ -66,6 +66,7 @@ _sections_unfolded = [ "Material", "Size Flags", "Visibility" ] [node name="margin_container" type="MarginContainer" parent="." index="1"] +editor/display_folded = true anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 diff --git a/login_scene/character_selection_menu.gd b/login_scene/character_selection_menu.gd index c27cbd6..884f5d1 100644 --- a/login_scene/character_selection_menu.gd +++ b/login_scene/character_selection_menu.gd @@ -159,8 +159,6 @@ func _on_character_creation_box_creation_button_pressed(): self.character_box.get_node( "character_creation_box" ).show_error( "You need to choose a character's name." ) return self.character_preview.pseudo = self.name_input.text -# character.color = character_mesh.get_surface_material(0).get_shader_param("albedo") -# character.size = character_mesh.scale.x var config_file = ConfigFile.new() var err = config_file.load( "user://player.cfg" ) @@ -196,12 +194,7 @@ func _process( delta ): self.character_mesh.rotation.y -= delta elif turn_direction == "right": self.character_mesh.rotation.y += delta -# -# if zoom_direction == "front": -# self.character_mesh.translation.z += delta -# elif zoom_direction == "back": -# self.character_mesh.translation.z -= delta - + if zoom_direction == "front": $viewport/character/face_camera.size += delta elif zoom_direction == "back": @@ -240,3 +233,5 @@ func _on_lights_toggled(button_pressed): 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 diff --git a/login_scene/character_selection_menu.tscn b/login_scene/character_selection_menu.tscn index 5b5ef9e..053fc50 100644 --- a/login_scene/character_selection_menu.tscn +++ b/login_scene/character_selection_menu.tscn @@ -20,7 +20,7 @@ resource_local_to_scene = true flags = 0 viewport_path = NodePath("viewport") -[node name="character_selection_menu" type="Control" index="0"] +[node name="character_selection_menu" type="Control"] anchor_left = 0.0 anchor_top = 0.0 @@ -156,7 +156,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false -mouse_filter = 0 +mouse_filter = 1 mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 @@ -164,7 +164,7 @@ custom_constants/margin_right = 8 custom_constants/margin_top = 8 custom_constants/margin_left = 8 custom_constants/margin_bottom = 8 -_sections_unfolded = [ "Size Flags", "custom_constants" ] +_sections_unfolded = [ "Mouse", "Size Flags", "custom_constants" ] [node name="character_box" type="HBoxContainer" parent="margin_container" index="0"] @@ -174,8 +174,8 @@ anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 8.0 margin_top = 8.0 -margin_right = 1016.0 -margin_bottom = 652.0 +margin_right = 1090.0 +margin_bottom = 1068.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -183,12 +183,12 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 3 size_flags_vertical = 3 alignment = 0 -_sections_unfolded = [ "Size Flags", "custom_constants" ] +_sections_unfolded = [ "Mouse", "Size Flags", "custom_constants" ] [node name="character_slots" parent="margin_container/character_box" index="0" instance=ExtResource( 4 )] -margin_top = 312.0 -margin_bottom = 332.0 +margin_top = 520.0 +margin_bottom = 540.0 size_flags_vertical = 6 custom_constants/separation = 8 _sections_unfolded = [ "Size Flags", "custom_constants" ] @@ -196,20 +196,18 @@ _sections_unfolded = [ "Size Flags", "custom_constants" ] [node name="character_creation_box" parent="margin_container/character_box" index="1" instance=ExtResource( 5 )] visible = false -margin_left = 58.0 -margin_top = 183.0 -margin_right = 600.0 -margin_bottom = 401.0 +margin_top = 0.0 +margin_right = 1008.0 +margin_bottom = 584.0 +size_flags_horizontal = 7 +size_flags_vertical = 7 [node name="v_box_container" type="VBoxContainer" parent="margin_container/character_box" index="2"] anchor_left = 0.0 anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 58.0 -margin_right = 1008.0 -margin_bottom = 644.0 +anchor_right = 1.0 +anchor_bottom = 1.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 @@ -217,46 +215,26 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 3 size_flags_vertical = 3 alignment = 0 -_sections_unfolded = [ "Size Flags" ] +_sections_unfolded = [ "Mouse", "Size Flags" ] -[node name="texture_rect" type="TextureRect" parent="margin_container/character_box/v_box_container" index="0"] +[node name="h_box_container" type="HBoxContainer" parent="margin_container/character_box/v_box_container" index="0"] +editor/display_folded = true anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_right = 950.0 -margin_bottom = 608.0 -rect_min_size = Vector2( 512, 512 ) +margin_left = 453.0 +margin_right = 629.0 +margin_bottom = 32.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 7 -size_flags_vertical = 7 -texture = SubResource( 1 ) -expand = true -stretch_mode = 6 -_sections_unfolded = [ "Axis Stretch", "Grow Direction", "Margin", "Rect", "Size Flags" ] - -[node name="h_box_container" type="HBoxContainer" parent="margin_container/character_box/v_box_container" index="1"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 -margin_left = 387.0 -margin_top = 612.0 -margin_right = 563.0 -margin_bottom = 644.0 -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 1 -mouse_default_cursor_shape = 0 +mouse_default_cursor_shape = 2 size_flags_horizontal = 6 -size_flags_vertical = 1 +size_flags_vertical = 0 alignment = 0 -_sections_unfolded = [ "Size Flags" ] +_sections_unfolded = [ "Mouse", "Size Flags" ] [node name="turn_left" type="TextureButton" parent="margin_container/character_box/v_box_container/h_box_container" index="0"] @@ -383,6 +361,27 @@ texture_normal = ExtResource( 12 ) texture_pressed = ExtResource( 13 ) _sections_unfolded = [ "Hint", "Textures" ] +[node name="character_preview_image" type="TextureRect" parent="margin_container/character_box/v_box_container" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 36.0 +margin_right = 1082.0 +margin_bottom = 1060.0 +rect_min_size = Vector2( 512, 512 ) +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 7 +size_flags_vertical = 7 +texture = SubResource( 1 ) +expand = true +stretch_mode = 6 +_sections_unfolded = [ "Axis Stretch", "Grow Direction", "Margin", "Mouse", "Rect", "Size Flags" ] + [connection signal="return_button_pressed" from="margin_container/character_box/character_slots" to="." method="_on_character_slots_return_button_pressed"] [connection signal="creation_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_creation_button_pressed"] @@ -411,4 +410,6 @@ _sections_unfolded = [ "Hint", "Textures" ] [connection signal="toggled" from="margin_container/character_box/v_box_container/h_box_container/lights" to="." method="_on_lights_toggled"] +[connection signal="resized" from="margin_container/character_box/v_box_container/character_preview_image" to="." method="_on_character_preview_image_resized"] + diff --git a/scenes/Game/Character/Character.gd b/scenes/Game/Character/Character.gd index 3dbc978..ab930aa 100644 --- a/scenes/Game/Character/Character.gd +++ b/scenes/Game/Character/Character.gd @@ -54,10 +54,8 @@ func update( start_position = null ): self.rotation = start_position.rotation self.player_mesh.scale = Vector3( self.size, self.size, self.size ) - print( "size: "+ str(size) ) - print( "scale: "+ str(self.player_mesh.scale) ) + self.player_mesh.get_surface_material(0).set_shader_param( "albedo", self.color ) -# self.player_mesh.get_surface_material(0).albedo_color = self.color func _process(delta): process_input(delta) diff --git a/scenes/Game/Character/Character.tscn b/scenes/Game/Character/Character.tscn index 9b77db3..a0b40e3 100644 --- a/scenes/Game/Character/Character.tscn +++ b/scenes/Game/Character/Character.tscn @@ -91,8 +91,9 @@ script = ExtResource( 2 ) [node name="character_infos_billboard" parent="infos_spatial" index="0" instance=ExtResource( 3 )] visible = false +mouse_filter = 2 mouse_default_cursor_shape = 2 -_sections_unfolded = [ "Focus", "Mouse", "Rect", "Size Flags", "Visibility" ] +_sections_unfolded = [ "Mouse", "Size Flags", "Visibility" ] [node name="Camera_rotation_helper" type="Spatial" parent="." index="1"] diff --git a/scenes/Game/Game.tscn b/scenes/Game/Game.tscn index 19ea419..32bf628 100644 --- a/scenes/Game/Game.tscn +++ b/scenes/Game/Game.tscn @@ -1012,7 +1012,7 @@ material = SubResource( 34 ) custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) size = Vector2( 0.4, 0.4 ) -[node name="Game" type="Spatial"] +[node name="Game" type="Spatial" index="0"] _sections_unfolded = [ "Transform" ] @@ -1340,16 +1340,16 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 12.1976 ) _sections_unfolded = [ "Transform", "Visibility" ] scene_path = NodePath("res://dispensaire_scenes/dispensaire_scenes.tscn") -[node name="start_position" type="Spatial" parent="World/portail_scenes" index="1"] - -transform = Transform( -1, 0, -1.50996e-007, 0, 1, 0, 1.50996e-007, 0, -1, 0.282988, 2.34225, -2.47697 ) -_sections_unfolded = [ "Transform" ] - [node name="portail_gridmap" parent="World" index="10" instance=ExtResource( 14 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.01158, 0, 12.1976 ) scene_path = NodePath("res://dispensaire_gridmap/dispensaire_gridmap.tscn") +[node name="start_position" type="Spatial" parent="World" index="11"] + +transform = Transform( -2.8213e-007, 0, 1, 0, 1, 0, -1, 0, -2.8213e-007, 0.045612, 2.34225, 8.73855 ) +_sections_unfolded = [ "Transform" ] + [connection signal="sleeping_state_changed" from="World/Box" to="World/Box" method="_on_Box_sleeping_state_changed"] [connection signal="sleeping_state_changed" from="World/Box2" to="World/Box2" method="_on_Box_sleeping_state_changed"]