Skip to content

Commit

Permalink
player list: use color border in color label and strings for all non …
Browse files Browse the repository at this point in the history
…attribute values
  • Loading branch information
dulvui committed Oct 11, 2024
1 parent 23fb7f0 commit 83b8777
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions game/src/ui_components/color_label/color_label.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ func set_value(value: Variant) -> void:
if is_instance_of(value, TYPE_INT):
if not label.label_settings:
label.label_settings = LabelSettings.new()
label.label_settings.outline_size = 2

if value < 11:
label.label_settings.font_color = Color.RED
#label.label_settings.font_color = Color.RED
label.label_settings.outline_color = Color.RED
elif value < 16:
label.label_settings.font_color = Color.BLUE
#label.label_settings.font_color = Color.BLUE
label.label_settings.outline_color = Color.BLUE
else:
label.label_settings.font_color = Color.DARK_GREEN
#label.label_settings.font_color = Color.DARK_GREEN
label.label_settings.outline_color = Color.DARK_GREEN

else:
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
Expand Down
6 changes: 3 additions & 3 deletions game/src/ui_components/player_list/player_list.gd
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ func _set_up_columns() -> void:
_add_column("general", "birth_date", birth_dates)
var presitge_stars: Callable = func(p: Player) -> String: return p.get_prestige_stars()
_add_column("general", "prestige", presitge_stars)
var moralities: Callable = func(p: Player) -> int: return p.morality
var moralities: Callable = func(p: Player) -> String: return Player.Morality.keys()[p.morality]
_add_column("general", "morality", moralities)

# contract
for c: Dictionary in Contract.new().get_property_list():
if c.usage == 4102:
var stats: Callable = func(p: Player) -> Variant: return p.contract.get(c.name)
var stats: Callable = func(p: Player) -> String: return str(p.contract.get(c.name))
_add_column("contract", c.name, stats)

# statistics
for s: Dictionary in Statistics.new().get_property_list():
if s.usage == 4102:
var stats: Callable = func(p: Player) -> Variant: return p.statistics.get(s.name)
var stats: Callable = func(p: Player) -> String: return str(p.statistics.get(s.name))
_add_column("statistics", s.name, stats)

# attributes
Expand Down

0 comments on commit 83b8777

Please sign in to comment.