33 lines
1.1 KiB
GDScript
33 lines
1.1 KiB
GDScript
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"
|
|
@onready var actions_menu = $"../Actions/ActionsMenu"
|
|
|
|
func _ready():
|
|
var tween = create_tween() \
|
|
.tween_property(dialogue,"visible_ratio",1.0, 2)
|
|
|
|
func send_message(msg: Message):
|
|
var format = {}
|
|
match msg.fact:
|
|
BUY_FETCH:
|
|
format["sell_list"] = buy_sell.get_buy_sell_list(false)
|
|
actions_menu.buy = false
|
|
actions_menu.buy_sell_options = buy_sell.get_buy_sell_len(false)
|
|
SELL_FETCH:
|
|
format["buy_list"] = buy_sell.get_buy_sell_list(true)
|
|
actions_menu.buy = true
|
|
actions_menu.buy_sell_options = buy_sell.get_buy_sell_len(true)
|
|
|
|
var new_msg = tr(msg.fact + "_RECEIVED").format(format)
|
|
var old_len = len(dialogue.get_parsed_text())
|
|
dialogue.append_text(new_msg)
|
|
dialogue.visible_characters = old_len
|
|
var tween = create_tween() \
|
|
.tween_property(dialogue,"visible_ratio",1.0, 2)
|