Issue 336 (#380)

Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
Co-authored-by: dploeger <dploeger@users.noreply.github.com>
This commit is contained in:
Dennis Ploeger
2021-08-30 20:57:25 +02:00
committed by GitHub
parent 3b36031f24
commit 3dc779311c
35 changed files with 389 additions and 254 deletions

View File

@@ -18,6 +18,7 @@ func _test_basic() -> bool:
>
say player "Test5"
say player "Test 6"
say player TEST:"Test 7"
"""
var script = escoria.esc_compiler.compile(esc.split("\n"))
@@ -70,12 +71,17 @@ func _test_basic() -> bool:
subject = script.events["test"].statements[1]
assert(subject is ESCGroup)
assert(subject.statements.size() == 2)
assert(subject.statements.size() == 3)
subject = script.events["test"].statements[1].statements[1]
assert(subject is ESCCommand)
assert(subject.name == "say")
assert(subject.parameters[1] == "Test 6")
assert(subject.parameters[1] == "Test 6")
subject = script.events["test"].statements[1].statements[2]
assert(subject is ESCCommand)
assert(subject.name == "say")
assert(subject.parameters[1] == "TEST:Test 7")
return true
@@ -222,6 +228,8 @@ func _test_dialog() -> bool:
- "Option 3"
>
say player "test3"
- TEST:"Option 4"
say player "test4"
!
"""
var script = escoria.esc_compiler.compile(esc.split("\n"))
@@ -230,7 +238,7 @@ func _test_dialog() -> bool:
assert(subject.size() == 1)
assert(subject[0] is ESCDialog)
assert(subject[0].options.size() == 3)
assert(subject[0].options.size() == 4)
subject = script.events["test"].statements[0].options[0]
assert(subject is ESCDialogOption)
@@ -276,6 +284,10 @@ func _test_dialog() -> bool:
assert(subject[0].statements[0] is ESCCommand)
assert(subject[0].statements[0].parameters.size() == 2)
subject = script.events["test"].statements[0].options[3]
assert(subject is ESCDialogOption)
assert(subject.option == "TEST:Option 4")
return true

View File

@@ -1,7 +1,14 @@
# `say object text [type] [avatar]`
#
# Runs the specified string as a dialog said by the object. Blocks execution
# until the dialog finishes playing. Optional parameters:
# until the dialog finishes playing.
#
# The text supports translation keys by prepending the key and separating
# it with a `:` from the text.
#
# Example: `say player ROOM1_PICTURE:"Picture's looking good."`
#
# Optional parameters:
#
# * "type" determines the type of dialog UI to use. Default value is "default"
# * "avatar" determines the avatar to use for the dialog. Default value is
@@ -64,11 +71,15 @@ func run(command_params: Array) -> int:
]
)
return ESCExecution.RC_ERROR
var _line = command_params[1]
if ":" in _line:
_line = tr(_line.split(":")[0])
escoria.dialog_player.say(
command_params[0],
dialog_scene_name,
command_params[1]
_line
)
yield(escoria.dialog_player, "dialog_line_finished")
return ESCExecution.RC_OK

View File

@@ -46,6 +46,9 @@ func _init(command_string):
parameters.append(
parameter.substr(1, parameter.length() - 2)
)
elif ":" in parameter and '"' in parameter:
quote_open = true
parameter_values.append(parameter.replace('"', ''))
elif parameter.begins_with('"'):
quote_open = true
parameter_values.append(parameter.substr(1))

View File

@@ -5,11 +5,12 @@ class_name ESCDialogOption
# Regex that matches dialog option lines
const REGEX = \
'^[^-]*- "(?<option>[^"]+)"( \\[(?<conditions>[^\\]]+)\\])?$'
'^[^-]*- (?<trans_key>[^:]+)?:?"' +\
'(?<option>[^"]+)"( \\[(?<conditions>[^\\]]+)\\])?$'
# Option displayed in the HUD
var option: String
var option: String setget ,get_option
# Conditions to show this dialog
var conditions: Array = []
@@ -23,7 +24,14 @@ func _init(option_string: String):
if option_regex.search(option_string):
for result in option_regex.search_all(option_string):
if "option" in result.names:
self.option = escoria.utils.get_re_group(result, "option")
var _trans_key = ""
if "trans_key" in result.names:
_trans_key = "%s:" % \
escoria.utils.get_re_group(result, "trans_key")
self.option = "%s%s" % [
_trans_key,
escoria.utils.get_re_group(result, "option")
]
if "conditions" in result.names:
for condition_text in escoria.utils.get_re_group(
result,
@@ -41,6 +49,12 @@ func _init(option_string: String):
)
func get_option():
if ":" in option:
return tr(option.split(":")[0])
return option
# Check, if conditions match
func is_valid() -> bool:
for condition in self.conditions:

View File

@@ -13,7 +13,7 @@ An option of an ESC dialog
### REGEX
```gdscript
const REGEX: String = "^[^-]*- \"(?<option>[^\"]+)\"( \\[(?<conditions>[^\\]]+)\\])?$"
const REGEX: String = "^[^-]*- (?<trans_key>[^:]+)?:?\"(?<option>[^\"]+)\"( \\[(?<conditions>[^\\]]+)\\])?$"
```
Regex that matches dialog option lines
@@ -26,6 +26,8 @@ Regex that matches dialog option lines
var option: String
```
- **Getter**: `get_option`
Option displayed in the HUD
### conditions
@@ -46,6 +48,12 @@ func _init(option_string: String)
Create a dialog option from a string
### get\_option
```gdscript
func get_option()
```
### is\_valid
```gdscript

View File

@@ -9,7 +9,14 @@
`say object text [type] [avatar]`
Runs the specified string as a dialog said by the object. Blocks execution
until the dialog finishes playing. Optional parameters:
until the dialog finishes playing.
The text supports translation keys by prepending the key and separating
it with a `:` from the text.
Example: `say player ROOM1_PICTURE:"Picture's looking good."`
Optional parameters:
* "type" determines the type of dialog UI to use. Default value is "default"
* "avatar" determines the avatar to use for the dialog. Default value is

View File

@@ -252,7 +252,14 @@ group or an event.
#### <a name="SayCommand.md"></a>`say object text [type] [avatar]` [API-Doc](api/SayCommand.md)
Runs the specified string as a dialog said by the object. Blocks execution
until the dialog finishes playing. Optional parameters:
until the dialog finishes playing.
The text supports translation keys by prepending the key and separating
it with a `:` from the text.
Example: `say player ROOM1_PICTURE:"Picture's looking good."`
Optional parameters:
* "type" determines the type of dialog UI to use. Default value is "default"
* "avatar" determines the avatar to use for the dialog. Default value is
@@ -373,21 +380,6 @@ Makes the `player` walk to the position `x`/`y`.
<!-- /ESCCOMMANDS -->
## Dialogs
Dialogs are specified by writing `?` with optional parameters, followed by a list of dialog options starting with `-`. Use `!` to end the dialog.
@@ -398,17 +390,19 @@ The following parameters are available:
* timeout: (default value 0) timeout to select an option. After the time has passed, the "timeout_option" will be selected automatically. If the value is 0, there's no timeout.
* timeout_option: (default value 0) index of option (starting from 1) selected when timeout is reached.
Options support translation keys by prepending and separating them with a `:` from the rest of the text.
Example:
```
# character's "talk" event
:talk
? avatar timeout timeout_option
- "I'd like to buy a map." [!player_has_map]
- MAP:"I'd like to buy a map." [!player_has_map]
say player "I'd like to buy a map"
say map_vendor "Do you know the secret code?"
?
- "Uncle Sven sends regards."
- UNCLE_SVEN:"Uncle Sven sends regards."
say player "Uncle Sven sends regards."
> [player_has_money]

View File

@@ -1,13 +1,13 @@
:look
> [eq dialog_advance 0]
say player "I don't know what that stuff is."
say player ROOM1_look_wall_item_1:"I don't know what that stuff is."
set_global dialog_advance 1
stop
> [eq dialog_advance 1]
say player "I REALLY don't know what that stuff is."
say player ROOM1_look_wall_item_2:"I REALLY don't know what that stuff is."
set_global dialog_advance 2
stop
> [eq dialog_advance 2]
say player "No, SERIOUSLY, I have no idea what that is!"
say player "Please stop asking me that!"
say player ROOM1_look_wall_item_3:"No, SERIOUSLY, I have no idea what that is!"
say player ROOM1_look_wall_item_4:"Please stop asking me that!"
stop

View File

@@ -1,13 +1,13 @@
:look
> [eq dialog_popup_advance 0]
say player "I don't know what that stuff is." dialog_box_inset
say player ROOM1_look_wall_item_1:"I don't know what that stuff is." dialog_box_inset
set_global dialog_popup_advance 1
stop
> [eq dialog_popup_advance 1]
say player "I REALLY don't know what that stuff is." dialog_box_inset
say player ROOM1_look_wall_item_2:"I REALLY don't know what that stuff is." dialog_box_inset
set_global dialog_popup_advance 2
stop
> [eq dialog_popup_advance 2]
say player "No, SERIOUSLY, I have no idea what that is!" dialog_box_inset
say player "Please stop asking me that!" dialog_box_inset
say player ROOM1_look_wall_item_3:"No, SERIOUSLY, I have no idea what that is!" dialog_box_inset
say player ROOM1_look_wall_item_4:"Please stop asking me that!" dialog_box_inset
stop

View File

@@ -13,7 +13,7 @@ say player "I don't think he'd like that."
set_global talked_once true
? res://game/characters/mark/mark_talk.tscn 5 1
- "What are you doing here?"
- ROOM6_dialog_1:"What are you doing here?"
say player "What are you doing here?"
say worker "I'm working! Can't you see that?"
say worker "My colleague is supposed to bring me an important report. And he's not coming!"
@@ -28,7 +28,7 @@ say player "I don't think he'd like that."
say worker "Eh! I'm not asking you anythin'!"
stop
!
- "I'm selling these fine leather jackets."
- ROOM6_dialog_2:"I'm selling these fine leather jackets."
say player "I'm selling these fine leather jackets."
say worker "Go away, kid."
stop

View File

@@ -1,5 +1,7 @@
keys,en,fr
ROOM1_look_wall_item_1,"I don't know what that stuff is.","Je ne sais pas ce que c'est."
ROOM1_look_wall_item_2,"I REALLY don't know what that stuff is.","Je ne sais VRAIMENT pas ce que c'est."
ROOM1_look_wall_item_3,"No, SERIOUSLY, I have no idea what that is!","Non, SÉRIEUSEMENT, je n'ai aucune idée de ce que c'est !"
ROOM1_look_wall_item_4,"Please stop asking me that!","Arrêtez de me demander !"
keys,en,fr,de
ROOM1_look_wall_item_1,"I don't know what that stuff is.","Je ne sais pas ce que c'est.","Ich habe keine Ahnung, was das ist."
ROOM1_look_wall_item_2,"I REALLY don't know what that stuff is.","Je ne sais VRAIMENT pas ce que c'est.","Ich habe WIRKLICH keine Ahnung, was das ist!"
ROOM1_look_wall_item_3,"No, SERIOUSLY, I have no idea what that is!","Non, SÉRIEUSEMENT, je n'ai aucune idée de ce que c'est !","IM ERNST! Ich habe keine Ahnung, was das ist!"
ROOM1_look_wall_item_4,"Please stop asking me that!","Arrêtez de me demander !","Bite hör' auf, mich danach zu fragen!"
ROOM6_dialog_1,"What are you doing here?","Que faites-vous ici ?","Was machst Du hier?"
ROOM6_dialog_2,"I'm selling these fine leather jackets.", "Je vends ces superbes blousons en cuir.","Ich verkaufe diese schicken Lederjacken."
1 keys en fr de
2 ROOM1_look_wall_item_1 I don't know what that stuff is. Je ne sais pas ce que c'est. Ich habe keine Ahnung, was das ist.
3 ROOM1_look_wall_item_2 I REALLY don't know what that stuff is. Je ne sais VRAIMENT pas ce que c'est. Ich habe WIRKLICH keine Ahnung, was das ist!
4 ROOM1_look_wall_item_3 No, SERIOUSLY, I have no idea what that is! Non, SÉRIEUSEMENT, je n'ai aucune idée de ce que c'est ! IM ERNST! Ich habe keine Ahnung, was das ist!
5 ROOM1_look_wall_item_4 Please stop asking me that! Arrêtez de me demander ! Bite hör' auf, mich danach zu fragen!
6 ROOM6_dialog_1 What are you doing here? Que faites-vous ici ? Was machst Du hier?
7 ROOM6_dialog_2 I'm selling these fine leather jackets. Je vends ces superbes blousons en cuir. Ich verkaufe diese schicken Lederjacken.

Binary file not shown.

View File

@@ -1,17 +1,19 @@
keys,en,fr
NEW_GAME,New game,Nouvelle partie
LOAD_GAME,Load game,Charger
OPTIONS,Options,Options
QUIT,Quit,Quitter
OPTIONS_BACK,Back,Retour
OPTIONS_LANGUAGE,Language,Langue
GENERAL_VOLUME,General,Général
MUSIC_VOLUME,Music,Musique
SOUND_VOLUME,Sound effects,Effets sonores
CANCEL,Cancel,Annuler
OK,OK,OK
ENTER_SAVE_NAME,Enter the save name:,Entrez un nom de sauvegarde
APPLY,Apply,Appliquer
CONFIRM_OVERWRITE,Overwrite the savegame?,Écraser la sauvegarde ?
YES,Yes,Oui
NO,No,Non
keys,en,fr,de
NEW_GAME,New game,Nouvelle partie,Neues Spiel
CONTINUE_GAME,Continue game,Continuer la partie,Weiterspielen
LOAD_GAME,Load game,Charger,Spiel laden
SAVE_GAME,Save game,Sauvegarder,Spiel speichern
OPTIONS,Options,Options,Einstellungen
QUIT,Quit,Quitter,Beenden
OPTIONS_BACK,Back,Retour,Zurück
OPTIONS_LANGUAGE,Language,Langue,Sprache
GENERAL_VOLUME,General,Général,Allgemein
MUSIC_VOLUME,Music,Musique,Musik
SOUND_VOLUME,Sound effects,Effets sonores,Soundeffekte
CANCEL,Cancel,Annuler,Abbrechen
OK,OK,Ok,Ok
ENTER_SAVE_NAME,Enter the save name:,Entrez un nom de sauvegarde,Bitte gib einen Namen für das Spiel ein:
APPLY,Apply,Appliquer,Anwenden
CONFIRM_OVERWRITE,Overwrite the savegame?,Écraser la sauvegarde ?,Soll das Spiel überschrieben werden?
YES,Yes,Oui,Ja
NO,No,Non,Nein
1 keys en fr de
2 NEW_GAME New game Nouvelle partie Neues Spiel
3 LOAD_GAME CONTINUE_GAME Load game Continue game Charger Continuer la partie Weiterspielen
4 OPTIONS LOAD_GAME Options Load game Options Charger Spiel laden
5 QUIT SAVE_GAME Quit Save game Quitter Sauvegarder Spiel speichern
6 OPTIONS_BACK OPTIONS Back Options Retour Options Einstellungen
7 OPTIONS_LANGUAGE QUIT Language Quit Langue Quitter Beenden
8 GENERAL_VOLUME OPTIONS_BACK General Back Général Retour Zurück
9 MUSIC_VOLUME OPTIONS_LANGUAGE Music Language Musique Langue Sprache
10 SOUND_VOLUME GENERAL_VOLUME Sound effects General Effets sonores Général Allgemein
11 CANCEL MUSIC_VOLUME Cancel Music Annuler Musique Musik
12 OK SOUND_VOLUME OK Sound effects OK Effets sonores Soundeffekte
13 ENTER_SAVE_NAME CANCEL Enter the save name: Cancel Entrez un nom de sauvegarde Annuler Abbrechen
14 APPLY OK Apply OK Appliquer Ok Ok
15 CONFIRM_OVERWRITE ENTER_SAVE_NAME Overwrite the savegame? Enter the save name: Écraser la sauvegarde ? Entrez un nom de sauvegarde Bitte gib einen Namen für das Spiel ein:
16 YES APPLY Yes Apply Oui Appliquer Anwenden
17 NO CONFIRM_OVERWRITE No Overwrite the savegame? Non Écraser la sauvegarde ? Soll das Spiel überschrieben werden?
18 YES Yes Oui Ja
19 NO No Non Nein

Binary file not shown.

View File

@@ -14,13 +14,17 @@ func _on_back_pressed():
emit_signal("back_button_pressed")
func refresh_savegames():
for slot in $ScrollContainer/slots.get_children():
$ScrollContainer/slots.remove_child(slot)
for slot in $CenterContainer/VBoxContainer/\
ScrollContainer/slots.get_children():
$CenterContainer/VBoxContainer/\
ScrollContainer/slots.remove_child(slot)
var saves_list = escoria.save_manager.get_saves_list()
for i in saves_list.size():
var save_data = saves_list[i+1]
var new_slot = slot_ui_scene.instance()
$ScrollContainer/slots.add_child(new_slot)
$CenterContainer/VBoxContainer/ScrollContainer/slots.add_child(
new_slot
)
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])

View File

@@ -13,38 +13,48 @@ __meta__ = {
}
slot_ui_scene = ExtResource( 2 )
[node name="back" type="Button" parent="."]
margin_left = 130.0
margin_top = 329.0
margin_right = 304.0
margin_bottom = 383.0
custom_fonts/font = ExtResource( 1 )
text = "OPTIONS_BACK"
[node name="CenterContainer" type="CenterContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScrollContainer" type="ScrollContainer" parent="."]
anchor_left = 0.291
anchor_top = 0.369
anchor_right = 0.709
anchor_bottom = 0.941
margin_left = -0.480011
margin_top = -1.10001
margin_right = 0.479919
margin_bottom = -0.900024
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 390.0
margin_top = 184.0
margin_right = 890.0
margin_bottom = 715.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/VBoxContainer"]
margin_right = 500.0
margin_bottom = 500.0
rect_min_size = Vector2( 500, 500 )
scroll_horizontal_enabled = false
__meta__ = {
"_edit_use_anchors_": false
}
[node name="slots" type="VBoxContainer" parent="ScrollContainer"]
margin_right = 536.0
margin_bottom = 515.0
[node name="slots" type="VBoxContainer" parent="CenterContainer/VBoxContainer/ScrollContainer"]
margin_right = 500.0
margin_bottom = 500.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
[node name="back" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 504.0
margin_right = 500.0
margin_bottom = 531.0
custom_fonts/font = ExtResource( 1 )
text = "OPTIONS_BACK"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="CenterContainer/VBoxContainer/back" to="." method="_on_back_pressed"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -19,6 +19,7 @@ __meta__ = {
[node name="new_game" type="Button" parent="."]
margin_right = 358.0
margin_bottom = 152.0
rect_min_size = Vector2( 0, 150 )
size_flags_vertical = 3
custom_fonts/font = ExtResource( 1 )
text = "NEW_GAME"

View File

@@ -19,7 +19,7 @@ func _ready():
]
)
return false
func _on_continue_pressed():
pass
@@ -34,13 +34,13 @@ func _on_new_game_pressed():
func _on_load_game_pressed():
$Panel/main.hide()
$Panel/CenterContainer/main.hide()
$Panel/load_game.refresh_savegames()
$Panel/load_game.show()
func _on_options_pressed():
$Panel/main.hide()
$Panel/CenterContainer/main.hide()
$Panel/options.show()
@@ -53,10 +53,10 @@ func _on_quit_pressed():
func _on_options_back_button_pressed():
$Panel/options.hide()
$Panel/main.show()
$Panel/CenterContainer/main.show()
func _on_load_game_back_button_pressed():
$Panel/load_game.hide()
$Panel/main.show()
$Panel/CenterContainer/main.show()

View File

@@ -22,19 +22,46 @@ __meta__ = {
"_editor_description_": ""
}
[node name="TextureRect" type="TextureRect" parent="Panel"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -308.0
margin_top = 52.0
margin_right = 308.0
margin_bottom = 288.0
[node name="CenterContainer" type="CenterContainer" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="main" type="VBoxContainer" parent="Panel/CenterContainer"]
margin_left = 332.0
margin_top = 150.0
margin_right = 948.0
margin_bottom = 749.0
custom_constants/separation = 100
[node name="TextureRect" type="TextureRect" parent="Panel/CenterContainer/main"]
margin_right = 616.0
margin_bottom = 236.0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="main" parent="Panel" instance=ExtResource( 2 )]
[node name="buttons" parent="Panel/CenterContainer/main" instance=ExtResource( 2 )]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 336.0
margin_right = 616.0
margin_bottom = 599.0
[node name="new_game" parent="Panel/CenterContainer/main/buttons" index="0"]
margin_right = 616.0
[node name="load_game" parent="Panel/CenterContainer/main/buttons" index="1"]
margin_right = 616.0
[node name="options" parent="Panel/CenterContainer/main/buttons" index="2"]
margin_right = 616.0
[node name="quit" parent="Panel/CenterContainer/main/buttons" index="3"]
margin_right = 616.0
[node name="options" parent="Panel" instance=ExtResource( 4 )]
visible = false
@@ -42,11 +69,11 @@ visible = false
[node name="load_game" parent="Panel" instance=ExtResource( 5 )]
visible = false
[connection signal="pressed" from="Panel/main/new_game" to="." method="_on_new_game_pressed"]
[connection signal="pressed" from="Panel/main/load_game" to="." method="_on_load_game_pressed"]
[connection signal="pressed" from="Panel/main/options" to="." method="_on_options_pressed"]
[connection signal="pressed" from="Panel/main/quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/main/buttons/new_game" to="." method="_on_new_game_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/main/buttons/load_game" to="." method="_on_load_game_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/main/buttons/options" to="." method="_on_options_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/main/buttons/quit" to="." method="_on_quit_pressed"]
[connection signal="back_button_pressed" from="Panel/options" to="." method="_on_options_back_button_pressed"]
[connection signal="back_button_pressed" from="Panel/load_game" to="." method="_on_load_game_back_button_pressed"]
[editable path="Panel/main"]
[editable path="Panel/CenterContainer/main/buttons"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -6,6 +6,29 @@ onready var settings_changed = false
var backup_settings
# A list of languages already added to the language selection
var _loaded_languages: Array = []
func _ready() -> void:
var _flags_container: HBoxContainer = \
$CenterContainer/VBoxContainer/MarginContainer/options/flags
for child in _flags_container.get_children():
_flags_container.remove_child(child)
_loaded_languages = []
for lang in TranslationServer.get_loaded_locales():
if not lang in _loaded_languages:
_loaded_languages.append(lang)
var _lang = TextureRect.new()
_lang.texture = load(
"res://game/ui/commons/options/flags/%s.png" % lang
)
_flags_container.add_child(_lang)
_lang.connect("gui_input", self, "_on_language_input", [lang])
func show():
backup_settings = escoria.settings.duplicate()
initialize_options(escoria.settings)
@@ -13,13 +36,10 @@ func show():
func initialize_options(p_settings):
$options/general_volume.value = p_settings["master_volume"]
$options/sound_volume.value = p_settings["sfx_volume"]
$options/music_volume.value = p_settings["music_volume"]
func greyout_other_languages(_except_lang: String) -> void:
pass
var _options = $CenterContainer/VBoxContainer/MarginContainer/options
_options.get_node("general_volume").value = p_settings["master_volume"]
_options.get_node("sound_volume").value = p_settings["sfx_volume"]
_options.get_node("music_volume").value = p_settings["music_volume"]
func _on_language_input(event: InputEvent, language: String):

View File

@@ -1,8 +1,6 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
[ext_resource path="res://game/ui/commons/main_menu/flags/en_EN_small.png" type="Texture" id=2]
[ext_resource path="res://game/ui/commons/main_menu/flags/fr_FR_small.png" type="Texture" id=3]
[ext_resource path="res://game/ui/commons/options/options.gd" type="Script" id=4]
[node name="options" type="Control"]
@@ -13,133 +11,139 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="back" type="Button" parent="."]
margin_left = 130.0
margin_top = 329.0
margin_right = 304.0
margin_bottom = 383.0
custom_fonts/font = ExtResource( 1 )
text = "OPTIONS_BACK"
[node name="CenterContainer" type="CenterContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 482.0
margin_top = 366.0
margin_right = 798.0
margin_bottom = 533.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="options" type="GridContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -275.5
margin_top = -75.0
margin_right = 275.5
margin_bottom = 75.0
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/VBoxContainer"]
margin_right = 316.0
margin_bottom = 136.0
size_flags_vertical = 6
custom_constants/margin_right = 20
custom_constants/margin_top = 20
custom_constants/margin_left = 20
custom_constants/margin_bottom = 20
[node name="options" type="GridContainer" parent="CenterContainer/VBoxContainer/MarginContainer"]
margin_left = 20.0
margin_top = 20.0
margin_right = 296.0
margin_bottom = 116.0
size_flags_vertical = 6
custom_constants/hseparation = 40
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="label" type="Label" parent="options"]
margin_top = 27.0
[node name="label" type="Label" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_right = 220.0
margin_bottom = 48.0
margin_bottom = 21.0
custom_fonts/font = ExtResource( 1 )
text = "OPTIONS_LANGUAGE"
[node name="flags" type="HBoxContainer" parent="options"]
[node name="flags" type="HBoxContainer" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_left = 260.0
margin_right = 553.0
margin_bottom = 75.0
margin_right = 276.0
margin_bottom = 21.0
size_flags_vertical = 3
custom_constants/separation = 30
alignment = 1
[node name="fr" type="TextureRect" parent="options/flags"]
margin_right = 113.0
margin_bottom = 75.0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="en" type="TextureRect" parent="options/flags"]
margin_left = 143.0
margin_right = 293.0
margin_bottom = 75.0
texture = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="label2" type="Label" parent="options"]
margin_top = 79.0
[node name="label2" type="Label" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_top = 25.0
margin_right = 220.0
margin_bottom = 100.0
margin_bottom = 46.0
custom_fonts/font = ExtResource( 1 )
text = "GENERAL_VOLUME"
[node name="general_volume" type="HSlider" parent="options"]
[node name="general_volume" type="HSlider" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_left = 260.0
margin_top = 79.0
margin_right = 553.0
margin_bottom = 95.0
margin_top = 25.0
margin_right = 276.0
margin_bottom = 41.0
size_flags_horizontal = 3
min_value = 0.001
max_value = 1.0
step = 0.001
value = 0.001
[node name="label3" type="Label" parent="options"]
margin_top = 104.0
[node name="label3" type="Label" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_top = 50.0
margin_right = 220.0
margin_bottom = 125.0
margin_bottom = 71.0
custom_fonts/font = ExtResource( 1 )
text = "SOUND_VOLUME"
[node name="sound_volume" type="HSlider" parent="options"]
[node name="sound_volume" type="HSlider" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_left = 260.0
margin_top = 104.0
margin_right = 553.0
margin_bottom = 120.0
margin_top = 50.0
margin_right = 276.0
margin_bottom = 66.0
size_flags_horizontal = 3
min_value = 0.001
max_value = 1.0
step = 0.001
value = 0.001
[node name="label4" type="Label" parent="options"]
margin_top = 129.0
[node name="label4" type="Label" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_top = 75.0
margin_right = 220.0
margin_bottom = 150.0
margin_bottom = 96.0
custom_fonts/font = ExtResource( 1 )
text = "MUSIC_VOLUME"
[node name="music_volume" type="HSlider" parent="options"]
[node name="music_volume" type="HSlider" parent="CenterContainer/VBoxContainer/MarginContainer/options"]
margin_left = 260.0
margin_top = 129.0
margin_right = 553.0
margin_bottom = 145.0
margin_top = 75.0
margin_right = 276.0
margin_bottom = 91.0
size_flags_horizontal = 3
min_value = 0.001
max_value = 1.0
step = 0.001
value = 0.001
[node name="apply" type="Button" parent="."]
margin_left = 364.0
margin_top = 712.0
margin_right = 544.0
margin_bottom = 767.0
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
margin_top = 140.0
margin_right = 316.0
margin_bottom = 167.0
custom_constants/separation = 20
alignment = 1
[node name="back" type="Button" parent="CenterContainer/VBoxContainer/HBoxContainer"]
margin_left = 22.0
margin_right = 196.0
margin_bottom = 27.0
custom_fonts/font = ExtResource( 1 )
text = "OPTIONS_BACK"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="apply" type="Button" parent="CenterContainer/VBoxContainer/HBoxContainer"]
margin_left = 216.0
margin_right = 293.0
margin_bottom = 27.0
custom_fonts/font = ExtResource( 1 )
text = "APPLY"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
[connection signal="gui_input" from="options/flags/fr" to="." method="_on_language_input" binds= [ "fr" ]]
[connection signal="gui_input" from="options/flags/en" to="." method="_on_language_input" binds= [ "en" ]]
[connection signal="value_changed" from="options/general_volume" to="." method="_on_general_volume_changed"]
[connection signal="value_changed" from="options/sound_volume" to="." method="_on_sound_volume_changed"]
[connection signal="value_changed" from="options/music_volume" to="." method="_on_music_volume_changed"]
[connection signal="pressed" from="apply" to="." method="_on_apply_pressed"]
[connection signal="value_changed" from="CenterContainer/VBoxContainer/MarginContainer/options/general_volume" to="." method="_on_general_volume_changed"]
[connection signal="value_changed" from="CenterContainer/VBoxContainer/MarginContainer/options/sound_volume" to="." method="_on_sound_volume_changed"]
[connection signal="value_changed" from="CenterContainer/VBoxContainer/MarginContainer/options/music_volume" to="." method="_on_music_volume_changed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/HBoxContainer/back" to="." method="_on_back_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/HBoxContainer/apply" to="." method="_on_apply_pressed"]

View File

@@ -11,12 +11,12 @@ func _on_continue_pressed():
func _on_save_game_pressed():
$Panel/VBoxContainer.hide()
$Panel/CenterContainer/VBoxContainer.hide()
$save_game.show()
func _on_load_game_pressed():
$Panel/VBoxContainer.hide()
$Panel/CenterContainer/VBoxContainer.hide()
$load_game.refresh_savegames()
$load_game.show()
@@ -26,10 +26,10 @@ func _on_quit_pressed():
func _on_save_game_back_button_pressed():
$Panel/VBoxContainer.show()
$Panel/CenterContainer/VBoxContainer.show()
$save_game.hide()
func _on_load_game_back_button_pressed():
$Panel/VBoxContainer.show()
$Panel/CenterContainer/VBoxContainer.show()
$load_game.hide()

View File

@@ -21,70 +21,77 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="Panel"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -308.0
margin_right = 308.0
[node name="CenterContainer" type="CenterContainer" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/CenterContainer"]
margin_left = 332.0
margin_top = 151.0
margin_right = 948.0
margin_bottom = 748.0
custom_constants/separation = 100
[node name="TextureRect" type="TextureRect" parent="Panel/CenterContainer/VBoxContainer"]
margin_right = 616.0
margin_bottom = 236.0
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -127.8
margin_top = -80.62
margin_right = 127.8
margin_bottom = 80.62
[node name="menuitems" type="VBoxContainer" parent="Panel/CenterContainer/VBoxContainer"]
margin_top = 336.0
margin_right = 616.0
margin_bottom = 597.0
custom_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="continue" type="Button" parent="Panel/VBoxContainer"]
margin_right = 255.0
margin_bottom = 32.0
[node name="continue" type="Button" parent="Panel/CenterContainer/VBoxContainer/menuitems"]
margin_right = 616.0
margin_bottom = 150.0
rect_min_size = Vector2( 0, 150 )
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Continue"
text = "CONTINUE_GAME"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="save_game" type="Button" parent="Panel/VBoxContainer"]
margin_top = 42.0
margin_right = 255.0
margin_bottom = 75.0
[node name="save_game" type="Button" parent="Panel/CenterContainer/VBoxContainer/menuitems"]
margin_top = 160.0
margin_right = 616.0
margin_bottom = 187.0
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Save game"
text = "SAVE_GAME"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="load_game" type="Button" parent="Panel/VBoxContainer"]
margin_top = 85.0
margin_right = 255.0
margin_bottom = 118.0
[node name="load_game" type="Button" parent="Panel/CenterContainer/VBoxContainer/menuitems"]
margin_top = 197.0
margin_right = 616.0
margin_bottom = 224.0
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Load game"
text = "LOAD_GAME"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="quit" type="Button" parent="Panel/VBoxContainer"]
margin_top = 128.0
margin_right = 255.0
margin_bottom = 161.0
[node name="quit" type="Button" parent="Panel/CenterContainer/VBoxContainer/menuitems"]
margin_top = 234.0
margin_right = 616.0
margin_bottom = 261.0
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Quit"
text = "QUIT"
__meta__ = {
"_edit_use_anchors_": false
}
@@ -95,9 +102,9 @@ visible = false
[node name="load_game" parent="." instance=ExtResource( 5 )]
visible = false
[connection signal="pressed" from="Panel/VBoxContainer/continue" to="." method="_on_continue_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/save_game" to="." method="_on_save_game_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/load_game" to="." method="_on_load_game_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/VBoxContainer/menuitems/continue" to="." method="_on_continue_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/VBoxContainer/menuitems/save_game" to="." method="_on_save_game_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/VBoxContainer/menuitems/load_game" to="." method="_on_load_game_pressed"]
[connection signal="pressed" from="Panel/CenterContainer/VBoxContainer/menuitems/quit" to="." method="_on_quit_pressed"]
[connection signal="back_button_pressed" from="save_game" to="." method="_on_save_game_back_button_pressed"]
[connection signal="back_button_pressed" from="load_game" to="." method="_on_load_game_back_button_pressed"]

View File

@@ -19,14 +19,15 @@ func _on_slot_pressed(p_slot_n: int):
func refresh_savegames():
for slot in $ScrollContainer/slots.get_children():
$ScrollContainer/slots.remove_child(slot)
var _slots = $CenterContainer/VBoxContainer/ScrollContainer/slots
for slot in _slots.get_children():
_slots.remove_child(slot)
var saves_list = escoria.save_manager.get_saves_list()
for i in saves_list.size():
var save_data = saves_list[i+1]
var new_slot = slot_ui_scene.instance()
$ScrollContainer/slots.add_child(new_slot)
_slots.add_child(new_slot)
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
@@ -39,7 +40,7 @@ func refresh_savegames():
datetime["minute"],
]
var new_slot = slot_ui_scene.instance()
$ScrollContainer/slots.add_child(new_slot)
_slots.add_child(new_slot)
new_slot.set_slot_name_date(tr("New save"), datetime_string)
new_slot.connect("pressed", self, "_on_slot_pressed", [saves_list.size()+1])

View File

@@ -15,44 +15,51 @@ __meta__ = {
}
slot_ui_scene = ExtResource( 1 )
[node name="back" type="Button" parent="."]
margin_left = 130.0
margin_top = 329.0
margin_right = 304.0
margin_bottom = 383.0
custom_fonts/font = ExtResource( 3 )
text = "OPTIONS_BACK"
[node name="save_name_popup" parent="." instance=ExtResource( 4 )]
[node name="overwrite_confirm_popup" parent="." instance=ExtResource( 5 )]
[node name="CenterContainer" type="CenterContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScrollContainer" type="ScrollContainer" parent="."]
anchor_left = 0.284
anchor_top = 0.367
anchor_right = 0.709
anchor_bottom = 0.94
margin_left = 8.47998
margin_top = 0.699982
margin_right = 0.479919
margin_bottom = -6.10352e-05
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 390.0
margin_top = 184.0
margin_right = 890.0
margin_bottom = 715.0
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/VBoxContainer"]
margin_right = 500.0
margin_bottom = 500.0
rect_min_size = Vector2( 500, 500 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="slots" type="VBoxContainer" parent="ScrollContainer"]
margin_right = 536.0
margin_bottom = 515.0
[node name="slots" type="VBoxContainer" parent="CenterContainer/VBoxContainer/ScrollContainer"]
margin_right = 500.0
margin_bottom = 500.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="save_name_popup" parent="." instance=ExtResource( 4 )]
[node name="back" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 504.0
margin_right = 500.0
margin_bottom = 531.0
custom_fonts/font = ExtResource( 3 )
text = "OPTIONS_BACK"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="overwrite_confirm_popup" parent="." instance=ExtResource( 5 )]
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
[connection signal="savegame_cancel" from="save_name_popup" to="." method="_on_save_name_popup_savegame_cancel"]
[connection signal="savegame_name_ok" from="save_name_popup" to="." method="_on_save_name_popup_savegame_name_ok"]
[connection signal="confirm_yes" from="overwrite_confirm_popup" to="." method="_on_overwrite_confirm_popup_confirm_yes"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/back" to="." method="_on_back_pressed"]

View File

@@ -584,7 +584,7 @@ _global_script_class_icons={
[application]
config/name="Escoria-reloaded"
config/name="Escoria"
run/main_scene="res://addons/escoria-core/game/main_scene.tscn"
boot_splash/image="res://addons/escoria-core/logo/escoria-logo-small.png"
boot_splash/fullsize=false
@@ -659,7 +659,8 @@ switch_action_verb={
[locale]
translations=PoolStringArray( "res://game/translations/game.en.translation", "res://game/translations/game.fr.translation", "res://game/translations/main_menu.en.translation", "res://game/translations/main_menu.fr.translation" )
translations=PoolStringArray( "res://game/translations/game.en.translation", "res://game/translations/game.fr.translation", "res://game/translations/main_menu.en.translation", "res://game/translations/main_menu.fr.translation", "res://game/translations/game.de.translation", "res://game/translations/main_menu.de.translation" )
locale_filter=[ 0, [ ] ]
[network]