Lots of usability imporvements

This commit is contained in:
Segey Lapin
2019-08-09 06:35:06 +03:00
parent 95a76feb53
commit 59e0b46384
25 changed files with 5190 additions and 429 deletions

View File

@@ -0,0 +1,40 @@
extends Control
func update_desc():
var sel: TreeItem = $v/Tree.get_selected()
if sel:
var desc = sel.get_metadata(0).description
$v/desc.text = desc
else:
$v/desc.text = ""
func display_journal():
if visible:
$v/Tree.clear()
var queue = []
for k in world.quests:
queue.push_back({"obj": k, "parent": null})
while queue.size() > 0:
var item = queue[0]
queue.pop_front()
var ti: TreeItem
if item.parent == null:
ti = $v/Tree.create_item()
else:
ti = $v/Tree.create_item(item.parent)
ti.set_text(0, "Quest: " + item.obj.get_title())
ti.set_metadata(0, {"description": item.obj.get_description()})
if item.obj.is_complete():
ti.set_text(1, "COMPLETE")
for o in item.obj._objectives:
var te: TreeItem = $v/Tree.create_item(ti)
te.set_text(0, "Task: " + o.get_title())
if o.is_complete():
te.set_text(1, "COMPLETE")
te.set_metadata(0, {"description": o.get_title()})
for o in item.obj._children:
queue.push_back({"obj": o, "parent": ti})
update_desc()
func _ready():
connect("visibility_changed", self, "display_journal")
$v/okbutton.connect("pressed", self, "hide")
$v/Tree.connect("item_selected", self, "update_desc")

View File

@@ -0,0 +1,51 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://ui/quest_journal.gd" type="Script" id=1]
[ext_resource path="res://fonts/DroidSansFallback.ttf" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=1]
size = 18
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=2]
size = 18
font_data = ExtResource( 2 )
[node name="quest_journal" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="v" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="v"]
margin_right = 1024.0
margin_bottom = 14.0
text = "QUEST JOURNAL"
align = 1
[node name="Tree" type="Tree" parent="v"]
margin_top = 18.0
margin_right = 1024.0
margin_bottom = 295.0
size_flags_vertical = 3
custom_fonts/title_button_font = SubResource( 1 )
custom_fonts/font = SubResource( 2 )
columns = 2
[node name="desc" type="RichTextLabel" parent="v"]
margin_top = 299.0
margin_right = 1024.0
margin_bottom = 576.0
size_flags_vertical = 3
[node name="okbutton" type="Button" parent="v"]
margin_top = 580.0
margin_right = 1024.0
margin_bottom = 600.0
text = "CLOSE"

View File

@@ -24,6 +24,7 @@ func _process(delta):
expose_time = 0.0
cooldown_time = 2.0
show()
release_focus()
if expose_time > 10.0:
if visible:
hide()