Skip to content

Commit

Permalink
Fix and improve default dd_dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
fleskesvor committed May 16, 2018
1 parent ab6ee24 commit dc917c2
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 74 deletions.
Binary file not shown.
Binary file added device/demo/ui/dd_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions device/demo/ui/dd_background.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/dd_background.png-64455d0cae41512fd268622c2df4b837.stex"

[deps]

source_file="res://demo/ui/dd_background.png"
source_md5="eb05b069e161620b0e759edd3b3091ea"

dest_files=[ "res://.import/dd_background.png-64455d0cae41512fd268622c2df4b837.stex" ]
dest_md5="102ac34dffa3ad96f81d7c422c9ff96d"

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
116 changes: 45 additions & 71 deletions device/demo/ui/dd_default.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://globals/dialog_dialog.gd" type="Script" id=1]
[ext_resource path="res://demo/ui/dialog_theme.tres" type="Theme" id=2]
[ext_resource path="res://demo/ui/dd_background.png" type="Texture" id=2]
[ext_resource path="res://demo/ui/dialog_theme.tres" type="Theme" id=3]


[sub_resource type="Animation" id=4]
[sub_resource type="Animation" id=1]

length = 0.75
loop = false
Expand Down Expand Up @@ -34,7 +34,7 @@ tracks/1/keys = {
"values": [ Vector2( 1, 1 ), Vector2( 1, 1.1 ), Vector2( 1, 1.1 ), Vector2( 1, 0 ) ]
}

[sub_resource type="Animation" id=5]
[sub_resource type="Animation" id=2]

length = 0.75
loop = false
Expand Down Expand Up @@ -76,73 +76,58 @@ tracks/2/keys = {
"values": [ true ]
}

[node name="dialog" type="Control" index="0"]
[node name="dialog" type="Control"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 539.0
margin_top = 398.0
margin_right = -58.0
margin_bottom = -203.0
anchor_bottom = 0.0
margin_left = 500.0
margin_top = 200.0
margin_right = -500.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
script = ExtResource( 1 )
__meta__ = {
"__editor_plugin_screen__": "2D"
}
mouse_enter_color = Color( 1, 1, 0.3, 1 )
mouse_enter_shadow_color = Color( 0.6, 0.4, 0, 1 )
mouse_exit_color = Color( 1, 1, 1, 1 )
mouse_exit_shadow_color = Color( 1, 1, 1, 1 )
_sections_unfolded = [ "Anchor", "Margin", "Mouse", "Rect", "Visibility" ]

[node name="anchor" type="CenterContainer" parent="." index="0"]
[node name="anchor" type="Node2D" parent="." index="0"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
use_top_left = false
_sections_unfolded = [ "Transform" ]

[node name="bg" type="TextureRect" parent="anchor" index="0"]

modulate = Color( 0, 0, 0, 0.392157 )
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 814.0
margin_top = 114.0
margin_right = 814.0
margin_bottom = 114.0
margin_right = 900.0
margin_bottom = 400.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource( 2 )
expand = true
stretch_mode = 0
_sections_unfolded = [ "Margin", "Mouse", "Rect", "Size Flags", "Visibility" ]

[node name="scroll" type="ScrollContainer" parent="anchor" index="1"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1628.0
margin_bottom = 229.0
rect_min_size = Vector2( 1628, 229 )
margin_left = 50.0
margin_top = 50.0
margin_right = 850.0
margin_bottom = 350.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
mouse_filter = 0
Expand All @@ -153,21 +138,20 @@ scroll_horizontal_enabled = true
scroll_horizontal = 0
scroll_vertical_enabled = true
scroll_vertical = 0
_sections_unfolded = [ "Margin", "Rect" ]

[node name="container" type="VBoxContainer" parent="anchor/scroll" index="0"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1628.0
margin_bottom = 229.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_horizontal = 1
size_flags_vertical = 1
custom_constants/separation = 10
alignment = 0

Expand All @@ -185,58 +169,48 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = -338.0
margin_top = 134.0
margin_right = 1270.0
margin_bottom = 163.0
rect_min_size = Vector2( 800, 29 )
margin_bottom = 35.0
rect_min_size = Vector2( 0, 35 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
size_flags_horizontal = 1
size_flags_vertical = 1
_sections_unfolded = [ "Rect" ]

[node name="button" type="TextureButton" parent="item" index="0"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
anchor_right = 0.0
anchor_bottom = 0.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null

[node name="label" type="Label" parent="item/button" index="0"]

modulate = Color( 0, 0, 0, 1 )
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 25.0
margin_top = 3.0
margin_right = 1605.0
margin_bottom = 36.0
rect_min_size = Vector2( 1580, 33 )
margin_bottom = 14.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 0
theme = ExtResource( 2 )
text = "I should pick option one"
valign = 1
autowrap = true
size_flags_horizontal = 1
size_flags_vertical = 4
theme = ExtResource( 3 )
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
Expand All @@ -248,8 +222,8 @@ autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
anims/hide = SubResource( 4 )
anims/show = SubResource( 5 )
anims/hide = SubResource( 1 )
anims/show = SubResource( 2 )
blend_times = [ ]


5 changes: 2 additions & 3 deletions device/globals/dialog_dialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ func start(params, p_context):

label.set_text(text)
but.connect("pressed", self, "selected", [i])
but.connect("mouse_entered",self,"_on_mouse_enter",[but])
but.connect("mouse_exited",self,"_on_mouse_exit",[but])
label.connect("mouse_entered", self, "_on_mouse_enter", [but])
label.connect("mouse_exited", self, "_on_mouse_exit", [but])

var height_ratio = ProjectSettings.get_setting("escoria/platform/dialog_option_height")
var size = it.get_custom_minimum_size()
size.y = size.y * height_ratio
it.set_custom_minimum_size(size)


container.add_child(it)
if i == 0:
but.grab_focus()
Expand Down

0 comments on commit dc917c2

Please sign in to comment.