diff --git a/cmi2/assets/selectChar/lullaby.png b/cmi2/assets/selectChar/lullaby.png new file mode 100644 index 0000000000000000000000000000000000000000..3828c80e3400d03caf6823b2f419d41a54d6f9f8 Binary files /dev/null and b/cmi2/assets/selectChar/lullaby.png differ diff --git a/cmi2/assets/selectChar/lullaby.png.import b/cmi2/assets/selectChar/lullaby.png.import new file mode 100644 index 0000000000000000000000000000000000000000..99ed8c2bcbdc717bdd2527f85da054eb6c15c274 --- /dev/null +++ b/cmi2/assets/selectChar/lullaby.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/lullaby.png-7de0196c3f1b74e8aee0908a03011796.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/selectChar/lullaby.png" +dest_files=[ "res://.import/lullaby.png-7de0196c3f1b74e8aee0908a03011796.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/cmi2/assets/selectChar/small.ogv b/cmi2/assets/selectChar/small.ogv new file mode 100644 index 0000000000000000000000000000000000000000..2b35a41aa44c7c8f258b4a127be4b52ac1ab8113 Binary files /dev/null and b/cmi2/assets/selectChar/small.ogv differ diff --git a/cmi2/assets/selectChar/testvideo.webm b/cmi2/assets/selectChar/testvideo.webm new file mode 100644 index 0000000000000000000000000000000000000000..c05a1e6d7ee8eef2a599727b4810a669a375641d Binary files /dev/null and b/cmi2/assets/selectChar/testvideo.webm differ diff --git a/cmi2/saveFile.cfg b/cmi2/saveFile.cfg index 1c4e177217129f6b66e471bc11b6e8fb612fd7ee..068be45c0a0ffdba43eae3da65be42d5dd13a049 100644 --- a/cmi2/saveFile.cfg +++ b/cmi2/saveFile.cfg @@ -1,3 +1,3 @@ [Values] -Son=81.0 +Son=12.0 diff --git a/cmi2/scenes/characterSelection.gd b/cmi2/scenes/characterSelection.gd index 71204de248b57bb0b5592f3bb9f7dc9291ff0cb6..ec63d43fe07aa82ed7a2a039c6362568d89052ac 100644 --- a/cmi2/scenes/characterSelection.gd +++ b/cmi2/scenes/characterSelection.gd @@ -1,5 +1,9 @@ extends Control +var xWindow = 0 +var yWindow = 0 +var ratio = float(300)/float(430) + var SKILL_1 var SKILL_2 var SKILL_3 @@ -45,6 +49,24 @@ func _ready(): # Default character selected characterSelected("char1") + +func _process(delta): + # Video player play on loop + var video_player = $MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/VideoPlayer + var stats = $MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer + + var stat_size = stats.get_rect().size.y + #xWindow = get_viewport().size.x + yWindow = get_viewport().size.y + #var x = float(xWindow)*ratio + var y = float(yWindow)*ratio-stat_size + print(stat_size) + + video_player.set_custom_minimum_size(Vector2(y,y)) + + if not video_player.is_playing(): + video_player.play() + #set new skills value for the character func _setTextureProgress(skill, value): @@ -56,6 +78,11 @@ func _setTextureProgress(skill, value): func _setTextureCharacter(character): var charSprite = $MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/characterSprite charSprite.texture = character + +#set the pic of the selected character +func _setVideoCharacter(video): + var video_player = $MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/VideoPlayer + video_player.set_stream(load(video)) #fonction qui va récup les données des personnages #stockage BDD ou local @@ -72,24 +99,28 @@ func characterSelected(character): _setTextureProgress(SKILL_2, 15) _setTextureProgress(SKILL_3, 76) _setTextureProgress(SKILL_4, 54) + _setVideoCharacter("res://assets/selectChar/testvideo.webm") if character == "char2": _setTextureCharacter(CHARPIC2) _setTextureProgress(SKILL_1, 27) _setTextureProgress(SKILL_2, 75) _setTextureProgress(SKILL_3, 63) _setTextureProgress(SKILL_4, 32) + _setVideoCharacter("res://assets/selectChar/small.ogv") if character == "char3": _setTextureCharacter(CHARPIC3) _setTextureProgress(SKILL_1, 40) _setTextureProgress(SKILL_2, 16) _setTextureProgress(SKILL_3, 74) _setTextureProgress(SKILL_4, 58) + _setVideoCharacter("res://assets/selectChar/small.ogv") if character == "char4": _setTextureCharacter(CHARPIC4) _setTextureProgress(SKILL_1, 23) _setTextureProgress(SKILL_2, 44) _setTextureProgress(SKILL_3, 17) _setTextureProgress(SKILL_4, 89) + _setVideoCharacter("res://assets/selectChar/small.ogv") func buttonHeader(button_name): var globals = get_node("/root/Globals") diff --git a/cmi2/scenes/characterSelection.tscn b/cmi2/scenes/characterSelection.tscn index 71d62a2c65c6ad617ed784ecaea66854fcdad821..0f0b8c7f4963b992d36550af453138de04143d81 100644 --- a/cmi2/scenes/characterSelection.tscn +++ b/cmi2/scenes/characterSelection.tscn @@ -1,15 +1,14 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://scenes/characterSelection.gd" type="Script" id=1] [ext_resource path="res://assets/allPage/arrow.png" type="Texture" id=2] [ext_resource path="res://assets/Karla-Regular.ttf" type="DynamicFontData" id=3] [ext_resource path="res://assets/allPage/option.png" type="Texture" id=4] -[ext_resource path="res://assets/mainMenu/stickman.png" type="Texture" id=5] -[ext_resource path="res://assets/Karla-Bold.ttf" type="DynamicFontData" id=6] -[ext_resource path="res://assets/allPage/lifebar_bg.png" type="Texture" id=7] -[ext_resource path="res://assets/allPage/lifebar_fill.png" type="Texture" id=8] -[ext_resource path="res://scenes/GridContainer.gd" type="Script" id=9] -[ext_resource path="res://assets/selectChar/charPic.jpg" type="Texture" id=10] +[ext_resource path="res://assets/Karla-Bold.ttf" type="DynamicFontData" id=5] +[ext_resource path="res://assets/allPage/lifebar_bg.png" type="Texture" id=6] +[ext_resource path="res://assets/allPage/lifebar_fill.png" type="Texture" id=7] +[ext_resource path="res://scenes/GridContainer.gd" type="Script" id=8] +[ext_resource path="res://assets/selectChar/charPic.jpg" type="Texture" id=9] [sub_resource type="DynamicFont" id=1] size = 30 @@ -18,21 +17,30 @@ extra_spacing_bottom = 10 extra_spacing_char = 1 font_data = ExtResource( 3 ) -[sub_resource type="DynamicFont" id=2] +[sub_resource type="VideoStreamWebm" id=7] +file = "res://assets/selectChar/testvideo.webm" + +[sub_resource type="StreamTexture" id=2] + +[sub_resource type="DynamicFont" id=3] size = 20 extra_spacing_char = 1 font_data = ExtResource( 3 ) -[sub_resource type="DynamicFont" id=3] +[sub_resource type="DynamicFont" id=4] extra_spacing_char = 2 -font_data = ExtResource( 6 ) +font_data = ExtResource( 5 ) -[sub_resource type="DynamicFont" id=4] +[sub_resource type="StreamTexture" id=6] +flags = 4 +load_path = "res://.import/lullaby.png-7de0196c3f1b74e8aee0908a03011796.stex" + +[sub_resource type="DynamicFont" id=5] size = 30 extra_spacing_top = 10 extra_spacing_bottom = 10 extra_spacing_char = 2 -font_data = ExtResource( 6 ) +font_data = ExtResource( 5 ) [node name="Control" type="Control"] anchor_right = 1.0 @@ -158,110 +166,119 @@ custom_constants/margin_right = 80 [node name="verticalAlignment" type="VBoxContainer" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight"] margin_right = 396.0 margin_bottom = 394.0 +size_flags_vertical = 3 custom_constants/separation = 10 alignment = 1 +[node name="VideoPlayer" type="VideoPlayer" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment"] +margin_left = 198.0 +margin_right = 198.0 +margin_bottom = 92.0 +size_flags_horizontal = 6 +size_flags_vertical = 3 +stream = SubResource( 7 ) +autoplay = true + [node name="characterSprite" type="TextureRect" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment"] +visible = false margin_right = 396.0 -margin_bottom = 8.0 +margin_bottom = 310.0 size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource( 5 ) +texture = SubResource( 2 ) expand = true stretch_mode = 6 [node name="charaName" type="Label" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment"] -margin_top = 18.0 +margin_top = 102.0 margin_right = 396.0 -margin_bottom = 43.0 +margin_bottom = 127.0 size_flags_horizontal = 3 -custom_fonts/font = SubResource( 2 ) +custom_fonts/font = SubResource( 3 ) text = "Character Name" align = 1 valign = 1 uppercase = true [node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment"] -editor/display_folded = true -margin_top = 53.0 +margin_top = 137.0 margin_right = 396.0 margin_bottom = 394.0 [node name="skills" type="VBoxContainer" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer"] -editor/display_folded = true margin_right = 396.0 -margin_bottom = 341.0 +margin_bottom = 257.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_constants/separation = 7 +custom_constants/separation = -5 alignment = 1 [node name="skill1" type="Label" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] margin_right = 396.0 margin_bottom = 20.0 -custom_fonts/font = SubResource( 3 ) +custom_fonts/font = SubResource( 4 ) text = "skill 1" uppercase = true [node name="skillBar1" type="TextureProgress" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 27.0 +margin_top = 15.0 margin_right = 396.0 -margin_bottom = 80.0 +margin_bottom = 68.0 size_flags_horizontal = 3 value = 50.0 -texture_under = ExtResource( 7 ) -texture_progress = ExtResource( 8 ) +texture_under = ExtResource( 6 ) +texture_progress = ExtResource( 7 ) [node name="skill2" type="Label" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 87.0 +margin_top = 63.0 margin_right = 396.0 -margin_bottom = 107.0 -custom_fonts/font = SubResource( 3 ) +margin_bottom = 83.0 +custom_fonts/font = SubResource( 4 ) text = "skill 2" uppercase = true [node name="skillBar2" type="TextureProgress" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 114.0 +margin_top = 78.0 margin_right = 396.0 -margin_bottom = 167.0 +margin_bottom = 131.0 size_flags_horizontal = 3 value = 20.0 -texture_under = ExtResource( 7 ) -texture_progress = ExtResource( 8 ) +texture_under = ExtResource( 6 ) +texture_progress = ExtResource( 7 ) [node name="skill3" type="Label" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 174.0 +margin_top = 126.0 margin_right = 396.0 -margin_bottom = 194.0 -custom_fonts/font = SubResource( 3 ) +margin_bottom = 146.0 +custom_fonts/font = SubResource( 4 ) text = "skill 3" uppercase = true [node name="skillBar3" type="TextureProgress" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 201.0 +margin_top = 141.0 margin_right = 396.0 -margin_bottom = 254.0 +margin_bottom = 194.0 size_flags_horizontal = 3 value = 20.0 -texture_under = ExtResource( 7 ) -texture_progress = ExtResource( 8 ) +texture_under = ExtResource( 6 ) +texture_progress = ExtResource( 7 ) [node name="skill4" type="Label" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 261.0 +margin_top = 189.0 margin_right = 396.0 -margin_bottom = 281.0 -custom_fonts/font = SubResource( 3 ) +margin_bottom = 209.0 +custom_fonts/font = SubResource( 4 ) text = "skill 4" uppercase = true [node name="skillBar4" type="TextureProgress" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/character/marginCharRight/verticalAlignment/CenterContainer/skills"] -margin_top = 288.0 +margin_top = 204.0 margin_right = 396.0 -margin_bottom = 341.0 +margin_bottom = 257.0 size_flags_horizontal = 3 value = 20.0 -texture_under = ExtResource( 7 ) -texture_progress = ExtResource( 8 ) +texture_under = ExtResource( 6 ) +texture_progress = ExtResource( 7 ) [node name="selection" type="VBoxContainer" parent="MarginContainer/VBoxContainer/marginSelectContainer/container"] margin_left = 496.0 @@ -292,38 +309,38 @@ size_flags_vertical = 3 custom_constants/vseparation = 10 custom_constants/hseparation = 10 columns = 4 -script = ExtResource( 9 ) +script = ExtResource( 8 ) [node name="char1" type="TextureButton" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/selection/charListContainer/ScrollContainer/GridContainer"] -texture_normal = ExtResource( 10 ) +texture_normal = SubResource( 6 ) expand = true stretch_mode = 4 [node name="char2" type="TextureButton" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/selection/charListContainer/ScrollContainer/GridContainer"] margin_left = 10.0 margin_right = 10.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 [node name="char3" type="TextureButton" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/selection/charListContainer/ScrollContainer/GridContainer"] margin_left = 20.0 margin_right = 20.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 [node name="char4" type="TextureButton" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/selection/charListContainer/ScrollContainer/GridContainer"] margin_left = 30.0 margin_right = 30.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 [node name="TextureButton5" type="TextureButton" parent="MarginContainer/VBoxContainer/marginSelectContainer/container/selection/charListContainer/ScrollContainer/GridContainer"] margin_top = 10.0 margin_bottom = 10.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 @@ -332,7 +349,7 @@ margin_left = 10.0 margin_top = 10.0 margin_right = 10.0 margin_bottom = 10.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 @@ -341,7 +358,7 @@ margin_left = 20.0 margin_top = 10.0 margin_right = 20.0 margin_bottom = 10.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 @@ -350,7 +367,7 @@ margin_left = 30.0 margin_top = 10.0 margin_right = 30.0 margin_bottom = 10.0 -texture_normal = ExtResource( 10 ) +texture_normal = ExtResource( 9 ) expand = true stretch_mode = 4 @@ -369,5 +386,5 @@ margin_left = 80.0 margin_top = 20.0 margin_right = 368.0 margin_bottom = 82.0 -custom_fonts/font = SubResource( 4 ) +custom_fonts/font = SubResource( 5 ) text = "PLAY"