2024-04-25 19:39:50 +00:00
|
|
|
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):
|
2024-04-27 17:12:13 +00:00
|
|
|
tag currency
|
|
|
|
layer "interface"
|
2024-04-25 19:39:50 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-04-27 17:12:13 +00:00
|
|
|
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"
|