First work on dialogic, resized guild, and started implementing portraits.
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
@tool
|
||||
extends DialogicLayoutLayer
|
||||
|
||||
## Layer that provides a popup with glossary info,
|
||||
## when hovering a glossary entry on a text node.
|
||||
|
||||
|
||||
@export_group('Text')
|
||||
enum Alignment {LEFT, CENTER, RIGHT}
|
||||
@export var title_alignment: Alignment = Alignment.LEFT
|
||||
@export var text_alignment: Alignment = Alignment.LEFT
|
||||
@export var extra_alignment: Alignment = Alignment.RIGHT
|
||||
|
||||
@export_subgroup("Colors")
|
||||
enum TextColorModes {GLOBAL, ENTRY, CUSTOM}
|
||||
@export var title_color_mode: TextColorModes = TextColorModes.ENTRY
|
||||
@export var title_custom_color: Color = Color.WHITE
|
||||
@export var text_color_mode: TextColorModes = TextColorModes.ENTRY
|
||||
@export var text_custom_color: Color = Color.WHITE
|
||||
@export var extra_color_mode: TextColorModes = TextColorModes.ENTRY
|
||||
@export var extra_custom_color: Color = Color.WHITE
|
||||
|
||||
|
||||
@export_group("Font")
|
||||
@export var font_use_global: bool = true
|
||||
@export_file('*.ttf', '*.tres') var font_custom: String = ""
|
||||
|
||||
@export_subgroup('Sizes')
|
||||
@export var font_title_size: int = 18
|
||||
@export var font_text_size: int = 17
|
||||
@export var font_extra_size: int = 15
|
||||
|
||||
|
||||
@export_group("Box")
|
||||
@export_subgroup("Color")
|
||||
enum ModulateModes {BASE_COLOR_ONLY, ENTRY_COLOR_ON_BOX, GLOBAL_BG_COLOR}
|
||||
@export var box_modulate_mode: ModulateModes = ModulateModes.ENTRY_COLOR_ON_BOX
|
||||
@export var box_base_modulate: Color = Color.WHITE
|
||||
@export_subgroup("Size")
|
||||
@export var box_width: int = 200
|
||||
|
||||
const MISSING_INDEX := -1
|
||||
func get_pointer() -> Control:
|
||||
return $Pointer
|
||||
|
||||
|
||||
func get_title() -> Label:
|
||||
return %Title
|
||||
|
||||
|
||||
func get_text() -> RichTextLabel:
|
||||
return %Text
|
||||
|
||||
|
||||
func get_extra() -> RichTextLabel:
|
||||
return %Extra
|
||||
|
||||
|
||||
func get_panel() -> PanelContainer:
|
||||
return %Panel
|
||||
|
||||
|
||||
func get_panel_point() -> PanelContainer:
|
||||
return %PanelPoint
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
get_pointer().hide()
|
||||
var text_system: Node = DialogicUtil.autoload().get(&'Text')
|
||||
var _error: int = 0
|
||||
_error = text_system.connect(&'animation_textbox_hide', get_pointer().hide)
|
||||
_error = text_system.connect(&'meta_hover_started', _on_dialogic_display_dialog_text_meta_hover_started)
|
||||
_error = text_system.connect(&'meta_hover_ended', _on_dialogic_display_dialog_text_meta_hover_ended)
|
||||
|
||||
|
||||
## Method that shows the bubble and fills in the info
|
||||
func _on_dialogic_display_dialog_text_meta_hover_started(meta: String) -> void:
|
||||
var entry_info := DialogicUtil.autoload().Glossary.get_entry(meta)
|
||||
|
||||
if entry_info.is_empty():
|
||||
return
|
||||
|
||||
get_pointer().show()
|
||||
get_title().text = entry_info.title
|
||||
get_text().text = entry_info.text
|
||||
get_text().text = ['', '[center]', '[right]'][text_alignment] + get_text().text
|
||||
get_extra().text = entry_info.extra
|
||||
get_extra().text = ['', '[center]', '[right]'][extra_alignment] + get_extra().text
|
||||
get_pointer().global_position = get_pointer().get_global_mouse_position()
|
||||
|
||||
if title_color_mode == TextColorModes.ENTRY:
|
||||
get_title().add_theme_color_override(&"font_color", entry_info.color)
|
||||
if text_color_mode == TextColorModes.ENTRY:
|
||||
get_text().add_theme_color_override(&"default_color", entry_info.color)
|
||||
if extra_color_mode == TextColorModes.ENTRY:
|
||||
get_extra().add_theme_color_override(&"default_color", entry_info.color)
|
||||
|
||||
match box_modulate_mode:
|
||||
ModulateModes.ENTRY_COLOR_ON_BOX:
|
||||
get_panel().self_modulate = entry_info.color
|
||||
get_panel_point().self_modulate = entry_info.color
|
||||
|
||||
|
||||
## Method that keeps the bubble at mouse position when visible
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
var pointer: Control = get_pointer()
|
||||
if pointer.visible:
|
||||
pointer.global_position = pointer.get_global_mouse_position()
|
||||
|
||||
|
||||
## Method that hides the bubble
|
||||
func _on_dialogic_display_dialog_text_meta_hover_ended(_meta:String) -> void:
|
||||
get_pointer().hide()
|
||||
|
||||
|
||||
|
||||
func _apply_export_overrides() -> void:
|
||||
# Apply fonts
|
||||
var font: FontFile
|
||||
var global_font_setting: String = get_global_setting(&"font", '')
|
||||
if font_use_global and ResourceLoader.exists(global_font_setting):
|
||||
font = load(global_font_setting)
|
||||
elif ResourceLoader.exists(font_custom):
|
||||
font = load(font_custom)
|
||||
|
||||
var title: Label = get_title()
|
||||
if font:
|
||||
title.add_theme_font_override(&"font", font)
|
||||
title.horizontal_alignment = title_alignment as HorizontalAlignment
|
||||
|
||||
# Apply font & sizes
|
||||
title.add_theme_font_size_override(&"font_size", font_title_size)
|
||||
var labels: Array[RichTextLabel] = [get_text(), get_extra()]
|
||||
var sizes: PackedInt32Array = [font_text_size, font_extra_size]
|
||||
for i : int in len(labels):
|
||||
if font:
|
||||
labels[i].add_theme_font_override(&'normal_font', font)
|
||||
|
||||
labels[i].add_theme_font_size_override(&"normal_font_size", sizes[i])
|
||||
labels[i].add_theme_font_size_override(&"bold_font_size", sizes[i])
|
||||
labels[i].add_theme_font_size_override(&"italics_font_size", sizes[i])
|
||||
labels[i].add_theme_font_size_override(&"bold_italics_font_size", sizes[i])
|
||||
labels[i].add_theme_font_size_override(&"mono_font_size", sizes[i])
|
||||
|
||||
|
||||
# Apply text colors
|
||||
# this applies Global or Custom colors, entry colors are applied on hover
|
||||
var controls: Array[Control] = [get_title(), get_text(), get_extra()]
|
||||
var settings: Array[StringName] = [&'font_color', &'default_color', &'default_color']
|
||||
var color_modes: Array[TextColorModes] = [title_color_mode, text_color_mode, extra_color_mode]
|
||||
var custom_colors: PackedColorArray = [title_custom_color, text_custom_color, extra_custom_color]
|
||||
for i : int in len(controls):
|
||||
match color_modes[i]:
|
||||
TextColorModes.GLOBAL:
|
||||
controls[i].add_theme_color_override(settings[i], get_global_setting(&'font_color', custom_colors[i]) as Color)
|
||||
TextColorModes.CUSTOM:
|
||||
controls[i].add_theme_color_override(settings[i], custom_colors[i])
|
||||
|
||||
# Apply box size
|
||||
var panel: PanelContainer = get_panel()
|
||||
panel.size.x = box_width
|
||||
panel.position.x = -box_width/2.0
|
||||
|
||||
# Apply box coloring
|
||||
match box_modulate_mode:
|
||||
ModulateModes.BASE_COLOR_ONLY:
|
||||
panel.self_modulate = box_base_modulate
|
||||
get_panel_point().self_modulate = box_base_modulate
|
||||
ModulateModes.GLOBAL_BG_COLOR:
|
||||
panel.self_modulate = get_global_setting(&'bg_color', box_base_modulate)
|
||||
get_panel_point().self_modulate = get_global_setting(&'bg_color', box_base_modulate)
|
||||
@@ -0,0 +1 @@
|
||||
uid://djuf2aqt5402a
|
||||
@@ -0,0 +1,87 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dsbwnp5hegnu3"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/glossary_popup_layer.gd" id="1_3nmfj"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a3cyk"]
|
||||
bg_color = Color(0.12549, 0.12549, 0.12549, 1)
|
||||
border_width_left = 2
|
||||
border_width_top = 4
|
||||
border_width_right = 4
|
||||
border_width_bottom = 2
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
expand_margin_left = 5.0
|
||||
expand_margin_top = 5.0
|
||||
expand_margin_right = 5.0
|
||||
expand_margin_bottom = 5.0
|
||||
|
||||
[node name="Glossary" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_3nmfj")
|
||||
|
||||
[node name="Pointer" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="Pointer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -81.0
|
||||
offset_top = -113.0
|
||||
offset_right = 86.0
|
||||
offset_bottom = -35.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_a3cyk")
|
||||
metadata/_edit_use_custom_anchors = true
|
||||
metadata/_edit_layout_mode = 1
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="Pointer/Panel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Title" type="Label" parent="Pointer/Panel/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Pointer/Panel/VBox"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Text" type="RichTextLabel" parent="Pointer/Panel/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
fit_content = true
|
||||
|
||||
[node name="Extra" type="RichTextLabel" parent="Pointer/Panel/VBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/normal_font_size = 15
|
||||
bbcode_enabled = true
|
||||
fit_content = true
|
||||
|
||||
[node name="Control" type="Control" parent="Pointer/Panel"]
|
||||
show_behind_parent = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
|
||||
[node name="PanelPoint" type="PanelContainer" parent="Pointer/Panel/Control"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = -0.999999
|
||||
offset_top = -14.0
|
||||
offset_right = 19.0
|
||||
offset_bottom = 6.0
|
||||
rotation = 0.75799
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_a3cyk")
|
||||
@@ -0,0 +1,7 @@
|
||||
[style]
|
||||
type = "Layer"
|
||||
name = "Popup Glossary"
|
||||
author = "Dialogic"
|
||||
description = "A popup that that appears when hovering glossary entries."
|
||||
scene = "glossary_popup_layer.tscn"
|
||||
icon = "popup_glossary_layer_icon.svg"
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg width="100" height="100" viewBox="0 0 26.458333 26.458333" version="1.1" id="svg13076" inkscape:export-filename="text_input_layer_icon.svg" inkscape:export-xdpi="96" inkscape:export-ydpi="96" inkscape:version="1.2.2 (732a01da63, 2022-12-09)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview id="namedview13078" pagecolor="#505050" bordercolor="#eeeeee" borderopacity="1" inkscape:showpageshadow="0" inkscape:pageopacity="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#505050" inkscape:document-units="mm" showgrid="true" inkscape:zoom="4.185" inkscape:cx="70.728793" inkscape:cy="64.755078" inkscape:window-width="1920" inkscape:window-height="1017" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="layer1">
|
||||
<inkscape:grid type="xygrid" id="grid14286" />
|
||||
</sodipodi:namedview>
|
||||
<defs id="defs13073" />
|
||||
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1">
|
||||
<path style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 3.9687497,20.505208 v -9.260417 l 9.2604173,2.645834 9.260416,-2.645834 v 9.260417 l -9.260416,2.645833 -9.2604173,-2.645833" id="path35151" sodipodi:nodetypes="ccccccc" />
|
||||
<path style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 13.229167,13.890625 v 9.260416" id="path35153" sodipodi:nodetypes="cc" />
|
||||
<rect style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" id="rect35155" width="10.583333" height="3.96875" x="7.9375" y="3.96875" ry="0.050781649" />
|
||||
<path style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 11.90625,7.9374999 c 1.322917,2.6458331 1.322917,2.6458331 1.322917,2.6458331 l 1.322916,-2.6458331 z" id="path35313" />
|
||||
<path style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 6.6145829,15.213541 3.9687501,1.322917" id="path35315" />
|
||||
<path style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 6.6145829,17.859374 3.9687501,1.322917" id="path35317" />
|
||||
<path style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 15.875,16.536458 3.96875,-1.322917" id="path35319" />
|
||||
<path style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 15.875,19.182291 3.96875,-1.322916" id="path35321" sodipodi:nodetypes="cc" />
|
||||
<path style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.88;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.2" d="m 15.875,19.182291 3.96875,-1.322916" id="path35323" sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,44 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c3q86ma7r6l57"
|
||||
path="res://.godot/imported/popup_glossary_layer_icon.svg-4af96bdb70714a5289a4ffe42cf8f357.ctex"
|
||||
metadata={
|
||||
"has_editor_variant": true,
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/popup_glossary_layer_icon.svg"
|
||||
dest_files=["res://.godot/imported/popup_glossary_layer_icon.svg-4af96bdb70714a5289a4ffe42cf8f357.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=0.3
|
||||
editor/scale_with_editor_scale=true
|
||||
editor/convert_colors_with_editor_theme=true
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dydv1g180rqex"
|
||||
path="res://.godot/imported/preview.png-573567ffd6162e40c78fe5aca0af73c9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/dialogic/Modules/DefaultLayoutParts/Layer_Glossary/preview.png"
|
||||
dest_files=["res://.godot/imported/preview.png-573567ffd6162e40c78fe5aca0af73c9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Reference in New Issue
Block a user