improve end screen and add animals
This commit is contained in:
parent
6cbcb2008c
commit
3c5acc9b85
27 changed files with 524 additions and 120 deletions
|
@ -1 +1 @@
|
|||
{"events":[{"change_timeline":"timeline-1619379308.json"},{"wait_seconds":1}],"metadata":{"dialogic-version":"1.1","file":"timeline-1616659306.json","name":"00_start"}}
|
||||
{"events":[{"change_timeline":"timeline-1616662258.json"}],"metadata":{"dialogic-version":"1.1","file":"timeline-1616659306.json","name":"00_start"}}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"events":[{"wait_seconds":1},{"character":"","portrait":"","text":"Fin de la démo, merci d'avoir joué !"},{"action":"leaveall","character":"[All]"}],"metadata":{"dialogic-version":"1.1","file":"timeline-1616662258.json","name":"00_end"}}
|
||||
{"events":[{"background":"res://backgrounds/bureauGroupe-2.jpg"},{"wait_seconds":1},{"character":"","portrait":"","text":"Fin de la démo, merci d'avoir joué !"},{"action":"leaveall","character":"[All]"},{"emit_signal":"end_game"},{"wait_seconds":10}],"metadata":{"dialogic-version":"1.1","file":"timeline-1616662258.json","name":"00_end"}}
|
||||
|
|
8
fonts/PanelContentFont.tres
Normal file
8
fonts/PanelContentFont.tres
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
outline_size = 1
|
||||
outline_color = Color( 0.384314, 0.380392, 0.380392, 1 )
|
||||
font_data = ExtResource( 1 )
|
9
fonts/PanelTitleFont.tres
Normal file
9
fonts/PanelTitleFont.tres
Normal file
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 30
|
||||
outline_size = 3
|
||||
outline_color = Color( 0.384314, 0.380392, 0.380392, 1 )
|
||||
font_data = ExtResource( 1 )
|
BIN
images/animals/abeille.png
Normal file
BIN
images/animals/abeille.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
34
images/animals/abeille.png.import
Normal file
34
images/animals/abeille.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/abeille.png-25a3782f77363162b5b714b9943275ec.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/animals/abeille.png"
|
||||
dest_files=[ "res://.import/abeille.png-25a3782f77363162b5b714b9943275ec.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
|
BIN
images/animals/castor.png
Normal file
BIN
images/animals/castor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 219 KiB |
34
images/animals/castor.png.import
Normal file
34
images/animals/castor.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/castor.png-9af29423cb152ed1cdb83f54d1a20220.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/animals/castor.png"
|
||||
dest_files=[ "res://.import/castor.png-9af29423cb152ed1cdb83f54d1a20220.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
|
BIN
images/animals/chien.png
Normal file
BIN
images/animals/chien.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 176 KiB |
34
images/animals/chien.png.import
Normal file
34
images/animals/chien.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/chien.png-8d9e96a3b768f6bf57813de024c7160f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/animals/chien.png"
|
||||
dest_files=[ "res://.import/chien.png-8d9e96a3b768f6bf57813de024c7160f.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
|
BIN
images/animals/dauphin.png
Normal file
BIN
images/animals/dauphin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 303 KiB |
34
images/animals/dauphin.png.import
Normal file
34
images/animals/dauphin.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/dauphin.png-e50553bc0d5e7b67da559b6124f3cec8.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/animals/dauphin.png"
|
||||
dest_files=[ "res://.import/dauphin.png-e50553bc0d5e7b67da559b6124f3cec8.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
|
BIN
images/animals/renard.png
Normal file
BIN
images/animals/renard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
34
images/animals/renard.png.import
Normal file
34
images/animals/renard.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/renard.png-1f378da00747e5b174a138f2a71e88e1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/animals/renard.png"
|
||||
dest_files=[ "res://.import/renard.png-1f378da00747e5b174a138f2a71e88e1.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
|
|
@ -29,7 +29,6 @@ func play_music():
|
|||
|
||||
|
||||
func _on_Dialogic_signal_received(value: String):
|
||||
print("signal received")
|
||||
var args = value.split(" ")
|
||||
if args.size() > 0:
|
||||
var type = args[0];
|
||||
|
@ -43,6 +42,8 @@ func _on_Dialogic_signal_received(value: String):
|
|||
setup_minigame(args[1], args[2], args[3])
|
||||
else:
|
||||
print("not enough arguments for start_minigame")
|
||||
"end_game":
|
||||
Transit.change_scene("res://scenes/animal/AnimalScene.tscn", 1)
|
||||
_:
|
||||
print("wrong type")
|
||||
|
||||
|
@ -56,8 +57,6 @@ func start_minigame():
|
|||
|
||||
|
||||
func _on_MiniGame_game_over(next_timeline: String):
|
||||
print("Game over received")
|
||||
print("next timeline: " + next_timeline)
|
||||
dialogic_node = Dialogic.start(next_timeline)
|
||||
dialogic_node.connect('dialogic_signal', self, "_on_Dialogic_signal_received")
|
||||
add_child_below_node($MiniGame, dialogic_node)
|
||||
|
|
|
@ -3,11 +3,17 @@ extends Control
|
|||
var MAIN_MENU_MUSIC = "res://music/menu_principal.ogg"
|
||||
|
||||
onready var exit_button = $MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel/MarginContainer/CenterContainer/VBoxContainer/MarginContainer2/ExitButton
|
||||
onready var continue_button = $MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel/MarginContainer/CenterContainer/VBoxContainer/ContinueButton
|
||||
|
||||
var save_available := false
|
||||
|
||||
func _ready():
|
||||
BackgroundMusic.crossfade_to(MAIN_MENU_MUSIC, -10, 1)
|
||||
if OS.get_name() == "HTML5":
|
||||
exit_button.hide()
|
||||
save_available = not Dialogic.get_current_timeline().empty()
|
||||
if not save_available:
|
||||
continue_button.hide()
|
||||
|
||||
|
||||
func load_main_game():
|
||||
|
|
|
@ -30,32 +30,32 @@ __meta__ = {
|
|||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/margin_right = 100
|
||||
custom_constants/margin_right = 75
|
||||
custom_constants/margin_top = 10
|
||||
custom_constants/margin_left = 100
|
||||
custom_constants/margin_left = 75
|
||||
custom_constants/margin_bottom = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
margin_left = 100.0
|
||||
margin_left = 75.0
|
||||
margin_top = 10.0
|
||||
margin_right = 1820.0
|
||||
margin_right = 1845.0
|
||||
margin_bottom = 1070.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 1720.0
|
||||
margin_right = 1770.0
|
||||
margin_bottom = 137.0
|
||||
custom_fonts/font = ExtResource( 6 )
|
||||
text = "Serious Game on Ethics"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 141.0
|
||||
margin_right = 1720.0
|
||||
margin_right = 1770.0
|
||||
margin_bottom = 1042.0
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
|
@ -63,7 +63,7 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 350.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 901.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
@ -71,9 +71,9 @@ __meta__ = {
|
|||
|
||||
[node name="Panel" type="Panel" parent="MarginContainer/VBoxContainer/HBoxContainer/CenterContainer"]
|
||||
margin_top = 200.0
|
||||
margin_right = 350.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 700.0
|
||||
rect_min_size = Vector2( 350, 500 )
|
||||
rect_min_size = Vector2( 300, 500 )
|
||||
custom_styles/panel = ExtResource( 5 )
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel"]
|
||||
|
@ -92,13 +92,13 @@ __meta__ = {
|
|||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel/MarginContainer"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 330.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 480.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel/MarginContainer/CenterContainer"]
|
||||
margin_left = 37.0
|
||||
margin_left = 12.0
|
||||
margin_top = 46.0
|
||||
margin_right = 272.0
|
||||
margin_right = 247.0
|
||||
margin_bottom = 414.0
|
||||
custom_constants/separation = 20
|
||||
__meta__ = {
|
||||
|
@ -152,8 +152,8 @@ margin_bottom = 102.0
|
|||
text = "Quitter"
|
||||
|
||||
[node name="Characters" type="Control" parent="MarginContainer/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 354.0
|
||||
margin_right = 1720.0
|
||||
margin_left = 304.0
|
||||
margin_right = 1770.0
|
||||
margin_bottom = 901.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
|
@ -195,7 +195,7 @@ __meta__ = {
|
|||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 1046.0
|
||||
margin_right = 1720.0
|
||||
margin_right = 1770.0
|
||||
margin_bottom = 1060.0
|
||||
text = "Serious Game on Ethics v0.1"
|
||||
align = 2
|
||||
|
|
45
scenes/animal/AnimalScene.gd
Normal file
45
scenes/animal/AnimalScene.gd
Normal file
|
@ -0,0 +1,45 @@
|
|||
extends "res://util/StatsHandler.gd"
|
||||
|
||||
|
||||
onready var text_container = $MarginContainer
|
||||
onready var animal_container = $CenterContainer
|
||||
onready var animal_texture = $CenterContainer/AnimalTexture
|
||||
onready var animal_name = $MarginContainer/CenterContainer/Panel/MarginContainer/VBoxContainer/Title
|
||||
onready var animal_description = $MarginContainer/CenterContainer/Panel/MarginContainer/VBoxContainer/Content
|
||||
onready var tween = $Tween
|
||||
|
||||
var animation_played := false
|
||||
|
||||
|
||||
export(Array, Texture) var animals := []
|
||||
export(Array, String) var names := []
|
||||
export(Array, String, MULTILINE) var descriptions := []
|
||||
|
||||
|
||||
var max_gauge : String
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var max_gauge = gauges_values.find(gauges_values.max())
|
||||
if max_gauge < animals.size() and max_gauge < names.size() and max_gauge < descriptions.size():
|
||||
animal_texture.texture = animals[max_gauge]
|
||||
animal_name.text = names[max_gauge]
|
||||
animal_description.text = descriptions[max_gauge]
|
||||
BackgroundMusic.crossfade_to("res://music/menu_principal.ogg", -10, 1)
|
||||
|
||||
|
||||
func play_start_animation():
|
||||
tween.interpolate_property(text_container, "rect_position", null, Vector2(0, 0), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
tween.interpolate_property(animal_container, "rect_position", null, Vector2(0, -100), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
tween.interpolate_property(animal_texture, "rect_scale", null, Vector2(0.8, 0.8), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
tween.start()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("dialogic_next"):
|
||||
if not animation_played:
|
||||
animation_played = true
|
||||
play_start_animation()
|
||||
else:
|
||||
Transit.change_scene("res://scenes/end-screen/EndRecap.tscn", 2)
|
||||
|
126
scenes/animal/AnimalScene.tscn
Normal file
126
scenes/animal/AnimalScene.tscn
Normal file
|
@ -0,0 +1,126 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://images/animals/castor.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/animal/AnimalScene.gd" type="Script" id=2]
|
||||
[ext_resource path="res://styles/Panel.tres" type="StyleBox" id=3]
|
||||
[ext_resource path="res://fonts/PanelTitleFont.tres" type="DynamicFont" id=4]
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Regular.ttf" type="DynamicFontData" id=5]
|
||||
[ext_resource path="res://images/animals/renard.png" type="Texture" id=6]
|
||||
[ext_resource path="res://images/animals/chien.png" type="Texture" id=7]
|
||||
[ext_resource path="res://images/animals/dauphin.png" type="Texture" id=8]
|
||||
[ext_resource path="res://images/animals/abeille.png" type="Texture" id=9]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 25
|
||||
outline_size = 1
|
||||
outline_color = Color( 0.384314, 0.380392, 0.380392, 1 )
|
||||
font_data = ExtResource( 5 )
|
||||
|
||||
[node name="AnimalScene" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
animals = [ ExtResource( 1 ), ExtResource( 8 ), ExtResource( 6 ), ExtResource( 9 ), ExtResource( 7 ) ]
|
||||
names = [ "Castor", "Dauphin", "Renard", "Abeille", "Chien" ]
|
||||
descriptions = [ "Au fil de toutes vos décisions lors de ce jeu, vous avez majoritairement priorisé le travail à accomplir devant toute forme de distraction. Vous êtes sérieux, attentif et veillez au bon déroulement des projets auxquels vous êtes associés. Attention cependant à ne pas négliger les relations sociales, une pause peut être bienvenue par moment.", "Au fil de toutes vos décisions lors de ce jeu, vous n’avez pas hésité à vous nourrir des informations à votre portée. Vous appréciez vous former par vous même sur des sujets qui vous intéressent mais aussi apprendre des autres qui sont pour vous une source inépuisable de savoir. Attention cependant que cette curiosité ne devienne pas compulsive et nuise au respect d’autrui.", "Au fil de toutes vos décisions lors de ce jeu, vous avez veillé majoritairement à mettre votre santé financière ou bien celle de votre entreprise au premier plan. Pour vous, l’argent a une place importante autant dans la société que dans le monde du travail et en posséder représente un avantage de taille. Attention cependant à ne pas négliger d’autres valeurs qui peuvent sembler moins avantageuse du point de vue financier. ", "Au fil de vos décisions lors de ce jeu, vous avez majoritairement favorisé des choix éco-responsables. L’écologie est importante pour vous et vous avez à cœur de prendre des décisions qui permettent un avancement concernant la protection de l’environnement. Attention cependant à ne pas prendre des décisions trop utopiques qui pourraient ne pas se révéler efficaces et réalisables.", "Au fil de vos décisions lors de ce jeu, le bien-être et le respect d’autrui ont été au centre de vos choix. Vous prêtez beaucoup attention aux personnes qui vous entourent et vous veillez à développer au maximum vos relations, aussi bien avec vos collègues de travail qu’avec vos relations personnelles. Attention cependant à ne pas oublier votre propre bien-être en dépit de celui des autres. " ]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 1
|
||||
color = Color( 0.113725, 0.113725, 0.113725, 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AnimalTexture" type="TextureRect" parent="CenterContainer"]
|
||||
margin_left = 560.0
|
||||
margin_top = 140.0
|
||||
margin_right = 1360.0
|
||||
margin_bottom = 940.0
|
||||
rect_min_size = Vector2( 800, 800 )
|
||||
rect_pivot_offset = Vector2( 400, 400 )
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 400.0
|
||||
margin_bottom = 400.0
|
||||
custom_constants/margin_top = 700
|
||||
custom_constants/margin_bottom = 0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer"]
|
||||
margin_top = 700.0
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 1080.0
|
||||
|
||||
[node name="Panel" type="Panel" parent="MarginContainer/CenterContainer"]
|
||||
margin_left = 509.0
|
||||
margin_top = 14.0
|
||||
margin_right = 1409.0
|
||||
margin_bottom = 364.0
|
||||
rect_min_size = Vector2( 900, 350 )
|
||||
custom_styles/panel = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true,
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/CenterContainer/Panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
custom_constants/margin_bottom = 20
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/CenterContainer/Panel/MarginContainer"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 880.0
|
||||
margin_bottom = 330.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/CenterContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
margin_right = 860.0
|
||||
margin_bottom = 42.0
|
||||
custom_fonts/font = ExtResource( 4 )
|
||||
text = "Le Castor"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Content" type="Label" parent="MarginContainer/CenterContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
margin_top = 46.0
|
||||
margin_right = 860.0
|
||||
margin_bottom = 310.0
|
||||
size_flags_vertical = 3
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Au fil de toutes vos décisions lors de ce jeu, vous avez majoritairement priorisé le travail à accomplir devant toute forme de distraction. Vous êtes sérieux, attentif et veillez au bon déroulement des projets auxquels vous êtes associés. Attention cependant à ne pas négliger les relations sociales, une pause peut être bienvenue par moment.
|
||||
"
|
||||
align = 3
|
||||
autowrap = true
|
||||
|
||||
[node name="Tween" type="Tween" parent="."]
|
|
@ -7,7 +7,7 @@ export(Array, String, MULTILINE) var choices_descriptions = []
|
|||
|
||||
|
||||
var choice : int = 0 setget set_choice
|
||||
|
||||
export(float) var info_panel_height := 500.0
|
||||
|
||||
onready var tween = $Tween
|
||||
onready var hover_control = $HoverControl
|
||||
|
@ -25,6 +25,7 @@ func _ready():
|
|||
hover_control.infobox_position = "top"
|
||||
hover_control.info_panel.title = ""
|
||||
hover_control.info_panel.content = ""
|
||||
hover_control.info_panel_height = info_panel_height
|
||||
|
||||
|
||||
func start_anim():
|
||||
|
@ -48,7 +49,6 @@ func _set_description():
|
|||
|
||||
|
||||
func set_choice(new_value: int):
|
||||
print("setting choice")
|
||||
choice = new_value
|
||||
_set_description()
|
||||
start_anim()
|
||||
|
|
|
@ -19,7 +19,7 @@ anchor_bottom = 1.0
|
|||
mouse_default_cursor_shape = 2
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
stretch_mode = 6
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
|
|
@ -1,27 +1,9 @@
|
|||
extends Control
|
||||
|
||||
var GAUGE_PREFIX = "jauge_"
|
||||
var RELATIONS_PREFIX = "relation_"
|
||||
var CHOICES_PREFIX = "choix_"
|
||||
|
||||
var gauges_names := ["travail", "education", "financier", "ecologie", "social"]
|
||||
var relations_names := ["evelyne", "jm"]
|
||||
var choices_names := ["tel_ouvert"]
|
||||
|
||||
var gauges_ranges := [[-11, 14], [-9, 23], [-23, 24], [-13, 16], [-16, 17]]
|
||||
var relations_ranges := [[-5, 6], [-3, 5]]
|
||||
|
||||
var gauges_values := []
|
||||
var relations_values := []
|
||||
var choices_values := []
|
||||
|
||||
var gauges := {}
|
||||
var relations := {}
|
||||
var choices := {}
|
||||
extends "res://util/StatsHandler.gd"
|
||||
|
||||
onready var progress_container = $VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer
|
||||
onready var choices_container = $VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2
|
||||
onready var main_container = $VBoxContainer/Control
|
||||
onready var main_tween = $VBoxContainer/Control/Tween
|
||||
onready var recap_container = $VBoxContainer/Control/RecapContainer
|
||||
onready var characters_container = $VBoxContainer/Control/CharactersContainer
|
||||
onready var gauges_timer = $GaugesTimer
|
||||
|
@ -33,10 +15,6 @@ var shown_choice_index = 0
|
|||
func _ready():
|
||||
progress_container.connect("mouse_entered", self, '_on_mouse_entered')
|
||||
progress_container.connect("mouse_exited", self, '_on_mouse_exited')
|
||||
_recover_variables()
|
||||
gauges_values = _get_percentages(gauges, gauges_names, gauges_ranges)
|
||||
relations_values = _get_percentages(relations, relations_names, relations_ranges)
|
||||
choices_values = _get_choices_array()
|
||||
|
||||
_set_characters_relations()
|
||||
|
||||
|
@ -49,6 +27,27 @@ func _ready():
|
|||
_on_ChoicesTimer_timeout()
|
||||
choices_timer.start()
|
||||
|
||||
_play_start_animation()
|
||||
|
||||
|
||||
|
||||
func _play_start_animation():
|
||||
main_tween.interpolate_property(recap_container, "rect_position", Vector2(0, recap_container.rect_size.y/3), Vector2(0, 0), 0.8, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
main_tween.interpolate_property(recap_container, "modulate", Color(1, 1, 1, 0), Color(1, 1, 1, 1), 0.8, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
|
||||
_setup_character_animation(characters_container.get_child(0), true)
|
||||
_setup_character_animation(characters_container.get_child(2), false)
|
||||
main_tween.start()
|
||||
|
||||
|
||||
func _setup_character_animation(character: Control, is_left: bool):
|
||||
var delay = 0.3 if is_left else 0.5
|
||||
var x_pos = character.rect_position.x - character.rect_size.x/3 if is_left else character.rect_position.x + character.rect_size.x/3
|
||||
character.modulate = Color(1, 1, 1, 0)
|
||||
main_tween.interpolate_property(character, "modulate", Color(1, 1, 1, 0), Color(1, 1, 1, 1), 0.8, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT, delay)
|
||||
main_tween.interpolate_property(character, "rect_position", Vector2(x_pos, character.rect_position.y), character.rect_position, 0.8, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT, delay)
|
||||
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
main_container.move_child(recap_container, 0)
|
||||
|
@ -60,45 +59,8 @@ func _on_mouse_entered():
|
|||
main_container.move_child(recap_container, 1)
|
||||
|
||||
|
||||
func _recover_variables():
|
||||
var definitions = Dialogic.get_definitions()
|
||||
# Get relations and gauges from variables
|
||||
for d in definitions["variables"]:
|
||||
for g in gauges_names:
|
||||
if d["name"] == GAUGE_PREFIX + g:
|
||||
gauges[g] = d
|
||||
for r in relations_names:
|
||||
if d["name"] == RELATIONS_PREFIX + r:
|
||||
relations[r] = d
|
||||
for c in choices_names:
|
||||
if d["name"] == CHOICES_PREFIX + c:
|
||||
choices[c] = d
|
||||
print(gauges)
|
||||
print("--")
|
||||
print(relations)
|
||||
print("--")
|
||||
print(choices)
|
||||
|
||||
|
||||
func _get_percentages(data: Dictionary, names: Array, ranges: Array) -> Array:
|
||||
var final_array := []
|
||||
for i in range(0, data.size()):
|
||||
var val = float(data[names[i]]["value"])
|
||||
var min_max = ranges[i]
|
||||
# Adjust offset
|
||||
val -= min_max[0]
|
||||
# Get whole range
|
||||
var total_range = min_max[1] - min_max[0]
|
||||
final_array.append(100 * val / total_range)
|
||||
return final_array
|
||||
|
||||
|
||||
func _get_choices_array() -> Array:
|
||||
var final_array := []
|
||||
for i in range(0, choices.size()):
|
||||
final_array.append(choices[choices_names[i]]["value"])
|
||||
return final_array
|
||||
|
||||
|
||||
func _set_characters_relations():
|
||||
for i in range(0, relations_values.size()):
|
||||
|
@ -118,11 +80,9 @@ func _on_GaugesTimer_timeout() -> void:
|
|||
|
||||
|
||||
func _on_ChoicesTimer_timeout() -> void:
|
||||
print("timeout")
|
||||
# take spacers into account
|
||||
var c = choices_container.get_child(shown_choice_index * 2)
|
||||
if shown_choice_index < choices_values.size():
|
||||
print(choices_values[shown_choice_index / 2])
|
||||
c.choice = int(choices_values[shown_choice_index / 2])
|
||||
shown_choice_index += 1
|
||||
if shown_choice_index >= choices_container.get_child_count():
|
||||
|
|
|
@ -167,6 +167,9 @@ margin_right = 248.0
|
|||
margin_bottom = 337.0
|
||||
gauge_name = "Travail"
|
||||
gauge_color = Color( 0.576471, 0.345098, 0.313726, 1 )
|
||||
description_bad = "Le travail n’est pas une valeur au centre de vos priorités et vous vous laissez facilement distraire. Vous préférez profiter de la vie et saisir les opportunités qui se présentent à vous parfois en dépit de votre travail."
|
||||
description_neutral = "Pour vous le travail est une valeur importante mais pas capitale. Vous avez à cœur de vous investir et de mener à bien vos projets mais vous vous laissez parfois distraire. "
|
||||
description_good = "Prioriser le travail à accomplir devant toute forme de distraction est capital pour vous. Vous êtes sérieux, attentif et veillez au bon déroulement des projets auxquels vous êtes associés ce qui fait de vous un employé efficace."
|
||||
|
||||
[node name="EducationProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 252.0
|
||||
|
@ -174,6 +177,9 @@ margin_right = 372.0
|
|||
margin_bottom = 337.0
|
||||
gauge_name = "Éducation"
|
||||
gauge_color = Color( 0.0627451, 0.764706, 0.933333, 1 )
|
||||
description_bad = "Vous vous contentez des connaissances apportées par votre environnement et ne cherchez pas à approfondir certains sujets."
|
||||
description_neutral = "Être curieux et apprendre de nouvelles choses est quelque chose d’important pour vous mais vous vous contentez parfois de vos connaissances sans chercher à en apprendre d’avantage."
|
||||
description_good = "Vous n'hésitez pas à vous nourrir des informations à votre portée. Vous appréciez vous former par vous même sur des sujets qui vous intéressent mais aussi apprendre des autres qui sont pour vous une source inépuisable de savoir."
|
||||
|
||||
[node name="FinancesProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 376.0
|
||||
|
@ -181,6 +187,9 @@ margin_right = 496.0
|
|||
margin_bottom = 337.0
|
||||
gauge_name = "Finances"
|
||||
gauge_color = Color( 0.996078, 0.403922, 0.2, 1 )
|
||||
description_bad = "Vous ne prêtez pas attention à l’argent et ne basez pas vos décisions sur l’aspect financier. Pour vous d’autres valeurs sont plus essentielles. Cependant, attention à ne pas oublier que l’argent reste omniprésent dans la société actuelle. "
|
||||
description_neutral = "Pour vous l’argent est un moyen de réaliser vos projets mais n’est pas une fin en soi. Vous êtes conscient qu’il a une place importante autant dans la société que dans le monde du travail mais ne basez pas toutes vos décisions dans ce sens. "
|
||||
description_good = "Vous veillez à mettre votre santé financière ou bien celle de votre entreprise au premier plan. Pour vous, l’argent a une place importante autant dans la société que dans le monde du travail et en posséder représente un avantage de taille."
|
||||
|
||||
[node name="EcologyProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 500.0
|
||||
|
@ -188,6 +197,9 @@ margin_right = 620.0
|
|||
margin_bottom = 337.0
|
||||
gauge_name = "Écologie"
|
||||
gauge_color = Color( 0.984314, 0.752941, 0.156863, 1 )
|
||||
description_bad = "Pour vous les enjeux autour de la protection de l’environnement et de l’écologie ne sont pas capitaux et d’actualité. Selon vous, il y a d’autres problèmes plus majeurs à prioriser. "
|
||||
description_neutral = "Vous êtes conscient de l’importance des enjeux concernant la protection de l’environnement et l’écologie. Vous faites votre maximum pour adopter un mode de vie éco-responsable mais vous avez parfois des difficultés à réaliser ces objectifs."
|
||||
description_good = "L’écologie est importante pour vous et vous avez à cœur de prendre des décisions qui permettent un avancement concernant la protection de l’environnement. Vous valorisez un mode de vie éco-responsable et essayez au maximum de sensibiliser vos collègues et amis à ce sujet."
|
||||
|
||||
[node name="SocialProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 624.0
|
||||
|
@ -195,6 +207,9 @@ margin_right = 744.0
|
|||
margin_bottom = 337.0
|
||||
gauge_name = "Social"
|
||||
gauge_color = Color( 0.839216, 0.556863, 0.192157, 1 )
|
||||
description_bad = " Vous êtes un loup solitaire, les relations sociales ne sont pas votre priorité. Vous accordez plus d’importance à d’autres aspects de la vie et du travail qu’à l’entretien de relations qu’elles soient amicales ou avec vos collègues."
|
||||
description_neutral = "Vous prêtez attention aux personnes qui vous entourent et leur bien-être vous importe. Vous veillez à ce que vos relations, aussi bien avec vos collègues de travail qu’avec vos relations personnelles, restent cordiales."
|
||||
description_good = "Le bien-être et le respect d’autrui ont été au centre de vos choix. Vous prêtez beaucoup attention aux personnes qui vous entourent et vous veillez à développer au maximum vos relations, aussi bien avec vos collègues de travail qu’avec vos relations personnelles."
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
margin_top = 467.0
|
||||
|
@ -202,11 +217,11 @@ margin_right = 872.0
|
|||
margin_bottom = 519.0
|
||||
|
||||
[node name="ExitButton" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource( 4 )]
|
||||
margin_left = 269.0
|
||||
margin_left = 321.0
|
||||
margin_top = 0.0
|
||||
margin_right = 603.0
|
||||
margin_right = 550.0
|
||||
margin_bottom = 52.0
|
||||
text = "Sauvegarder et quitter"
|
||||
text = "Menu Principal"
|
||||
|
||||
[node name="SpacerRight" type="Control" parent="VBoxContainer/Control/RecapContainer"]
|
||||
margin_left = 1520.0
|
||||
|
@ -257,6 +272,8 @@ description_bad = "bad"
|
|||
description_neutral = "neutral"
|
||||
description_good = "good"
|
||||
|
||||
[node name="Tween" type="Tween" parent="VBoxContainer/Control"]
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_top = 850.0
|
||||
margin_right = 1920.0
|
||||
|
@ -309,7 +326,9 @@ margin_top = 0.0
|
|||
margin_right = 150.0
|
||||
margin_bottom = 200.0
|
||||
rect_rotation = 0.0
|
||||
dilemma_name = "Dilemma 1"
|
||||
dilemma_name = "Dilemme 1"
|
||||
choices_names = [ "Téléphone fermé", "Téléphone ouvert" ]
|
||||
choices_descriptions = [ "Vous avez choisi de faire en sorte que l’utilisateur ne puisse pas avoir accès aux composants de son téléphone. Cela permet de développer un téléphone toujours plus innovant et à la pointe de la technologie qui serait donc très attractif sur le marché. De plus, les utilisateurs n’ayant pas la possibilité de réparer leur téléphones, ils se tourneront plus facilement vers des modèles neufs ce qui peut générer plus de chiffre d'affaires pour l’entreprise. En revanche, cela encourage la surconsommation qui a un impact désastreux sur l’environnement. Lors de la phase utilisateur il vous a donc été plus difficile de remplacer votre écran cassé, cependant, parmi vos amis vous aviez le téléphone le plus esthétique.", "Vous avez choisi de faire en sorte que l’utilisateur puisse ouvrir son téléphone. Cela permet donc d’encourager le remplacement et le recyclage de pièces,d’aller à l’encontre de la surconsommation et de promouvoir une image éco-responsable pour l’entreprise. En revanche, cela signifie aussi renoncer à certaines innovations non compatibles avec le fait que le téléphone puisse s’ouvrir et renoncer à une certaine part de marché habitué aux innovations. Lors de la phase utilisateur il vous a donc été plus simple de remplacer votre écran cassé , cependant, parmi vos amis vous n’aviez pas le téléphone le plus esthétique." ]
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2"]
|
||||
margin_left = 154.0
|
||||
|
@ -323,7 +342,7 @@ margin_top = 0.0
|
|||
margin_right = 815.0
|
||||
margin_bottom = 200.0
|
||||
rect_rotation = 0.0
|
||||
dilemma_name = "Dilemma 2"
|
||||
dilemma_name = "Dilemme 2"
|
||||
|
||||
[node name="Spacer2" type="Control" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2"]
|
||||
margin_left = 819.0
|
||||
|
@ -337,7 +356,7 @@ margin_top = 0.0
|
|||
margin_right = 1480.0
|
||||
margin_bottom = 200.0
|
||||
rect_rotation = 0.0
|
||||
dilemma_name = "Dilemma 2"
|
||||
dilemma_name = "Dilemme 3"
|
||||
|
||||
[node name="GaugesTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
|
|
|
@ -4,6 +4,9 @@ var selection_object: Control
|
|||
var infobox_position := "left"
|
||||
|
||||
|
||||
var info_panel_height := 200.0 setget set_info_panel_height
|
||||
|
||||
|
||||
onready var hover_tween = $HoverTween
|
||||
onready var info_panel = $Control/InfoPanel
|
||||
|
||||
|
@ -13,6 +16,7 @@ func _ready():
|
|||
connect("mouse_entered", self, '_on_mouse_entered')
|
||||
connect("mouse_exited", self, '_on_mouse_exited')
|
||||
hover_tween.connect("tween_completed", self, "_on_HoverTween_tween_completed")
|
||||
info_panel.rect_size.y = info_panel_height
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
|
@ -56,3 +60,7 @@ func _on_HoverTween_tween_completed(object: Object, key: NodePath):
|
|||
if object == info_panel and info_panel.modulate == Color(1, 1, 1, 0):
|
||||
info_panel.hide()
|
||||
|
||||
|
||||
func set_info_panel_height(new_value: float):
|
||||
info_panel_height = new_value
|
||||
info_panel.rect_size.y = info_panel_height
|
||||
|
|
|
@ -42,8 +42,8 @@ __meta__ = {
|
|||
[node name="InfoPanel" parent="Control" instance=ExtResource( 1 )]
|
||||
visible = false
|
||||
margin_left = 960.0
|
||||
margin_right = 1320.0
|
||||
margin_bottom = 360.0
|
||||
margin_right = 1360.0
|
||||
size_flags_vertical = 3
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
|
||||
[node name="HoverTween" type="Tween" parent="."]
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Bold.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Regular.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://fonts/PanelTitleFont.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://fonts/PanelContentFont.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://scenes/end-screen/InfoPanel.gd" type="Script" id=3]
|
||||
[ext_resource path="res://styles/Panel.tres" type="StyleBox" id=4]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 30
|
||||
outline_size = 3
|
||||
outline_color = Color( 0.384314, 0.380392, 0.380392, 1 )
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
outline_size = 1
|
||||
outline_color = Color( 0.384314, 0.380392, 0.380392, 1 )
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="InfoPanel" type="Panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 200.0
|
||||
rect_min_size = Vector2( 400, 300 )
|
||||
mouse_filter = 2
|
||||
custom_styles/panel = ExtResource( 4 )
|
||||
script = ExtResource( 3 )
|
||||
|
@ -41,14 +31,14 @@ __meta__ = {
|
|||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 1900.0
|
||||
margin_bottom = 1060.0
|
||||
margin_right = 380.0
|
||||
margin_bottom = 280.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 1880.0
|
||||
margin_right = 360.0
|
||||
margin_bottom = 42.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Title"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
|
@ -57,12 +47,13 @@ __meta__ = {
|
|||
|
||||
[node name="Content" type="RichTextLabel" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 46.0
|
||||
margin_right = 1880.0
|
||||
margin_bottom = 1040.0
|
||||
margin_right = 360.0
|
||||
margin_bottom = 260.0
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 3
|
||||
custom_fonts/normal_font = SubResource( 2 )
|
||||
custom_fonts/normal_font = ExtResource( 2 )
|
||||
text = "Content"
|
||||
scroll_active = false
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
|
63
util/StatsHandler.gd
Normal file
63
util/StatsHandler.gd
Normal file
|
@ -0,0 +1,63 @@
|
|||
extends Control
|
||||
|
||||
var GAUGE_PREFIX = "jauge_"
|
||||
var RELATIONS_PREFIX = "relation_"
|
||||
var CHOICES_PREFIX = "choix_"
|
||||
|
||||
var gauges_names := ["travail", "education", "financier", "ecologie", "social"]
|
||||
var relations_names := ["evelyne", "jm"]
|
||||
var choices_names := ["tel_ouvert", "mdr"]
|
||||
|
||||
var gauges_ranges := [[-11, 14], [-9, 23], [-23, 24], [-13, 16], [-16, 17]]
|
||||
var relations_ranges := [[-5, 6], [-3, 5]]
|
||||
|
||||
var gauges_values := []
|
||||
var relations_values := []
|
||||
var choices_values := []
|
||||
|
||||
var gauges := {}
|
||||
var relations := {}
|
||||
var choices := {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_recover_variables()
|
||||
gauges_values = _get_percentages(gauges, gauges_names, gauges_ranges)
|
||||
relations_values = _get_percentages(relations, relations_names, relations_ranges)
|
||||
choices_values = _get_choices_array()
|
||||
|
||||
|
||||
func _recover_variables():
|
||||
var definitions = Dialogic.get_definitions()
|
||||
# Get relations and gauges from variables
|
||||
for d in definitions["variables"]:
|
||||
for g in gauges_names:
|
||||
if d["name"] == GAUGE_PREFIX + g:
|
||||
gauges[g] = d
|
||||
for r in relations_names:
|
||||
if d["name"] == RELATIONS_PREFIX + r:
|
||||
relations[r] = d
|
||||
for c in choices_names:
|
||||
if d["name"] == CHOICES_PREFIX + c:
|
||||
choices[c] = d
|
||||
print(choices)
|
||||
|
||||
|
||||
func _get_percentages(data: Dictionary, names: Array, ranges: Array) -> Array:
|
||||
var final_array := []
|
||||
for i in range(0, data.size()):
|
||||
var val = float(data[names[i]]["value"])
|
||||
var min_max = ranges[i]
|
||||
# Adjust offset
|
||||
val -= min_max[0]
|
||||
# Get whole range
|
||||
var total_range = min_max[1] - min_max[0]
|
||||
final_array.append(100 * val / total_range)
|
||||
return final_array
|
||||
|
||||
|
||||
func _get_choices_array() -> Array:
|
||||
var final_array := []
|
||||
for i in range(0, choices.size()):
|
||||
final_array.append(choices[choices_names[i]]["value"])
|
||||
return final_array
|
Loading…
Reference in a new issue