mirror of
https://github.com/tonytins/citylimits
synced 2025-12-16 21:24:43 -05:00
Streamlined advisor window
- Streamlined advisor window messages through signals. - Added TODO file - Ignore /except directory - News ticker based on the advisor code with text from SC3k with news from the game, with some exceptions. - New SC3k-like interface. - Added icons from Font Awesome.
This commit is contained in:
parent
e5505a3244
commit
d1da70a099
38 changed files with 1738 additions and 413 deletions
|
|
@ -1,10 +1,10 @@
|
|||
extends AcceptDialog
|
||||
|
||||
export(String, FILE, "*.json") var dialogue_file
|
||||
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 character
|
||||
var rank
|
||||
var avatar
|
||||
|
||||
var dialogue_keys = []
|
||||
var dialogue_name = ""
|
||||
|
|
@ -15,27 +15,37 @@ 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)
|
||||
func _start_dialogue(advisor, message):
|
||||
if advisor == SimData.Advisors.CITY_PLANNER:
|
||||
dialogue_file = "res://dialog/cityplanner.json"
|
||||
_load_dialogue()
|
||||
avatar_texture.texture = preload("res://sprites/avatars/zc.png")
|
||||
name_label.text = "Zack Casey"
|
||||
rank_label.text = "City Planner"
|
||||
elif advisor == SimData.Advisors.FINANCIAL:
|
||||
dialogue_file = "res://dialog/finacial.json"
|
||||
_load_dialogue()
|
||||
avatar_texture.texture = preload("res://sprites/avatars/kit.png")
|
||||
name_label.text = "Kit Welsh"
|
||||
rank_label.text = "Financial Advisor"
|
||||
|
||||
_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)
|
||||
var dialogue = _load_dialogue()
|
||||
dialogue_keys.clear()
|
||||
for key in dialogue:
|
||||
dialogue_keys.append(dialogue[key])
|
||||
|
||||
func _load_dialogue(file_path):
|
||||
func _load_dialogue():
|
||||
var file = File.new()
|
||||
if file.file_exists(file_path):
|
||||
file.open(file_path, file.READ)
|
||||
if file.file_exists(dialogue_file):
|
||||
file.open(dialogue_file, 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
|
||||
SimEvents.connect("advisor_message", self, "_start_dialogue")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue