diff --git a/client/levels/loadingScreen/LoadingScreen.tscn b/client/levels/loadingScreen/LoadingScreen.tscn index 7f7ef231b6d12915d8b343eb9046baf908807fd0..618af6c95f51fc59f2015281afb0dfd376b84a0c 100644 --- a/client/levels/loadingScreen/LoadingScreen.tscn +++ b/client/levels/loadingScreen/LoadingScreen.tscn @@ -1,26 +1,161 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=8 format=2] -[sub_resource type="StreamTexture" id=1] -flags = 4 +[ext_resource path="res://levels/commons/assets/fondmain.png" type="Texture" id=1] +[ext_resource path="res://levels/loadingScreen/assets/fond2.png" type="Texture" id=2] +[ext_resource path="res://levels/loadingScreen/loadingScreen.gd" type="Script" id=3] +[ext_resource path="res://levels/commons/assets/logotmp.png" type="Texture" id=4] +[ext_resource path="res://levels/commons/themes/panelThemeBlack.tres" type="StyleBox" id=5] +[ext_resource path="res://levels/commons/themes/labelSkillFont.tres" type="Theme" id=6] + +[sub_resource type="Animation" id=1] +length = 5.0 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath(".:rect_scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0.5, 0.7, 0.9, 1.8, 2, 2.2, 3.2, 3.4, 3.6, 4.4, 4.6, 4.8 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath(".:rect_rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 2.3, 5 ), +"transitions": PoolRealArray( 0.34151, 4.59479, 0.34151 ), +"update": 0, +"values": [ 0.0, 5.0, 0.0 ] +} [node name="loadingScreen" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Control" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} -[node name="TextureRect" type="TextureRect" parent="."] +[node name="TextureRect3" type="TextureRect" parent="Control"] anchor_right = 1.0 anchor_bottom = 1.0 -texture = SubResource( 1 ) - -[node name="Label" type="Label" parent="."] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -44.0 -margin_top = -7.0 -margin_right = 44.0 -margin_bottom = 7.0 -text = "Chargement" +margin_right = 576.0 +margin_bottom = 1000.0 +texture = ExtResource( 1 ) +stretch_mode = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect" type="TextureRect" parent="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 2 ) +expand = true +stretch_mode = 7 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_right = 300 +custom_constants/margin_left = 300 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="Control/MarginContainer"] +margin_left = 300.0 +margin_right = 724.0 +margin_bottom = 600.0 + +[node name="MarginContainer2" type="MarginContainer" parent="Control/MarginContainer/VBoxContainer"] +margin_right = 424.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +custom_constants/margin_top = 50 + +[node name="MusicArena" type="TextureRect" parent="Control/MarginContainer/VBoxContainer"] +margin_top = 54.0 +margin_right = 424.0 +margin_bottom = 54.0 +rect_pivot_offset = Vector2( 175.725, -12.5801 ) +rect_clip_content = true +texture = ExtResource( 4 ) +expand = true +stretch_mode = 6 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="title" type="AnimationPlayer" parent="Control/MarginContainer/VBoxContainer/MusicArena"] +autoplay = "title" +anims/title = SubResource( 1 ) + +[node name="MarginContainer3" type="MarginContainer" parent="Control/MarginContainer/VBoxContainer"] +margin_top = 58.0 +margin_right = 424.0 +margin_bottom = 108.0 +size_flags_horizontal = 3 +custom_constants/margin_top = 50 + +[node name="Panel" type="Panel" parent="Control/MarginContainer/VBoxContainer"] +margin_left = 212.0 +margin_top = 112.0 +margin_right = 212.0 +margin_bottom = 162.0 +rect_min_size = Vector2( 0, 50 ) +size_flags_horizontal = 4 +size_flags_vertical = 4 +custom_styles/panel = ExtResource( 5 ) + +[node name="MarginContainer" type="MarginContainer" parent="Control/MarginContainer/VBoxContainer/Panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_right = 10 +custom_constants/margin_top = 10 +custom_constants/margin_left = 10 +custom_constants/margin_bottom = 10 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="Control/MarginContainer/VBoxContainer/Panel/MarginContainer"] +margin_left = 10.0 +margin_top = 16.0 +margin_right = 219.0 +margin_bottom = 34.0 +size_flags_vertical = 6 +theme = ExtResource( 6 ) +text = "your game is loading..." align = 1 +valign = 1 uppercase = true + +[node name="MarginContainer" type="MarginContainer" parent="Control/MarginContainer/VBoxContainer"] +margin_top = 166.0 +margin_right = 424.0 +margin_bottom = 600.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_top = 290 diff --git a/client/levels/loadingScreen/assets/charaPic.png b/client/levels/loadingScreen/assets/charaPic.png new file mode 100644 index 0000000000000000000000000000000000000000..10242745c43285c796ffbfa9e6c0a7c885f657da Binary files /dev/null and b/client/levels/loadingScreen/assets/charaPic.png differ diff --git a/client/levels/loadingScreen/assets/charaPic.png.import b/client/levels/loadingScreen/assets/charaPic.png.import new file mode 100644 index 0000000000000000000000000000000000000000..c5299973ea05e77482d002b0b8c64b5cccf6890d --- /dev/null +++ b/client/levels/loadingScreen/assets/charaPic.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/charaPic.png-f26f91d582b4c7736730487d75b29713.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://levels/loadingScreen/assets/charaPic.png" +dest_files=[ "res://.import/charaPic.png-f26f91d582b4c7736730487d75b29713.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/client/levels/loadingScreen/assets/fond.png b/client/levels/loadingScreen/assets/fond.png new file mode 100644 index 0000000000000000000000000000000000000000..44cc44fc1df0dc47162e91548a5748a346dfa196 Binary files /dev/null and b/client/levels/loadingScreen/assets/fond.png differ diff --git a/client/levels/loadingScreen/assets/fond.png.import b/client/levels/loadingScreen/assets/fond.png.import new file mode 100644 index 0000000000000000000000000000000000000000..1ea7c03ccf01675b5e34dddc4fe1a55b31b58997 --- /dev/null +++ b/client/levels/loadingScreen/assets/fond.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/fond.png-b367423ab31d16ceed61fcc1087f6a2e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://levels/loadingScreen/assets/fond.png" +dest_files=[ "res://.import/fond.png-b367423ab31d16ceed61fcc1087f6a2e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/client/levels/loadingScreen/assets/fond2.png b/client/levels/loadingScreen/assets/fond2.png new file mode 100644 index 0000000000000000000000000000000000000000..b71c0f2b159ece8ab4ffdfe0860f833a38ff94ff Binary files /dev/null and b/client/levels/loadingScreen/assets/fond2.png differ diff --git a/client/levels/loadingScreen/assets/fond2.png.import b/client/levels/loadingScreen/assets/fond2.png.import new file mode 100644 index 0000000000000000000000000000000000000000..21038216823fcd386cd438ddf841d57294fd0156 --- /dev/null +++ b/client/levels/loadingScreen/assets/fond2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/fond2.png-dc4f9f0646444294ab806e07d71e43d6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://levels/loadingScreen/assets/fond2.png" +dest_files=[ "res://.import/fond2.png-dc4f9f0646444294ab806e07d71e43d6.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/client/levels/loadingScreen/loadingScreen.gd b/client/levels/loadingScreen/loadingScreen.gd new file mode 100644 index 0000000000000000000000000000000000000000..b6b70197df70f140d412e62a65fea82ef41bab16 --- /dev/null +++ b/client/levels/loadingScreen/loadingScreen.gd @@ -0,0 +1,53 @@ +extends Control + +var LOGO +var PANEL +var ROOT + +# Initial size = 408*175px +var rlogotmpX = float(300)/float(1024) +var rlogotmpY = float(129)/float(600) + +var xWindow = 0 +var yWindow = 0 +# Initial button size = 350*79px +# First display size = 300*61 +var ratioX = float(300)/float(1024) +var ratioY = float(79)/float(600) +var ratioPanel = float(425)/float(1014) + + +func _ready(): + LOGO = $MarginContainer/VBoxContainer/MusicArena + PANEL = $MarginContainer/VBoxContainer/Panel + #ROOT = $Control + + xWindow = get_viewport().size.x + yWindow = get_viewport().size.y + var x = xWindow*ratioX + #float(xWindow)*ratioX + var y = (float(79)*x)/float(350) + var logoX = float(xWindow)*rlogotmpX + var logoY = float(yWindow)*rlogotmpY + LOGO.set_custom_minimum_size(Vector2(logoX,logoY)) + var xPanel = float(xWindow)*ratioPanel + PANEL.set_custom_minimum_size(Vector2(xPanel,50)) + var error = get_tree().get_root().connect("size_changed", self, "myfunc") + + #yield(gamestate, "gameFullyLoaded") + #print("gameFullyLoaded") + #ROOT.visible = false + +func myfunc(): + LOGO = $MarginContainer/VBoxContainer/MusicArena + PANEL = $MarginContainer/VBoxContainer/Panel + + if(get_viewport_rect().size.x != xWindow): + xWindow = get_viewport_rect().size.x + var x = float(xWindow)*ratioX + var y = 0 + var logoX = float(xWindow)*rlogotmpX + 40 + var logoY = (float(175)*x)/float(408) + var xPanel = float(xWindow)*ratioPanel + LOGO.set_custom_minimum_size(Vector2(logoX,logoY)) + PANEL.set_custom_minimum_size(Vector2(xPanel,50)) diff --git a/client/levels/test/game.gd b/client/levels/test/game.gd index 13f5e1ce609be2f238f6cdc033573b204df182ed..a688ddd1bb2328eb43f91c0c8be47bb821e49555 100644 --- a/client/levels/test/game.gd +++ b/client/levels/test/game.gd @@ -37,6 +37,7 @@ var itemsType = ["beer","hot_dog"] # Initialize the game scene, players, camera and display func _ready(): var player_scene:PackedScene = preload("res://entities/characters/player.tscn") + var loadingScreen = $loadingScreen #Next evey player will spa every other player including the server's own client! Try to move this to server only for peer_id in gamestate.players: @@ -68,6 +69,7 @@ func _ready(): get_tree().set_pause(true) print("postpause true") yield(gamestate, "gameFullyLoaded") + loadingScreen.visible = false print("gameFullyLoaded") get_tree().set_pause(false) diff --git a/client/levels/test/game.tscn b/client/levels/test/game.tscn index 57b65bcc7bd1cf13889deedd4c4e55eff72e3cc0..699501c926c43224d13918b7f8c7a863e4aec28a 100644 --- a/client/levels/test/game.tscn +++ b/client/levels/test/game.tscn @@ -1,8 +1,14 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=13 format=2] [ext_resource path="res://levels/test/game.gd" type="Script" id=1] [ext_resource path="res://levels/hud/hud.tscn" type="PackedScene" id=2] +[ext_resource path="res://levels/commons/themes/labelSkillFont.tres" type="Theme" id=3] [ext_resource path="res://levels/test/Map.tscn" type="PackedScene" id=4] +[ext_resource path="res://levels/commons/assets/logotmp.png" type="Texture" id=5] +[ext_resource path="res://levels/commons/assets/fondmain.png" type="Texture" id=6] +[ext_resource path="res://levels/commons/themes/panelThemeBlack.tres" type="StyleBox" id=7] +[ext_resource path="res://levels/loadingScreen/loadingScreen.gd" type="Script" id=8] +[ext_resource path="res://levels/loadingScreen/assets/fond2.png" type="Texture" id=9] [sub_resource type="SpatialMaterial" id=1] albedo_color = Color( 0.94902, 0.133333, 0.0470588, 0.784314 ) @@ -16,6 +22,34 @@ distance_fade_mode = 1 distance_fade_min_distance = 0.0 distance_fade_max_distance = 10.0 +[sub_resource type="Animation" id=3] +length = 5.0 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath(".:rect_scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0.5, 0.7, 0.9, 1.8, 2, 2.2, 3.2, 3.4, 3.6, 4.4, 4.6, 4.8 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 0.99, 0.99 ), Vector2( 1, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath(".:rect_rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 2.3, 5 ), +"transitions": PoolRealArray( 0.34151, 4.59479, 0.34151 ), +"update": 0, +"values": [ 0.0, 5.0, 0.0 ] +} + [node name="game" type="Spatial"] script = ExtResource( 1 ) @@ -41,3 +75,122 @@ depth = 59.7284 material = SubResource( 2 ) [node name="itemCollection" type="Spatial" parent="."] + +[node name="loadingScreen" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 8 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect3" type="TextureRect" parent="loadingScreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 576.0 +margin_bottom = 1000.0 +texture = ExtResource( 6 ) +stretch_mode = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect" type="TextureRect" parent="loadingScreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 9 ) +expand = true +stretch_mode = 7 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="loadingScreen"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_right = 300 +custom_constants/margin_left = 300 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="loadingScreen/MarginContainer"] +margin_left = 300.0 +margin_right = 724.0 +margin_bottom = 600.0 + +[node name="MarginContainer2" type="MarginContainer" parent="loadingScreen/MarginContainer/VBoxContainer"] +margin_right = 424.0 +margin_bottom = 50.0 +size_flags_horizontal = 3 +custom_constants/margin_top = 50 + +[node name="MusicArena" type="TextureRect" parent="loadingScreen/MarginContainer/VBoxContainer"] +margin_top = 54.0 +margin_right = 424.0 +margin_bottom = 54.0 +rect_pivot_offset = Vector2( 175.725, -12.5801 ) +rect_clip_content = true +texture = ExtResource( 5 ) +expand = true +stretch_mode = 6 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="title" type="AnimationPlayer" parent="loadingScreen/MarginContainer/VBoxContainer/MusicArena"] +autoplay = "title" +anims/title = SubResource( 3 ) + +[node name="MarginContainer3" type="MarginContainer" parent="loadingScreen/MarginContainer/VBoxContainer"] +margin_top = 58.0 +margin_right = 424.0 +margin_bottom = 108.0 +size_flags_horizontal = 3 +custom_constants/margin_top = 50 + +[node name="Panel" type="Panel" parent="loadingScreen/MarginContainer/VBoxContainer"] +margin_left = 212.0 +margin_top = 112.0 +margin_right = 212.0 +margin_bottom = 162.0 +rect_min_size = Vector2( 0, 50 ) +size_flags_horizontal = 4 +size_flags_vertical = 4 +custom_styles/panel = ExtResource( 7 ) + +[node name="MarginContainer" type="MarginContainer" parent="loadingScreen/MarginContainer/VBoxContainer/Panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_right = 10 +custom_constants/margin_top = 10 +custom_constants/margin_left = 10 +custom_constants/margin_bottom = 10 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="loadingScreen/MarginContainer/VBoxContainer/Panel/MarginContainer"] +margin_left = 10.0 +margin_top = 16.0 +margin_right = 219.0 +margin_bottom = 34.0 +size_flags_vertical = 6 +theme = ExtResource( 3 ) +custom_styles/normal = ExtResource( 7 ) +text = "your game is loading..." +align = 1 +valign = 1 +uppercase = true + +[node name="MarginContainer" type="MarginContainer" parent="loadingScreen/MarginContainer/VBoxContainer"] +margin_top = 166.0 +margin_right = 424.0 +margin_bottom = 600.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_top = 290