Added dialogue with pricelists

This commit is contained in:
2ndbeam 2024-05-22 13:51:54 +03:00
commit a6f9b11c43
17 changed files with 114 additions and 21 deletions

View file

@ -1,14 +1,27 @@
extends NinePatchRect
## This message will trigger buy/sell node to fetch buy prices
const BUY_FETCH = "BASE_FETCH_BUY"
## This message will trigger buy/sell node to fetch sell prices
const SELL_FETCH = "BASE_FETCH_SELL"
@onready var dialogue = $DialogueView
@onready var buy_sell = $"../../BuySell"
func _ready():
var tween = create_tween() \
.tween_property(dialogue,"visible_ratio",1.0, 2)
print(len(dialogue.text))
func send_message(msg: Message):
var new_msg = tr(msg.fact + "_RECEIVED")
var format = {}
match msg.fact:
BUY_FETCH:
format["sell_list"] = buy_sell.get_buy_sell_list(false)
SELL_FETCH:
format["buy_list"] = buy_sell.get_buy_sell_list(true)
var new_msg = tr(msg.fact + "_RECEIVED").format(format)
print(format)
var old_len = len(dialogue.get_parsed_text())
dialogue.append_text(new_msg)
dialogue.visible_characters = old_len