WTS/game/scripts/interface/currency.rpy

46 lines
1.2 KiB
Plaintext
Raw Normal View History

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"