Better variables management in top_bar

This commit is contained in:
Gouvernathor 2023-11-22 22:20:02 +01:00
parent 88b2373832
commit 294cb2c5ee

View File

@ -5,6 +5,20 @@ init python:
else:
return str(round(points/1000.0, 1))+"{size=-2}k{/size}"
# Set banners yanchor depending on the placement (ascending)
define housepoints_y = [None, 0.0, 0.25, 0.5, 0.75]
default slytherin_points = ""
default gryffindor_points = ""
default ravenclaw_points = ""
default hufflepuff_points = ""
default slytherin_place = 1
default gryffindor_place = 1
default ravenclaw_place = 1
default hufflepuff_place = 1
default persistent.toggle_points = False
label update_ui_points:
# Debug
@ -16,16 +30,13 @@ label update_ui_points:
$ hufflepuff_points = text_points(hufflepuff)
#Check who's in the lead
$ housepoints_sorted = sorted((slytherin, gryffindor, ravenclaw, hufflepuff), reverse=True)
$ renpy.dynamic(housepoints_sorted = sorted((slytherin, gryffindor, ravenclaw, hufflepuff), reverse=True))
$ slytherin_place = housepoints_sorted.index(slytherin)+1
$ gryffindor_place = housepoints_sorted.index(gryffindor)+1
$ ravenclaw_place = housepoints_sorted.index(ravenclaw)+1
$ hufflepuff_place = housepoints_sorted.index(hufflepuff)+1
# Set banners yanchor depending on the placement (ascending)
$ housepoints_y = [None, 0.0, 0.25, 0.5, 0.75]
return
screen ui_top_bar():
@ -147,7 +158,7 @@ screen ui_points():
tooltip "House Points\n{size=-2}Click to toggle style display{/size}"
hovered SetLocalVariable("toggle_points", True)
unhovered SetLocalVariable("toggle_points", False)
action ToggleVariable("persistent.toggle_points", True, False)
action ToggleField(persistent, "toggle_points", True, False)
style housepoints:
outlines [(1, "#000", 0, 0)]