work work
This commit is contained in:
parent
1ba3772b71
commit
0b1e33a97c
15 changed files with 140 additions and 0 deletions
12
gui/production_chart.gd
Normal file
12
gui/production_chart.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends VBoxContainer
|
||||
|
||||
func _ready() -> void:
|
||||
Economy.productions_update.connect(sync)
|
||||
|
||||
func sync(productions: Array[Production]):
|
||||
for child in get_children():
|
||||
child.queue_free()
|
||||
for p in productions:
|
||||
var display := preload("res://gui/production_display.tscn").instantiate()
|
||||
display.production = p
|
||||
add_child(display)
|
||||
1
gui/production_chart.gd.uid
Normal file
1
gui/production_chart.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://6u0icldaifvd
|
||||
6
gui/production_chart.tscn
Normal file
6
gui/production_chart.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene format=3 uid="uid://desvyn6e28oar"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://6u0icldaifvd" path="res://gui/production_chart.gd" id="1_esxju"]
|
||||
|
||||
[node name="ProductionChart" type="VBoxContainer" unique_id=1301678172]
|
||||
script = ExtResource("1_esxju")
|
||||
7
gui/production_display.gd
Normal file
7
gui/production_display.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Control
|
||||
|
||||
@export var production: Production
|
||||
|
||||
func _ready() -> void:
|
||||
%Name.text = production.currency.name
|
||||
%Amount.text = str(production.amount)
|
||||
1
gui/production_display.gd.uid
Normal file
1
gui/production_display.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ck17fbo6svid8
|
||||
18
gui/production_display.tscn
Normal file
18
gui/production_display.tscn
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene format=3 uid="uid://dmka51sldrutn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ck17fbo6svid8" path="res://gui/production_display.gd" id="1_dfe88"]
|
||||
|
||||
[node name="ProductionDisplay" type="MarginContainer" unique_id=253822540]
|
||||
custom_minimum_size = Vector2(400, 0)
|
||||
script = ExtResource("1_dfe88")
|
||||
|
||||
[node name="Name" type="Label" parent="." unique_id=1739229616]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "<Currency Name>"
|
||||
|
||||
[node name="Amount" type="Label" parent="." unique_id=660284845]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
text = "0"
|
||||
10
gui/production_ledger.gd
Normal file
10
gui/production_ledger.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends VBoxContainer
|
||||
|
||||
func _ready() -> void:
|
||||
Economy.production_log.connect(append)
|
||||
|
||||
func append(producer: Currency, production: Production):
|
||||
var display := preload("res://gui/production_log.tscn").instantiate()
|
||||
display.producer = producer
|
||||
display.production = production
|
||||
add_child(display)
|
||||
1
gui/production_ledger.gd.uid
Normal file
1
gui/production_ledger.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://5u2qeh5gvhhl
|
||||
6
gui/production_ledger.tscn
Normal file
6
gui/production_ledger.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene format=3 uid="uid://cxv743rjsolk5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5u2qeh5gvhhl" path="res://gui/production_ledger.gd" id="1_8f0gq"]
|
||||
|
||||
[node name="ProductionChart" type="VBoxContainer" unique_id=1301678172]
|
||||
script = ExtResource("1_8f0gq")
|
||||
14
gui/production_log.gd
Normal file
14
gui/production_log.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Control
|
||||
|
||||
@export var producer: Currency
|
||||
@export var production: Production
|
||||
|
||||
func _ready() -> void:
|
||||
%producer.text = producer.name
|
||||
%amount.text = str(abs(production.amount))
|
||||
if production.amount > 0:
|
||||
%type.text = "produced"
|
||||
else:
|
||||
%type.text = "consumed"
|
||||
|
||||
%production.text = production.currency.name
|
||||
1
gui/production_log.gd.uid
Normal file
1
gui/production_log.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cm5y8byaoeda5
|
||||
37
gui/production_log.tscn
Normal file
37
gui/production_log.tscn
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene format=3 uid="uid://dth0nxini731n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cm5y8byaoeda5" path="res://gui/production_log.gd" id="1_ei3g1"]
|
||||
|
||||
[node name="ProductionLog" type="MarginContainer" unique_id=253822540]
|
||||
script = ExtResource("1_ei3g1")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1073672077]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="producer" type="Label" parent="HBoxContainer" unique_id=1739229616]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "<Currency Name>"
|
||||
|
||||
[node name="type" type="Label" parent="HBoxContainer" unique_id=660284845]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
text = "produced"
|
||||
|
||||
[node name="amount" type="Label" parent="HBoxContainer" unique_id=146404186]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
text = "0"
|
||||
|
||||
[node name="text_produced2" type="Label" parent="HBoxContainer" unique_id=1784666448]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
text = "of"
|
||||
|
||||
[node name="production" type="Label" parent="HBoxContainer" unique_id=1547964707]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
text = "<currency name>"
|
||||
1
test/test_economy.gd
Normal file
1
test/test_economy.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends Control
|
||||
1
test/test_economy.gd.uid
Normal file
1
test/test_economy.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://6438cbkn3fhm
|
||||
24
test/test_economy.tscn
Normal file
24
test/test_economy.tscn
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[gd_scene format=3 uid="uid://d06w1wtct0mfs"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://6438cbkn3fhm" path="res://test/test_economy.gd" id="1_s48qe"]
|
||||
[ext_resource type="PackedScene" uid="uid://desvyn6e28oar" path="res://gui/production_chart.tscn" id="2_jd86c"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxv743rjsolk5" path="res://gui/production_ledger.tscn" id="3_jd7cj"]
|
||||
|
||||
[node name="TestEconomy" type="Control" unique_id=629898212]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_s48qe")
|
||||
|
||||
[node name="ProductionChart" parent="." unique_id=1301678172 instance=ExtResource("2_jd86c")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1023925432]
|
||||
custom_minimum_size = Vector2(600, 100)
|
||||
layout_mode = 0
|
||||
offset_left = 153.0
|
||||
offset_top = 346.0
|
||||
offset_right = 161.0
|
||||
offset_bottom = 346.0
|
||||
|
||||
[node name="ProductionChart2" parent="ScrollContainer" unique_id=1698529519 instance=ExtResource("3_jd7cj")]
|
||||
layout_mode = 2
|
||||
Loading…
Add table
Reference in a new issue