You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3 KiB

extends GridContainer
onready var game = owner as Game
func _ready():
yield(get_tree(),"idle_frame")
for country in game.countries:
country.connect("state_changed", self, "refresh")
for player in game.players:
player.connect("state_changed", self, "refresh")
refresh()
func refresh():
for child in get_children():
child.queue_free()
add_label("Country")
for country in game.countries:
if country.id == 0: continue
add_label(country.name)
add_label("Money")
for player in game.players:
add_label(player.name)
var country_id = 0
for stock in player.stocks:
if country_id != 0:
add_label(str(stock) + ("/" if game.countries[country_id].player_acceptance[player.id] else " "))
country_id += 1
add_label(str(player.money) + "$")
add_label("Money")
for country in game.countries:
if country.id == 0: continue
add_label(
str(country.money) + \
"(" + signify(country.get_net_profit()) + ")" + \
"$"
)
add_label("")
add_label("Stock price")
for country in game.countries:
if country.id == 0: continue
add_label(
str(country.stock_price) + \
("(" + signify(country.proposal) + ")" if country.proposal != 0 else "") + \
"$"
)
func signify(num):
return ("+" if num >= 0 else "-") + str(abs(num))
func add_label(text):
var label = Label.new()
label.text = str(text)
add_child(label)
return label