Started quest system implementation
This commit is contained in:
35
proto2/ui/start_quest_notification.gd
Normal file
35
proto2/ui/start_quest_notification.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
extends Control
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var expose_time:float = 0.0
|
||||
var cooldown_time: float = 0.0
|
||||
var queue = []
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if queue.size() > 0:
|
||||
if cooldown_time <= 0.0:
|
||||
var item = queue[0]
|
||||
queue.pop_front()
|
||||
if visible:
|
||||
hide()
|
||||
$v/quest_title.text = item.title
|
||||
$v/quest_desc.text = item.desc
|
||||
expose_time = 0.0
|
||||
cooldown_time = 2.0
|
||||
show()
|
||||
if expose_time > 10.0:
|
||||
if visible:
|
||||
hide()
|
||||
cooldown_time -= delta
|
||||
else:
|
||||
expose_time += delta
|
||||
func start_notification(title, desc):
|
||||
queue.push_back({"title": title, "desc": desc})
|
||||
print("start notification", title)
|
||||
58
proto2/ui/start_quest_notification.tscn
Normal file
58
proto2/ui/start_quest_notification.tscn
Normal file
@@ -0,0 +1,58 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://ui/start_quest_notification.gd" type="Script" id=1]
|
||||
|
||||
[node name="start_quest_notification" type="Control"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -90.0
|
||||
margin_top = -40.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 40.0
|
||||
rect_min_size = Vector2( 180, 80 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -93.0
|
||||
margin_top = -34.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 34.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="msg" type="Label" parent="v"]
|
||||
margin_right = 186.0
|
||||
margin_bottom = 14.0
|
||||
text = "Starting quest:"
|
||||
align = 1
|
||||
|
||||
[node name="quest_title" type="Label" parent="v"]
|
||||
margin_top = 18.0
|
||||
margin_right = 186.0
|
||||
margin_bottom = 32.0
|
||||
text = "quest title"
|
||||
align = 1
|
||||
|
||||
[node name="quest_desc" type="Label" parent="v"]
|
||||
margin_top = 36.0
|
||||
margin_right = 186.0
|
||||
margin_bottom = 50.0
|
||||
text = "quest description"
|
||||
align = 3
|
||||
|
||||
[node name="msg2" type="Label" parent="v"]
|
||||
margin_top = 54.0
|
||||
margin_right = 186.0
|
||||
margin_bottom = 68.0
|
||||
text = "Quest added to your journal"
|
||||
align = 1
|
||||
Reference in New Issue
Block a user