add basic infoboxes
This commit is contained in:
parent
b6c0618883
commit
a6738f2ff6
12 changed files with 352 additions and 108 deletions
|
@ -3,25 +3,26 @@ extends Control
|
|||
|
||||
export(String) var choice_name = ""
|
||||
export(String) var dilemma_name = ""
|
||||
export(String) var dilemma_description = ""
|
||||
export(float) var deferred_show = 0
|
||||
|
||||
onready var tween = $Tween
|
||||
onready var hover_tween = $HoverTween
|
||||
onready var hover_control = $HoverControl
|
||||
onready var timer = $Timer
|
||||
onready var container = $VBoxContainer
|
||||
onready var choice_label = $VBoxContainer/ChoiceLabel
|
||||
onready var dilemma_label = $VBoxContainer/DilemmaLabel
|
||||
onready var texture = $VBoxContainer/TextureRect
|
||||
onready var button = $TextureButton
|
||||
|
||||
|
||||
func _ready():
|
||||
button.connect("mouse_entered", self, '_on_mouse_entered')
|
||||
button.connect("mouse_exited", self, '_on_mouse_exited')
|
||||
button.connect("pressed", self, '_on_button_pressed')
|
||||
container.hide()
|
||||
choice_label.text = choice_name
|
||||
dilemma_label.text = dilemma_name
|
||||
hover_control.selection_object = texture
|
||||
hover_control.infobox_position = "top"
|
||||
hover_control.info_panel.title = dilemma_name
|
||||
hover_control.info_panel.content = dilemma_description
|
||||
|
||||
tween.interpolate_property(container, "rect_scale", Vector2(0, 0), Vector2(1, 1), 1, Tween.TRANS_ELASTIC, Tween.EASE_IN_OUT)
|
||||
tween.interpolate_property(container, "rect_position", Vector2(75, 75), Vector2(0, 0), 1, Tween.TRANS_ELASTIC, Tween.EASE_IN_OUT)
|
||||
|
@ -38,19 +39,8 @@ func start_anim():
|
|||
container.show()
|
||||
tween.start()
|
||||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
start_anim()
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
hover_tween.interpolate_property(texture, "modulate", null, Color(1, 1, 1, 1), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
hover_tween.interpolate_property(texture, "modulate", null, Color("#615ea4"), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
print("pressed")
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://images/end-circle.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/end-screen/ChoiceCircle.gd" type="Script" id=2]
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Regular.ttf" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://scenes/end-screen/HoverControl.tscn" type="PackedScene" id=4]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 20
|
||||
font_data = ExtResource( 3 )
|
||||
|
||||
[node name="ChoiceCircle" type="Control"]
|
||||
margin_right = 150.0
|
||||
margin_bottom = 150.0
|
||||
margin_left = 500.0
|
||||
margin_top = 500.0
|
||||
margin_right = 650.0
|
||||
margin_bottom = 700.0
|
||||
rect_min_size = Vector2( 150, 200 )
|
||||
rect_rotation = -0.0875701
|
||||
script = ExtResource( 2 )
|
||||
|
@ -53,16 +56,8 @@ align = 1
|
|||
|
||||
[node name="Tween" type="Tween" parent="."]
|
||||
|
||||
[node name="HoverTween" type="Tween" parent="."]
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_default_cursor_shape = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[node name="HoverControl" parent="." instance=ExtResource( 4 )]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
|
|
@ -1,28 +1,22 @@
|
|||
extends Control
|
||||
|
||||
export(String) var title := ""
|
||||
export(String) var description := ""
|
||||
export(Texture) var texture_normal
|
||||
export(Texture) var texture_hover
|
||||
export(bool) var is_left := true
|
||||
|
||||
onready var button = $TextureButton
|
||||
onready var hover_tween = $HoverTween
|
||||
onready var hover_control = $HoverControl
|
||||
|
||||
func _ready():
|
||||
button.texture_normal = texture_normal
|
||||
button.texture_hover = texture_hover
|
||||
button.connect("mouse_entered", self, '_on_mouse_entered')
|
||||
button.connect("mouse_exited", self, '_on_mouse_exited')
|
||||
button.connect("pressed", self, '_on_button_pressed')
|
||||
hover_control.selection_object = button
|
||||
if is_left:
|
||||
hover_control.infobox_position = "right"
|
||||
else:
|
||||
hover_control.infobox_position = "left"
|
||||
hover_control.info_panel.title = title
|
||||
hover_control.info_panel.content = description
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
hover_tween.interpolate_property(button, "modulate", null, Color(1, 1, 1, 1), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
hover_tween.interpolate_property(button, "modulate", null, Color("#615ea4"), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
print("pressed")
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://characters/Evelyne/evelyne_neutre.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/end-screen/EndCharacter.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scenes/end-screen/HoverControl.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="EndCharacter" type="Control"]
|
||||
margin_right = 400.0
|
||||
|
@ -24,3 +25,5 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="HoverTween" type="Tween" parent="."]
|
||||
|
||||
[node name="HoverControl" parent="." instance=ExtResource( 3 )]
|
||||
|
|
|
@ -18,12 +18,16 @@ var gauges := {}
|
|||
var relations := {}
|
||||
var choices := {}
|
||||
|
||||
onready var progress_container = $VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer
|
||||
onready var progress_container = $VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer
|
||||
onready var main_container = $VBoxContainer/Control
|
||||
onready var recap_container = $VBoxContainer/Control/RecapContainer
|
||||
onready var gauges_timer = $GaugesTimer
|
||||
|
||||
var shown_gauge_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)
|
||||
|
@ -34,6 +38,16 @@ func _ready():
|
|||
gauges_timer.start()
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
main_container.move_child(recap_container, 0)
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
# Make sure the recap is behind the characters
|
||||
# This allows showing the infobox above the recap
|
||||
main_container.move_child(recap_container, 1)
|
||||
|
||||
|
||||
func _recover_variables():
|
||||
var definitions = Dialogic.get_definitions()
|
||||
# Get relations and gauges from variables
|
||||
|
|
|
@ -90,37 +90,52 @@ custom_fonts/font = SubResource( 2 )
|
|||
text = "Serious Game on Ethics"
|
||||
align = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
[node name="Control" type="Control" parent="VBoxContainer"]
|
||||
margin_top = 187.0
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 846.0
|
||||
mouse_filter = 1
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Evelyne" parent="VBoxContainer/HBoxContainer" instance=ExtResource( 6 )]
|
||||
texture_normal = ExtResource( 12 )
|
||||
texture_hover = ExtResource( 11 )
|
||||
[node name="RecapContainer" type="HBoxContainer" parent="VBoxContainer/Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
[node name="SpacerLeft" type="Control" parent="VBoxContainer/Control/RecapContainer"]
|
||||
margin_right = 400.0
|
||||
margin_bottom = 659.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Control/RecapContainer"]
|
||||
margin_left = 404.0
|
||||
margin_right = 1516.0
|
||||
margin_bottom = 659.0
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/margin_right = 100
|
||||
custom_constants/margin_top = 50
|
||||
custom_constants/margin_left = 100
|
||||
custom_constants/margin_bottom = 50
|
||||
|
||||
[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer/MarginContainer"]
|
||||
[node name="Panel" type="Panel" parent="VBoxContainer/Control/RecapContainer/MarginContainer"]
|
||||
margin_left = 100.0
|
||||
margin_top = 50.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 609.0
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 1
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
|
@ -129,7 +144,7 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 892.0
|
||||
|
@ -138,80 +153,119 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
margin_right = 872.0
|
||||
margin_bottom = 42.0
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
text = "Récapitulatif"
|
||||
align = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
margin_top = 46.0
|
||||
margin_right = 872.0
|
||||
margin_bottom = 463.0
|
||||
mouse_filter = 1
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_top = 40
|
||||
custom_constants/margin_bottom = 40
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer"]
|
||||
[node name="GaugesContainer" type="HBoxContainer" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer"]
|
||||
margin_top = 40.0
|
||||
margin_right = 872.0
|
||||
margin_bottom = 377.0
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="WorkProgress" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer" instance=ExtResource( 9 )]
|
||||
[node name="WorkProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 128.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 337.0
|
||||
gauge_name = "Travail"
|
||||
gauge_description = "ceci est un test"
|
||||
gauge_color = Color( 0.576471, 0.345098, 0.313726, 1 )
|
||||
|
||||
[node name="EducationProgress" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer" instance=ExtResource( 9 )]
|
||||
[node name="EducationProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 252.0
|
||||
margin_right = 372.0
|
||||
margin_bottom = 337.0
|
||||
gauge_name = "Éducation"
|
||||
gauge_color = Color( 0.0627451, 0.764706, 0.933333, 1 )
|
||||
|
||||
[node name="FinancesProgress" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer" instance=ExtResource( 9 )]
|
||||
[node name="FinancesProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 376.0
|
||||
margin_right = 496.0
|
||||
margin_bottom = 337.0
|
||||
gauge_name = "Finances"
|
||||
gauge_color = Color( 0.996078, 0.403922, 0.2, 1 )
|
||||
|
||||
[node name="EcologyProgress" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer" instance=ExtResource( 9 )]
|
||||
[node name="EcologyProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 500.0
|
||||
margin_right = 620.0
|
||||
margin_bottom = 337.0
|
||||
gauge_name = "Écologie"
|
||||
gauge_color = Color( 0.984314, 0.752941, 0.156863, 1 )
|
||||
|
||||
[node name="SocialProgress" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer" instance=ExtResource( 9 )]
|
||||
[node name="SocialProgress" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/MarginContainer/GaugesContainer" instance=ExtResource( 9 )]
|
||||
margin_left = 624.0
|
||||
margin_right = 744.0
|
||||
margin_bottom = 337.0
|
||||
gauge_name = "Social"
|
||||
gauge_color = Color( 0.839216, 0.556863, 0.192157, 1 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
margin_top = 467.0
|
||||
margin_right = 872.0
|
||||
margin_bottom = 519.0
|
||||
|
||||
[node name="ExitButton" parent="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource( 4 )]
|
||||
[node name="ExitButton" parent="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource( 4 )]
|
||||
margin_left = 269.0
|
||||
margin_top = 0.0
|
||||
margin_right = 603.0
|
||||
margin_bottom = 52.0
|
||||
text = "Sauvegarder et quitter"
|
||||
|
||||
[node name="JM" parent="VBoxContainer/HBoxContainer" instance=ExtResource( 6 )]
|
||||
[node name="SpacerRight" type="Control" parent="VBoxContainer/Control/RecapContainer"]
|
||||
margin_left = 1520.0
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 659.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CharactersContainer" type="HBoxContainer" parent="VBoxContainer/Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Evelyne" parent="VBoxContainer/Control/CharactersContainer" instance=ExtResource( 6 )]
|
||||
title = "Evelyne"
|
||||
description = "Elle est cool"
|
||||
texture_normal = ExtResource( 12 )
|
||||
texture_hover = ExtResource( 11 )
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/Control/CharactersContainer"]
|
||||
margin_left = 404.0
|
||||
margin_right = 1516.0
|
||||
margin_bottom = 659.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="JM" parent="VBoxContainer/Control/CharactersContainer" instance=ExtResource( 6 )]
|
||||
margin_left = 1520.0
|
||||
margin_right = 1920.0
|
||||
title = "Jen-Michel"
|
||||
description = "il est méchant"
|
||||
texture_normal = ExtResource( 13 )
|
||||
texture_hover = ExtResource( 5 )
|
||||
is_left = false
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_top = 850.0
|
||||
|
@ -226,15 +280,15 @@ color = Color( 0, 0, 0, 0.478431 )
|
|||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/MarginContainer"]
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 230.0
|
||||
custom_constants/margin_right = 100
|
||||
custom_constants/margin_right = 220
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 100
|
||||
custom_constants/margin_left = 220
|
||||
custom_constants/margin_bottom = 10
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/MarginContainer/MarginContainer"]
|
||||
margin_left = 100.0
|
||||
margin_left = 220.0
|
||||
margin_top = 20.0
|
||||
margin_right = 1820.0
|
||||
margin_right = 1700.0
|
||||
margin_bottom = 220.0
|
||||
custom_constants/margin_right = 75
|
||||
custom_constants/margin_top = 70
|
||||
|
@ -245,21 +299,24 @@ custom_constants/margin_bottom = 70
|
|||
anchor_right = 0.0
|
||||
margin_left = 75.0
|
||||
margin_top = 70.0
|
||||
margin_right = 1645.0
|
||||
margin_right = 1405.0
|
||||
margin_bottom = 130.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/MarginContainer/MarginContainer"]
|
||||
margin_left = 100.0
|
||||
margin_left = 220.0
|
||||
margin_top = 20.0
|
||||
margin_right = 1820.0
|
||||
margin_right = 1700.0
|
||||
margin_bottom = 220.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ChoiceCircle" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2" instance=ExtResource( 7 )]
|
||||
margin_left = 0.0
|
||||
margin_top = 0.0
|
||||
margin_right = 150.0
|
||||
margin_bottom = 200.0
|
||||
rect_rotation = 0.0
|
||||
choice_name = "Choice 1"
|
||||
|
@ -267,13 +324,14 @@ dilemma_name = "Dilemma 1"
|
|||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2"]
|
||||
margin_left = 154.0
|
||||
margin_right = 781.0
|
||||
margin_right = 661.0
|
||||
margin_bottom = 200.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ChoiceCircle2" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2" instance=ExtResource( 7 )]
|
||||
margin_left = 785.0
|
||||
margin_right = 935.0
|
||||
margin_left = 665.0
|
||||
margin_top = 0.0
|
||||
margin_right = 815.0
|
||||
margin_bottom = 200.0
|
||||
rect_rotation = 0.0
|
||||
choice_name = "Choice 2"
|
||||
|
@ -281,14 +339,15 @@ dilemma_name = "Dilemma 2"
|
|||
deferred_show = 0.3
|
||||
|
||||
[node name="Spacer2" type="Control" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2"]
|
||||
margin_left = 939.0
|
||||
margin_right = 1566.0
|
||||
margin_left = 819.0
|
||||
margin_right = 1326.0
|
||||
margin_bottom = 200.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ChoiceCircle3" parent="VBoxContainer/MarginContainer/MarginContainer/HBoxContainer2" instance=ExtResource( 7 )]
|
||||
margin_left = 1570.0
|
||||
margin_right = 1720.0
|
||||
margin_left = 1330.0
|
||||
margin_top = 0.0
|
||||
margin_right = 1480.0
|
||||
margin_bottom = 200.0
|
||||
rect_rotation = 0.0
|
||||
choice_name = "Choice 3"
|
||||
|
@ -297,5 +356,5 @@ deferred_show = 0.7
|
|||
|
||||
[node name="GaugesTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/CenterContainer/ExitButton" to="." method="_on_ExitButton_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Control/RecapContainer/MarginContainer/Panel/MarginContainer/VBoxContainer/CenterContainer/ExitButton" to="." method="_on_ExitButton_pressed"]
|
||||
[connection signal="timeout" from="GaugesTimer" to="." method="_on_GaugesTimer_timeout"]
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
extends MarginContainer
|
||||
|
||||
export(String) var gauge_name = ""
|
||||
export(String) var gauge_description = ""
|
||||
export(Color) var gauge_color = Color.white
|
||||
|
||||
var progress : float = 0 setget set_progress
|
||||
|
||||
onready var tween = $Tween
|
||||
onready var hover_tween = $HoverTween
|
||||
onready var hover_control = $HoverControl
|
||||
onready var container = $VBoxContainer
|
||||
onready var progress_bar = $VBoxContainer/ProgressBar
|
||||
onready var label = $VBoxContainer/Label
|
||||
onready var button = $TextureButton
|
||||
|
||||
|
||||
func _ready():
|
||||
button.connect("mouse_entered", self, '_on_mouse_entered')
|
||||
button.connect("mouse_exited", self, '_on_mouse_exited')
|
||||
button.connect("pressed", self, '_on_button_pressed')
|
||||
|
||||
container.hide()
|
||||
hover_control.selection_object = progress_bar
|
||||
hover_control.infobox_position = "left"
|
||||
hover_control.info_panel.title = gauge_name
|
||||
hover_control.info_panel.content = gauge_description
|
||||
label.text = gauge_name
|
||||
progress_bar.tint_progress = gauge_color
|
||||
container.modulate = Color(1, 1, 1, 0)
|
||||
|
@ -33,17 +34,3 @@ func set_progress(new_value: float):
|
|||
tween.interpolate_property(progress_bar, "value", 0, progress, 1.5, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
tween.interpolate_property(container, "modulate", Color(1, 1, 1, 0), Color(1, 1, 1, 1), 1, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
start_anim()
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
hover_tween.interpolate_property(progress_bar, "tint_progress", null, gauge_color, 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
hover_tween.interpolate_property(progress_bar, "tint_progress", null, Color("#615ea4"), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
print("pressed")
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://images/end-progress.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/end-screen/GaugeProgress.gd" type="Script" id=2]
|
||||
[ext_resource path="res://fonts/open-sans/OpenSans-Regular.ttf" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://scenes/end-screen/HoverControl.tscn" type="PackedScene" id=4]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
font_data = ExtResource( 3 )
|
||||
|
@ -47,10 +48,9 @@ align = 1
|
|||
|
||||
[node name="Tween" type="Tween" parent="."]
|
||||
|
||||
[node name="HoverTween" type="Tween" parent="."]
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="."]
|
||||
[node name="HoverControl" parent="." instance=ExtResource( 4 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 20.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 473.0
|
||||
mouse_default_cursor_shape = 2
|
||||
|
|
51
scenes/end-screen/HoverControl.gd
Normal file
51
scenes/end-screen/HoverControl.gd
Normal file
|
@ -0,0 +1,51 @@
|
|||
extends Control
|
||||
|
||||
var selection_object: Control
|
||||
var infobox_position := "left"
|
||||
|
||||
|
||||
onready var hover_tween = $HoverTween
|
||||
onready var info_panel = $Control/InfoPanel
|
||||
|
||||
|
||||
func _ready():
|
||||
info_panel.modulate = Color(1, 1, 1, 0)
|
||||
connect("mouse_entered", self, '_on_mouse_entered')
|
||||
connect("mouse_exited", self, '_on_mouse_exited')
|
||||
hover_tween.connect("tween_completed", self, "_on_HoverTween_tween_completed")
|
||||
|
||||
|
||||
func _on_mouse_exited():
|
||||
hover_tween.interpolate_property(selection_object, "modulate", null, Color(1, 1, 1, 1), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.interpolate_property(info_panel, "modulate", null, Color(1, 1, 1, 0), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func _on_mouse_entered():
|
||||
set_infobox_position()
|
||||
info_panel.show()
|
||||
hover_tween.stop_all()
|
||||
hover_tween.interpolate_property(selection_object, "modulate", null, Color("#615ea4"), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.interpolate_property(info_panel, "modulate", null, Color(1, 1, 1, 1), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||
hover_tween.start()
|
||||
|
||||
|
||||
func set_infobox_position():
|
||||
var s = rect_size
|
||||
var info_s = info_panel.rect_size
|
||||
var offset = 30
|
||||
match infobox_position:
|
||||
"top":
|
||||
info_panel.rect_position = Vector2((s.x - info_s.x)/2, -(info_s.y + offset))
|
||||
"bottom":
|
||||
info_panel.rect_position = Vector2((s.x - info_s.x)/2, s.y + offset)
|
||||
"left":
|
||||
info_panel.rect_position = Vector2(-(info_s.x + offset), (s.y - info_s.y)/2)
|
||||
"right":
|
||||
info_panel.rect_position = Vector2(s.x + offset, (s.y - info_s.y)/2)
|
||||
|
||||
|
||||
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()
|
||||
|
49
scenes/end-screen/HoverControl.tscn
Normal file
49
scenes/end-screen/HoverControl.tscn
Normal file
|
@ -0,0 +1,49 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/end-screen/InfoPanel.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/end-screen/HoverControl.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
content_margin_left = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color( 0.160784, 0.152941, 0.180392, 1 )
|
||||
border_width_left = 4
|
||||
border_width_top = 4
|
||||
border_width_right = 4
|
||||
border_width_bottom = 4
|
||||
corner_radius_top_left = 10
|
||||
corner_radius_top_right = 10
|
||||
corner_radius_bottom_right = 10
|
||||
corner_radius_bottom_left = 10
|
||||
shadow_color = Color( 0, 0, 0, 0.392157 )
|
||||
shadow_size = 40
|
||||
shadow_offset = Vector2( 10, 10 )
|
||||
|
||||
[node name="HoverControl" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 1
|
||||
mouse_default_cursor_shape = 2
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="InfoPanel" parent="Control" instance=ExtResource( 1 )]
|
||||
visible = false
|
||||
margin_left = 960.0
|
||||
margin_right = 1320.0
|
||||
margin_bottom = 360.0
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
|
||||
[node name="HoverTween" type="Tween" parent="."]
|
17
scenes/end-screen/InfoPanel.gd
Normal file
17
scenes/end-screen/InfoPanel.gd
Normal file
|
@ -0,0 +1,17 @@
|
|||
extends Panel
|
||||
|
||||
var title := "" setget set_title
|
||||
var content := "" setget set_content
|
||||
|
||||
onready var title_label = $MarginContainer/VBoxContainer/Title
|
||||
onready var content_label = $MarginContainer/VBoxContainer/Content
|
||||
|
||||
func set_title(new_value: String):
|
||||
title = new_value
|
||||
title_label.text = title
|
||||
print(title)
|
||||
|
||||
|
||||
func set_content(new_value: String):
|
||||
content = new_value
|
||||
content_label.text = content
|
85
scenes/end-screen/InfoPanel.tscn
Normal file
85
scenes/end-screen/InfoPanel.tscn
Normal file
|
@ -0,0 +1,85 @@
|
|||
[gd_scene load_steps=7 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://scenes/end-screen/InfoPanel.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
content_margin_left = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color( 0.160784, 0.152941, 0.180392, 1 )
|
||||
border_width_left = 4
|
||||
border_width_top = 4
|
||||
border_width_right = 4
|
||||
border_width_bottom = 4
|
||||
corner_radius_top_left = 10
|
||||
corner_radius_top_right = 10
|
||||
corner_radius_bottom_right = 10
|
||||
corner_radius_bottom_left = 10
|
||||
shadow_color = Color( 0, 0, 0, 0.392157 )
|
||||
shadow_size = 40
|
||||
shadow_offset = Vector2( 10, 10 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 30
|
||||
outline_size = 3
|
||||
outline_color = Color( 0.384314, 0.380392, 0.380392, 1 )
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
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
|
||||
mouse_filter = 2
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
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"]
|
||||
margin_left = 20.0
|
||||
margin_top = 20.0
|
||||
margin_right = 1900.0
|
||||
margin_bottom = 1060.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 1880.0
|
||||
margin_bottom = 42.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "Title"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Content" type="RichTextLabel" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 46.0
|
||||
margin_right = 1880.0
|
||||
margin_bottom = 1040.0
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 3
|
||||
custom_fonts/normal_font = SubResource( 3 )
|
||||
text = "Content"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
Loading…
Reference in a new issue