mirror of
https://github.com/tonytins/citylimits
synced 2025-12-16 21:24:43 -05:00
Tax system
- New tax system - Advisor window modeled after SC3k's - Advisor start_dialogue() function is now connected to a SimEvent "advisor_message" signal - Advisor windows are now autoloaded and no longer part of the core interface node - Added 3D buildings from Micropolis repo
This commit is contained in:
parent
49a1186115
commit
e5505a3244
243 changed files with 3853 additions and 224 deletions
41
scripts/advisor_window.gd
Normal file
41
scripts/advisor_window.gd
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
extends AcceptDialog
|
||||
|
||||
export(String, FILE, "*.json") var dialogue_file
|
||||
# "character" would be "name" but it's already used by the base class
|
||||
export var character: String
|
||||
export var rank: String
|
||||
export(Texture) var avatar
|
||||
|
||||
var dialogue_keys = []
|
||||
var dialogue_name = ""
|
||||
var dialogue_text = ""
|
||||
|
||||
onready var avatar_texture = $Container/Advisor/Avatar
|
||||
onready var rank_label = $Container/Advisor/RankLbl
|
||||
onready var name_label = $Container/Advisor/NameLbl
|
||||
onready var description_label = $Container/DescriptionLbl
|
||||
|
||||
func _start_dialogue(message):
|
||||
_load_dialogue(dialogue_file)
|
||||
_index_dialogue()
|
||||
description_label.text = dialogue_keys[message].text
|
||||
window_title = dialogue_keys[message].name
|
||||
show()
|
||||
|
||||
func _index_dialogue():
|
||||
var dialogue = _load_dialogue(dialogue_file)
|
||||
dialogue_keys.clear()
|
||||
for key in dialogue:
|
||||
dialogue_keys.append(dialogue[key])
|
||||
|
||||
func _load_dialogue(file_path):
|
||||
var file = File.new()
|
||||
if file.file_exists(file_path):
|
||||
file.open(file_path, file.READ)
|
||||
var dialogue = parse_json(file.get_as_text())
|
||||
return dialogue
|
||||
|
||||
func _ready():
|
||||
avatar_texture.texture = avatar
|
||||
name_label.text = character
|
||||
rank_label.text = rank
|
||||
Loading…
Add table
Add a link
Reference in a new issue