Skip to content

Commit

Permalink
feat: Add Combat UI (#219)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
food-please authored Sep 16, 2024
1 parent d019449 commit 8d0783a
Show file tree
Hide file tree
Showing 96 changed files with 1,765 additions and 230 deletions.
6 changes: 4 additions & 2 deletions addons/dialogic/Core/DialogicUtil.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ class_name DialogicUtil
## Used whenever the same thing is needed in different parts of the plugin.

#region EDITOR
################################################################################

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

Expand Down Expand Up @@ -365,7 +367,7 @@ static func setup_script_property_edit_node(property_info: Dictionary, value:Var
if value != null:
input.color = value
input.color_changed.connect(DialogicUtil._on_export_color_submitted.bind(property_info.name, property_changed))
input.custom_minimum_size.x = get_editor_scale()*50
input.custom_minimum_size.x = get_editor_scale() * 50
TYPE_INT:
if property_info['hint'] & PROPERTY_HINT_ENUM:
input = OptionButton.new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func _start_opened() -> bool:

func _ready() -> void:
# Connecting all necessary signals
%ColorPickerButton.custom_minimum_size.x = DialogicUtil.get_editor_scale()*30
%ColorPickerButton.custom_minimum_size.x = DialogicUtil.get_editor_scale() * 30
%ColorPickerButton.color_changed.connect(character_editor.something_changed)
%DisplayNameLineEdit.text_changed.connect(character_editor.something_changed)
%NicknameLineEdit.text_changed.connect(character_editor.something_changed)
Expand Down
6 changes: 1 addition & 5 deletions addons/dialogic/Editor/Common/DCSS.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
@tool
class_name DCSS

static func get_editor_scale() -> float:
return DialogicUtil.get_editor_scale()

static func inline(style:Dictionary) -> StyleBoxFlat:
var scale:float = get_editor_scale()
var scale:float = DialogicUtil.get_editor_scale()
var s := StyleBoxFlat.new()
for property in style.keys():
match property:
Expand Down Expand Up @@ -47,7 +44,6 @@ static func inline(style:Dictionary) -> StyleBoxFlat:
return s

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

node.set('theme_override_styles/normal', s)
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Editor/Common/hint_tooltip_icon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ extends TextureRect

func _ready():
texture = get_theme_icon("NodeInfo", "EditorIcons")
modulate = get_theme_color("readonly_color", "Editor")
modulate = get_theme_color("contrast_color_1", "Editor")
tooltip_text = hint_text
2 changes: 1 addition & 1 deletion addons/dialogic/Editor/Common/reference_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func _ready() -> void:

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


Expand Down
6 changes: 3 additions & 3 deletions addons/dialogic/Editor/Common/sidebar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func _ready():
var editor_scale := DialogicUtil.get_editor_scale()
## ICONS
%Logo.texture = load("res://addons/dialogic/Editor/Images/dialogic-logo.svg")
%Logo.custom_minimum_size.y = 30*editor_scale
%Logo.custom_minimum_size.y = 30 * editor_scale
%Search.right_icon = get_theme_icon("Search", "EditorIcons")

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

## MARGINS
$VBox/Margin.set("theme_override_constants/margin_left", 4 * editor_scale)
$VBox/Margin.set("theme_override_constants/margin_bottom", 4 * editor_scale)
$VBox/Margin.set("theme_override_constants/margin_left", get_theme_constant("base_margin", "Editor") * editor_scale)
$VBox/Margin.set("theme_override_constants/margin_bottom", get_theme_constant("base_margin", "Editor") * editor_scale)

## RIGHT CLICK MENU
%RightClickMenu.clear()
Expand Down
3 changes: 1 addition & 2 deletions addons/dialogic/Editor/Common/toolbar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ extends HBoxContainer
func _ready():
if owner.get_parent() is SubViewport:
return
var editor_scale := DialogicUtil.get_editor_scale()
%CustomButtons.custom_minimum_size.y = 33*editor_scale
%CustomButtons.custom_minimum_size.y = 33 * DialogicUtil.get_editor_scale()

for child in get_children():
if child is Button:
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Editor/Events/BranchEnd.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var selected := false

func _ready() -> void:
$Icon.icon = get_theme_icon("GuiSpinboxUpdown", "EditorIcons")
$Spacer.custom_minimum_size.x = 90*DialogicUtil.get_editor_scale()
$Spacer.custom_minimum_size.x = 90 * DialogicUtil.get_editor_scale()
visual_deselect()
parent_node_changed()

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

## Called by the visual timeline editor
func set_indent(indent: int) -> void:
$Indent.custom_minimum_size = Vector2(indent_size * indent*DialogicUtil.get_editor_scale(), 0)
$Indent.custom_minimum_size = Vector2(indent_size * indent * DialogicUtil.get_editor_scale(), 0)
$Indent.visible = indent != 0
current_indent_level = indent
queue_redraw()
Expand Down
35 changes: 19 additions & 16 deletions addons/dialogic/Editor/Events/EventBlock/event_block.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var end_node: Node = null:
return end_node
set(node):
end_node = node
%CollapseButton.visible = true if end_node else false
%ToggleChildrenVisibilityButton.visible = true if end_node else false


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

# Expand Button
%ExpandButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
%ExpandButton.modulate = get_theme_color("readonly_color", "Editor")
%ToggleBodyVisibilityButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
%ToggleBodyVisibilityButton.modulate = get_theme_color("contrast_color_1", "Editor")
%ToggleBodyVisibilityButton.set("theme_override_colors/icon_normal_color", get_theme_color("contrast_color_1", "Editor"))
%ToggleBodyVisibilityButton.set("theme_override_colors/icon_pressed_color", get_theme_color("contrast_color_1", "Editor"))

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

# Collapse Button
%CollapseButton.toggled.connect(_on_collapse_toggled)
%CollapseButton.icon = get_theme_icon("Collapse", "EditorIcons")
%CollapseButton.hide()
%ToggleChildrenVisibilityButton.toggled.connect(_on_collapse_toggled)
%ToggleChildrenVisibilityButton.icon = get_theme_icon("Collapse", "EditorIcons")
%ToggleChildrenVisibilityButton.hide()

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

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

content_changed.connect(recalculate_field_visibility)

_on_ExpandButton_toggled(resource.expand_by_default or resource.created_by_button)
_on_ToggleBodyVisibility_toggled(resource.expand_by_default or resource.created_by_button)

#endregion

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


func set_indent(indent: int) -> void:
add_theme_constant_override("margin_left", indent_size*indent*DialogicUtil.get_editor_scale())
add_theme_constant_override("margin_left", indent_size * indent * DialogicUtil.get_editor_scale())
current_indent_level = indent

#endregion
Expand All @@ -161,7 +163,8 @@ var FIELD_SCENES := {
DialogicEvent.ValueType.NUMBER: "res://addons/dialogic/Editor/Events/Fields/field_number.tscn",
DialogicEvent.ValueType.VECTOR2: "res://addons/dialogic/Editor/Events/Fields/field_vector2.tscn",
DialogicEvent.ValueType.VECTOR3: "res://addons/dialogic/Editor/Events/Fields/field_vector3.tscn",
DialogicEvent.ValueType.VECTOR4: "res://addons/dialogic/Editor/Events/Fields/field_vector4.tscn"
DialogicEvent.ValueType.VECTOR4: "res://addons/dialogic/Editor/Events/Fields/field_vector4.tscn",
DialogicEvent.ValueType.COLOR: "res://addons/dialogic/Editor/Events/Fields/field_color.tscn"
}

func build_editor(build_header:bool = true, build_body:bool = false) -> void:
Expand Down Expand Up @@ -218,7 +221,7 @@ func build_editor(build_header:bool = true, build_body:bool = false) -> void:
else:
editor_node.icon = p.display_info.icon
editor_node.flat = true
editor_node.custom_minimum_size.x = 30*DialogicUtil.get_editor_scale()
editor_node.custom_minimum_size.x = 30 * DialogicUtil.get_editor_scale()
editor_node.pressed.connect(p.display_info.callable)

## CUSTOM
Expand Down Expand Up @@ -324,7 +327,7 @@ func recalculate_field_visibility() -> void:
else:
if p.node != null:
p.node.hide()
%ExpandButton.visible = has_any_enabled_body_content
%ToggleBodyVisibilityButton.visible = has_any_enabled_body_content


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



func _on_ExpandButton_toggled(button_pressed:bool) -> void:
func _on_ToggleBodyVisibility_toggled(button_pressed:bool) -> void:
if button_pressed and !body_was_build:
build_editor(false, true)
%ExpandButton.set_pressed_no_signal(button_pressed)
%ToggleBodyVisibilityButton.set_pressed_no_signal(button_pressed)

if button_pressed:
%ExpandButton.icon = get_theme_icon("CodeFoldDownArrow", "EditorIcons")
%ToggleBodyVisibilityButton.icon = get_theme_icon("CodeFoldDownArrow", "EditorIcons")
else:
%ExpandButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")
%ToggleBodyVisibilityButton.icon = get_theme_icon("CodeFoldedRightArrow", "EditorIcons")

expanded = button_pressed
%Body.visible = button_pressed
Expand All @@ -398,7 +401,7 @@ func _on_EventNode_gui_input(event:InputEvent) -> void:
grab_focus() # Grab focus to avoid copy pasting text or events
if event.double_click:
if has_any_enabled_body_content:
_on_ExpandButton_toggled(!expanded)
_on_ToggleBodyVisibility_toggled(!expanded)
# For opening the context menu
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
Expand Down
10 changes: 5 additions & 5 deletions addons/dialogic/Editor/Events/EventBlock/event_block.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5

[sub_resource type="Image" id="Image_ng2y4"]
[sub_resource type="Image" id="Image_wcwsv"]
data = {
"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),
"format": "RGBA8",
Expand All @@ -21,7 +21,7 @@ data = {
}

[sub_resource type="ImageTexture" id="ImageTexture_rc1wh"]
image = SubResource("Image_ng2y4")
image = SubResource("Image_wcwsv")

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

Expand Down Expand Up @@ -91,7 +91,7 @@ stretch_mode = 5
unique_name_in_owner = true
layout_mode = 2

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

[node name="CollapseButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
[node name="ToggleChildrenVisibilityButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
unique_name_in_owner = true
visible = false
layout_mode = 2
Expand All @@ -126,4 +126,4 @@ size_flags_vertical = 3
mouse_filter = 2

[connection signal="gui_input" from="." to="." method="_on_EventNode_gui_input"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/ExpandButton" to="." method="_on_ExpandButton_toggled"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/ToggleBodyVisibilityButton" to="." method="_on_ToggleBodyVisibility_toggled"]
30 changes: 30 additions & 0 deletions addons/dialogic/Editor/Events/Fields/field_color.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@tool
extends DialogicVisualEditorField

## Event block field for color values.

#region MAIN METHODS
################################################################################

func _ready() -> void:
self.color_changed.connect(_on_value_changed)


func _load_display_info(info:Dictionary) -> void:
self.edit_alpha = info.get("edit_alpha", true)


func _set_value(value:Variant) -> void:
if value is Color:
self.color = Color(value)

#endregion


#region SIGNAL METHODS
################################################################################

func _on_value_changed(value: Color) -> void:
value_changed.emit(property_name, value)

#endregion
12 changes: 12 additions & 0 deletions addons/dialogic/Editor/Events/Fields/field_color.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://4e0kjekan5e7"]

[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_color.gd" id="1_l666a"]

[node name="Field_Color" type="ColorPickerButton"]
custom_minimum_size = Vector2(48, 0)
offset_right = 64.0
offset_bottom = 31.0
theme_type_variation = &"DialogicEventEdit"
text = " "
color = Color(1, 1, 1, 1)
script = ExtResource("1_l666a")
3 changes: 1 addition & 2 deletions addons/dialogic/Editor/Settings/settings_general.gd
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ func update_color_palette() -> void:
# Color Palette
for child in %Colors.get_children():
child.queue_free()
var _scale := DialogicUtil.get_editor_scale()
for color in DialogicUtil.get_color_palette():
var button := ColorPickerButton.new()
button.custom_minimum_size = Vector2(50 ,50)*scale
button.custom_minimum_size = Vector2(50 ,50) * DialogicUtil.get_editor_scale()
%Colors.add_child(button)
button.color = DialogicUtil.get_color(color)
button.color_changed.connect(_on_color_change)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@ extends Button
func _ready() -> void:
tooltip_text = visible_name

custom_minimum_size = Vector2(get_theme_font("font", 'Label').get_string_size(text).x+35,30)* DialogicUtil.get_editor_scale()
custom_minimum_size = Vector2(get_theme_font("font", 'Label').get_string_size(text).x+35,30) * DialogicUtil.get_editor_scale()

add_theme_color_override("font_color", get_theme_color("font_color", "Editor"))
add_theme_color_override("font_color_hover", get_theme_color("accent_color", "Editor"))
apply_base_button_style()


func apply_base_button_style() -> void:
var scale := DialogicUtil.get_editor_scale()
var nstyle :StyleBoxFlat= get_parent().get_theme_stylebox('normal', 'Button').duplicate()
nstyle.border_width_left = 5 *scale
nstyle.border_width_left = 5 * DialogicUtil.get_editor_scale()
add_theme_stylebox_override('normal', nstyle)
var hstyle :StyleBoxFlat= get_parent().get_theme_stylebox('hover', 'Button').duplicate()
hstyle.border_width_left = 5 *scale
hstyle.border_width_left = 5 * DialogicUtil.get_editor_scale()
add_theme_stylebox_override('hover', hstyle)
set_color(resource.event_color)

Expand All @@ -47,7 +46,7 @@ func set_color(color:Color) -> void:
func toggle_name(on:= false) -> void:
if !on:
text = ""
custom_minimum_size = Vector2(40, 40)*DialogicUtil.get_editor_scale()
custom_minimum_size = Vector2(40, 40) * DialogicUtil.get_editor_scale()
var style := get_theme_stylebox('normal', 'Button')
style.bg_color = style.border_color.darkened(0.2)
add_theme_stylebox_override('normal', style)
Expand All @@ -56,7 +55,7 @@ func toggle_name(on:= false) -> void:
add_theme_stylebox_override('hover', style)
else:
text = visible_name
custom_minimum_size = Vector2(get_theme_font("font", 'Label').get_string_size(text).x+35,30)* DialogicUtil.get_editor_scale()
custom_minimum_size = Vector2(get_theme_font("font", 'Label').get_string_size(text).x+35,30) * DialogicUtil.get_editor_scale()
apply_base_button_style()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ func finish_dragging():
################################################################################

func _draw() -> void:
var _scale := DialogicUtil.get_editor_scale()
var line_width := 5 * _scale
var horizontal_line_length := 100*_scale
var line_width := 5 * DialogicUtil.get_editor_scale()
var horizontal_line_length := 100 * DialogicUtil.get_editor_scale()
var color_multiplier := Color(1,1,1,0.25)
var selected_color_multiplier := Color(1,1,1,1)

Expand Down
Loading

0 comments on commit 8d0783a

Please sign in to comment.