diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-23 18:34:03 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-23 18:34:03 -0300 |
commit | d6aa65cec18510ac4943aa7e3edb816e8a1e1236 (patch) | |
tree | 758ed34562f4a0090a983b1dea8f5f590d954280 | |
parent | 09dd3c9ec3d60e1cc7410bd25901941bcdab88de (diff) | |
download | client-d6aa65cec18510ac4943aa7e3edb816e8a1e1236.tar.gz client-d6aa65cec18510ac4943aa7e3edb816e8a1e1236.tar.bz2 client-d6aa65cec18510ac4943aa7e3edb816e8a1e1236.tar.xz client-d6aa65cec18510ac4943aa7e3edb816e8a1e1236.zip |
Rudimentary support for square images being fetch from remote server.
-rw-r--r-- | game/03_init.rpy | 35 | ||||
-rw-r--r-- | game/gfx/square/0.png (renamed from game/gfx/square/units/0.png) | bin | 84957 -> 84957 bytes | |||
-rw-r--r-- | game/gfx/square/10000000.png (renamed from game/gfx/square/units/10000000.png) | bin | 222603 -> 222603 bytes | |||
-rw-r--r-- | game/inventory.rpy | 16 |
4 files changed, 42 insertions, 9 deletions
diff --git a/game/03_init.rpy b/game/03_init.rpy index 43e67e5..d659afa 100644 --- a/game/03_init.rpy +++ b/game/03_init.rpy @@ -49,6 +49,32 @@ init python: "sphere": %s }""" % (json.dumps(u), json.dumps(s)) + def square_composite(cid, path, ei=False): + # We need to try to get rarity + try: + r=allunits[int(cid)]["rare"] + except: + r=4 # FIXME + + # We need to try to get the element + try: + e=allunits[int(cid)]["attribute"] + except: + e=0 + + if not ei: + return Composite( + (340, 340), + (0, 0), "gfx/square/bg.png", + (0, 0), path, + (0, 0), "gfx/square/%d.png" % r) + else: + return Composite( + (340, 340), + (0, 0), "gfx/square/bg.png", + (0, 0), ExtraImage(path), + (0, 0), "gfx/square/%d.png" % r) + def card_composite(cid, path): # We need to try to get rarity try: @@ -196,7 +222,8 @@ init python: if file.startswith('gfx/square/'): if file.endswith('.png') or file.endswith('.webp'): name = "square_"+fn - renpy.image(name, Image(file, yanchor=1.0)) + #renpy.image(name, Image(file, yanchor=1.0)) + renpy.image(name, square_composite(fn, file)) dl=dl_search(persistent.allfiles, 0, name) if dl is ERR_INVALID: persistent.allfiles.append((name, file)) @@ -215,13 +242,13 @@ init python: # Overrides renpy.image() method - def new_img(name, where): + def new_img(name, where, isimage=True): # d: Downloaded path if not isinstance(name, tuple): name = tuple(name.split()) #d = renpy.renpy.easy.displayable(where) - if True or renpy.android: + if isimage: d=ExtraImage(where) else: d = renpy.renpy.easy.displayable(where) @@ -312,6 +339,8 @@ init python: # Maybe it is an unit if img.startswith("unit_"): new_img(img, card_composite(img.replace("unit_", ""), path[1])) + elif img.startswith("square_"): + new_img(img, square_composite(img.replace("square_", ""), path[1], ei=True), isimage=False) else: new_img(img, path[1]) diff --git a/game/gfx/square/units/0.png b/game/gfx/square/0.png Binary files differindex c50dcb1..c50dcb1 100644 --- a/game/gfx/square/units/0.png +++ b/game/gfx/square/0.png diff --git a/game/gfx/square/units/10000000.png b/game/gfx/square/10000000.png Binary files differindex ff8b137..ff8b137 100644 --- a/game/gfx/square/units/10000000.png +++ b/game/gfx/square/10000000.png diff --git a/game/inventory.rpy b/game/inventory.rpy index 8551079..c67b031 100644 --- a/game/inventory.rpy +++ b/game/inventory.rpy @@ -84,13 +84,17 @@ screen inventory(blank=False, filters="True"): #print str(item) #print str(alu) if evl: + python: + show_img("square_%d" % item["unit_id"], False) + try: + btn=At("square_%d" % item["unit_id"], czoom_70) + except: + btn=At("square_0", czoom_70) + traceback.print_exc() + stdout("[ERROR] ATCODE FOR square_%d is INVALID" % item["unit_id"]) + #btn=At("square_10000300", czoom_70) imagebutton: - idle At(Composite( - (340, 340), - (0, 0), "gfx/square/bg.png", - (0, 0), "gfx/square/units/%d.png" % item["unit_id"], - (0, 0), "gfx/square/%d.png" % allunits[item["unit_id"]]["rare"], - ), czoom_70) + idle btn action Return(i) #alternate "Show the char data chart" |