Skip to content

Commit 8d0783a

Browse files
authored
feat: Add Combat UI (#219)
* Update Dialogic 2.0 to Alpha 14 * Simplify BattlerAnim connections to a Battler * Rework Battlers to own a single exported BattlerAnim child * Add damage, healing, and miss labels to combat UI * Add turn bar to combat UI * Add player battler list to combat UI
1 parent d019449 commit 8d0783a

File tree

96 files changed

+1765
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1765
-230
lines changed

addons/dialogic/Core/DialogicUtil.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ class_name DialogicUtil
55
## Used whenever the same thing is needed in different parts of the plugin.
66

77
#region EDITOR
8-
################################################################################
8+
9+
# This method should be used instead of EditorInterface.get_editor_scale(), because if you use that
10+
# it will run perfectly fine from the editor, but crash when the game is exported.
911
static func get_editor_scale() -> float:
1012
return get_dialogic_plugin().get_editor_interface().get_editor_scale()
1113

@@ -365,7 +367,7 @@ static func setup_script_property_edit_node(property_info: Dictionary, value:Var
365367
if value != null:
366368
input.color = value
367369
input.color_changed.connect(DialogicUtil._on_export_color_submitted.bind(property_info.name, property_changed))
368-
input.custom_minimum_size.x = get_editor_scale()*50
370+
input.custom_minimum_size.x = get_editor_scale() * 50
369371
TYPE_INT:
370372
if property_info['hint'] & PROPERTY_HINT_ENUM:
371373
input = OptionButton.new()

addons/dialogic/Editor/CharacterEditor/char_edit_section_general.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func _start_opened() -> bool:
1414

1515
func _ready() -> void:
1616
# Connecting all necessary signals
17-
%ColorPickerButton.custom_minimum_size.x = DialogicUtil.get_editor_scale()*30
17+
%ColorPickerButton.custom_minimum_size.x = DialogicUtil.get_editor_scale() * 30
1818
%ColorPickerButton.color_changed.connect(character_editor.something_changed)
1919
%DisplayNameLineEdit.text_changed.connect(character_editor.something_changed)
2020
%NicknameLineEdit.text_changed.connect(character_editor.something_changed)

addons/dialogic/Editor/Common/DCSS.gd

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
@tool
22
class_name DCSS
3-
4-
static func get_editor_scale() -> float:
5-
return DialogicUtil.get_editor_scale()
63

74
static func inline(style:Dictionary) -> StyleBoxFlat:
8-
var scale:float = get_editor_scale()
5+
var scale:float = DialogicUtil.get_editor_scale()
96
var s := StyleBoxFlat.new()
107
for property in style.keys():
118
match property:
@@ -47,7 +44,6 @@ static func inline(style:Dictionary) -> StyleBoxFlat:
4744
return s
4845

4946
static func style(node, style:Dictionary) -> StyleBoxFlat:
50-
var scale:float = get_editor_scale()
5147
var s:StyleBoxFlat = inline(style)
5248

5349
node.set('theme_override_styles/normal', s)

addons/dialogic/Editor/Common/hint_tooltip_icon.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ extends TextureRect
55

66
func _ready():
77
texture = get_theme_icon("NodeInfo", "EditorIcons")
8-
modulate = get_theme_color("readonly_color", "Editor")
8+
modulate = get_theme_color("contrast_color_1", "Editor")
99
tooltip_text = hint_text

addons/dialogic/Editor/Common/reference_manager.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func _ready() -> void:
1010

1111
for tab in $Tabs/Tabs.get_children():
1212
tab.add_theme_color_override("font_selected_color", get_theme_color("accent_color", "Editor"))
13-
tab.add_theme_font_override("font", get_theme_font("main_button_font", "EditorFonts"))
13+
tab.add_theme_font_override("font", get_theme_font("main", "EditorFonts"))
1414
tab.toggled.connect(tab_changed.bind(tab.get_index()+1))
1515

1616

addons/dialogic/Editor/Common/sidebar.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func _ready():
2525
var editor_scale := DialogicUtil.get_editor_scale()
2626
## ICONS
2727
%Logo.texture = load("res://addons/dialogic/Editor/Images/dialogic-logo.svg")
28-
%Logo.custom_minimum_size.y = 30*editor_scale
28+
%Logo.custom_minimum_size.y = 30 * editor_scale
2929
%Search.right_icon = get_theme_icon("Search", "EditorIcons")
3030

3131
%CurrentResource.add_theme_stylebox_override('normal', get_theme_stylebox('normal', 'LineEdit'))
@@ -34,8 +34,8 @@ func _ready():
3434
%ContentList.add_theme_color_override("font_selected_color", get_theme_color("property_color_z", "Editor"))
3535

3636
## MARGINS
37-
$VBox/Margin.set("theme_override_constants/margin_left", 4 * editor_scale)
38-
$VBox/Margin.set("theme_override_constants/margin_bottom", 4 * editor_scale)
37+
$VBox/Margin.set("theme_override_constants/margin_left", get_theme_constant("base_margin", "Editor") * editor_scale)
38+
$VBox/Margin.set("theme_override_constants/margin_bottom", get_theme_constant("base_margin", "Editor") * editor_scale)
3939

4040
## RIGHT CLICK MENU
4141
%RightClickMenu.clear()

addons/dialogic/Editor/Common/toolbar.gd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ extends HBoxContainer
99
func _ready():
1010
if owner.get_parent() is SubViewport:
1111
return
12-
var editor_scale := DialogicUtil.get_editor_scale()
13-
%CustomButtons.custom_minimum_size.y = 33*editor_scale
12+
%CustomButtons.custom_minimum_size.y = 33 * DialogicUtil.get_editor_scale()
1413

1514
for child in get_children():
1615
if child is Button:

addons/dialogic/Editor/Events/BranchEnd.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var selected := false
1616

1717
func _ready() -> void:
1818
$Icon.icon = get_theme_icon("GuiSpinboxUpdown", "EditorIcons")
19-
$Spacer.custom_minimum_size.x = 90*DialogicUtil.get_editor_scale()
19+
$Spacer.custom_minimum_size.x = 90 * DialogicUtil.get_editor_scale()
2020
visual_deselect()
2121
parent_node_changed()
2222

@@ -59,7 +59,7 @@ func update_hidden_events_indicator(hidden_events_count:int = 0) -> void:
5959

6060
## Called by the visual timeline editor
6161
func set_indent(indent: int) -> void:
62-
$Indent.custom_minimum_size = Vector2(indent_size * indent*DialogicUtil.get_editor_scale(), 0)
62+
$Indent.custom_minimum_size = Vector2(indent_size * indent * DialogicUtil.get_editor_scale(), 0)
6363
$Indent.visible = indent != 0
6464
current_indent_level = indent
6565
queue_redraw()

addons/dialogic/Editor/Events/EventBlock/event_block.gd

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var end_node: Node = null:
1414
return end_node
1515
set(node):
1616
end_node = node
17-
%CollapseButton.visible = true if end_node else false
17+
%ToggleChildrenVisibilityButton.visible = true if end_node else false
1818

1919

2020
## FLAGS
@@ -63,8 +63,10 @@ func initialize_ui() -> void:
6363
%Warning.position = Vector2(-5 * _scale, -10 * _scale)
6464

6565
# Expand Button
66-
%ExpandButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
67-
%ExpandButton.modulate = get_theme_color("readonly_color", "Editor")
66+
%ToggleBodyVisibilityButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
67+
%ToggleBodyVisibilityButton.modulate = get_theme_color("contrast_color_1", "Editor")
68+
%ToggleBodyVisibilityButton.set("theme_override_colors/icon_normal_color", get_theme_color("contrast_color_1", "Editor"))
69+
%ToggleBodyVisibilityButton.set("theme_override_colors/icon_pressed_color", get_theme_color("contrast_color_1", "Editor"))
6870

6971
# Icon Panel
7072
%IconPanel.tooltip_text = resource.event_name
@@ -86,9 +88,9 @@ func initialize_ui() -> void:
8688
%Header.add_theme_constant_override("custom_constants/separation", 5 * _scale)
8789

8890
# Collapse Button
89-
%CollapseButton.toggled.connect(_on_collapse_toggled)
90-
%CollapseButton.icon = get_theme_icon("Collapse", "EditorIcons")
91-
%CollapseButton.hide()
91+
%ToggleChildrenVisibilityButton.toggled.connect(_on_collapse_toggled)
92+
%ToggleChildrenVisibilityButton.icon = get_theme_icon("Collapse", "EditorIcons")
93+
%ToggleChildrenVisibilityButton.hide()
9294

9395
%Body.add_theme_constant_override("margin_left", icon_size * _scale)
9496

@@ -103,7 +105,7 @@ func initialize_logic() -> void:
103105

104106
content_changed.connect(recalculate_field_visibility)
105107

106-
_on_ExpandButton_toggled(resource.expand_by_default or resource.created_by_button)
108+
_on_ToggleBodyVisibility_toggled(resource.expand_by_default or resource.created_by_button)
107109

108110
#endregion
109111

@@ -138,7 +140,7 @@ func set_warning(text:String= "") -> void:
138140

139141

140142
func set_indent(indent: int) -> void:
141-
add_theme_constant_override("margin_left", indent_size*indent*DialogicUtil.get_editor_scale())
143+
add_theme_constant_override("margin_left", indent_size * indent * DialogicUtil.get_editor_scale())
142144
current_indent_level = indent
143145

144146
#endregion
@@ -161,7 +163,8 @@ var FIELD_SCENES := {
161163
DialogicEvent.ValueType.NUMBER: "res://addons/dialogic/Editor/Events/Fields/field_number.tscn",
162164
DialogicEvent.ValueType.VECTOR2: "res://addons/dialogic/Editor/Events/Fields/field_vector2.tscn",
163165
DialogicEvent.ValueType.VECTOR3: "res://addons/dialogic/Editor/Events/Fields/field_vector3.tscn",
164-
DialogicEvent.ValueType.VECTOR4: "res://addons/dialogic/Editor/Events/Fields/field_vector4.tscn"
166+
DialogicEvent.ValueType.VECTOR4: "res://addons/dialogic/Editor/Events/Fields/field_vector4.tscn",
167+
DialogicEvent.ValueType.COLOR: "res://addons/dialogic/Editor/Events/Fields/field_color.tscn"
165168
}
166169

167170
func build_editor(build_header:bool = true, build_body:bool = false) -> void:
@@ -218,7 +221,7 @@ func build_editor(build_header:bool = true, build_body:bool = false) -> void:
218221
else:
219222
editor_node.icon = p.display_info.icon
220223
editor_node.flat = true
221-
editor_node.custom_minimum_size.x = 30*DialogicUtil.get_editor_scale()
224+
editor_node.custom_minimum_size.x = 30 * DialogicUtil.get_editor_scale()
222225
editor_node.pressed.connect(p.display_info.callable)
223226

224227
## CUSTOM
@@ -324,7 +327,7 @@ func recalculate_field_visibility() -> void:
324327
else:
325328
if p.node != null:
326329
p.node.hide()
327-
%ExpandButton.visible = has_any_enabled_body_content
330+
%ToggleBodyVisibilityButton.visible = has_any_enabled_body_content
328331

329332

330333
func set_property(property_name:String, value:Variant) -> void:
@@ -376,15 +379,15 @@ func _on_collapse_toggled(toggled:bool) -> void:
376379

377380

378381

379-
func _on_ExpandButton_toggled(button_pressed:bool) -> void:
382+
func _on_ToggleBodyVisibility_toggled(button_pressed:bool) -> void:
380383
if button_pressed and !body_was_build:
381384
build_editor(false, true)
382-
%ExpandButton.set_pressed_no_signal(button_pressed)
385+
%ToggleBodyVisibilityButton.set_pressed_no_signal(button_pressed)
383386

384387
if button_pressed:
385-
%ExpandButton.icon = get_theme_icon("CodeFoldDownArrow", "EditorIcons")
388+
%ToggleBodyVisibilityButton.icon = get_theme_icon("CodeFoldDownArrow", "EditorIcons")
386389
else:
387-
%ExpandButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
390+
%ToggleBodyVisibilityButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
388391

389392
expanded = button_pressed
390393
%Body.visible = button_pressed
@@ -398,7 +401,7 @@ func _on_EventNode_gui_input(event:InputEvent) -> void:
398401
grab_focus() # Grab focus to avoid copy pasting text or events
399402
if event.double_click:
400403
if has_any_enabled_body_content:
401-
_on_ExpandButton_toggled(!expanded)
404+
_on_ToggleBodyVisibility_toggled(!expanded)
402405
# For opening the context menu
403406
if event is InputEventMouseButton:
404407
if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:

addons/dialogic/Editor/Events/EventBlock/event_block.tscn

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ corner_radius_top_right = 5
1111
corner_radius_bottom_right = 5
1212
corner_radius_bottom_left = 5
1313

14-
[sub_resource type="Image" id="Image_ng2y4"]
14+
[sub_resource type="Image" id="Image_wcwsv"]
1515
data = {
1616
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
1717
"format": "RGBA8",
@@ -21,7 +21,7 @@ data = {
2121
}
2222

2323
[sub_resource type="ImageTexture" id="ImageTexture_rc1wh"]
24-
image = SubResource("Image_ng2y4")
24+
image = SubResource("Image_wcwsv")
2525

2626
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ee4ub"]
2727

@@ -91,7 +91,7 @@ stretch_mode = 5
9191
unique_name_in_owner = true
9292
layout_mode = 2
9393

94-
[node name="ExpandButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
94+
[node name="ToggleBodyVisibilityButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
9595
unique_name_in_owner = true
9696
modulate = Color(0, 0, 0, 1)
9797
layout_mode = 2
@@ -102,7 +102,7 @@ toggle_mode = true
102102
icon = SubResource("ImageTexture_rc1wh")
103103
flat = true
104104

105-
[node name="CollapseButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
105+
[node name="ToggleChildrenVisibilityButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
106106
unique_name_in_owner = true
107107
visible = false
108108
layout_mode = 2
@@ -126,4 +126,4 @@ size_flags_vertical = 3
126126
mouse_filter = 2
127127

128128
[connection signal="gui_input" from="." to="." method="_on_EventNode_gui_input"]
129-
[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/ExpandButton" to="." method="_on_ExpandButton_toggled"]
129+
[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/ToggleBodyVisibilityButton" to="." method="_on_ToggleBodyVisibility_toggled"]

0 commit comments

Comments
 (0)