LoafyLemon
df724981d2
* Added common style properties for houses * Added unique displayable for gold when in the main room * Unified currency screen to support arbitrary displayables and properties. * Unified transforms * Put interface elements onto interface layer * Hooked house points into the new currency screen * Improved animation and display of values during animation. * Allow independent animation of each supplied displayable * Remove redundant code
46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
init python:
|
|
def animate_int_value(st, at, old, new, prefix="G"):
|
|
if st > 1.0:
|
|
return Text(f"{prefix} {new}"), None
|
|
else:
|
|
if new > old:
|
|
value = int((new-old)*(1.0-st)) + 1
|
|
d = Text("{} {}\n+{}".format(prefix, old + int((new-old)*st), value))
|
|
else:
|
|
value = int((old-new)*(1.0-st)) + 1
|
|
d = Text("{} {}\n-{}".format(prefix, old - int((old-new)*st), value))
|
|
return d, 0.01
|
|
|
|
screen currency(old, new, prefix):
|
|
tag currency
|
|
layer "interface"
|
|
|
|
default d = DynamicDisplayable(animate_int_value, old, new, prefix)
|
|
|
|
frame:
|
|
xpadding 10
|
|
ysize 44
|
|
xminimum 80
|
|
background Frame(gui.format("interface/frames/{}/iconmed.webp"), 6, 6)
|
|
pos (50, 50)
|
|
|
|
add d yoffset 3
|
|
|
|
timer 3.0 action Hide("currency")
|
|
|
|
screen currency_alt(displayables, properties):
|
|
tag currency_alt
|
|
layer "interface"
|
|
|
|
hbox:
|
|
properties properties
|
|
|
|
for d in displayables:
|
|
add d
|
|
|
|
timer 4.0 action Hide("currency")
|
|
|
|
style currency_alt_text:
|
|
outlines [(2, "#000000", 0, 0)]
|
|
size 24
|
|
color "#daa520" |