Refactor and bug fix
* Fixed Gold displayable restarting every interaction * Removed unused class
This commit is contained in:
parent
99b15859c0
commit
d4472d9a1f
@ -216,41 +216,3 @@ init python:
|
|||||||
# Change tier and reset progress
|
# Change tier and reset progress
|
||||||
self._points = 0
|
self._points = 0
|
||||||
self._tier = relative_tier
|
self._tier = relative_tier
|
||||||
|
|
||||||
class stats_class(dict):
|
|
||||||
|
|
||||||
def __delitem__(self, key):
|
|
||||||
"""Override delitem method to delete inner dictionary key."""
|
|
||||||
del self[key]
|
|
||||||
|
|
||||||
def __missing__(self, key):
|
|
||||||
"""Return zero if key does not exist in the inner dictionary."""
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
"""Override setattr method to add attributes as keys and values in the inner dictionary."""
|
|
||||||
self[name] = value
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
"""Override getattr method to return a value of the key from the inner dictionary."""
|
|
||||||
# Skip protected attributes and/or injected Ren'py methods
|
|
||||||
if not name.startswith("_"):
|
|
||||||
return self[name]
|
|
||||||
raise AttributeError("'"+self.__class__.__name__+"' has no attribute '"+name+"'")
|
|
||||||
|
|
||||||
def status(self):
|
|
||||||
"""Print currently defined keys and values in the console."""
|
|
||||||
for key, value in self.items():
|
|
||||||
print(key + " == " + str(value))
|
|
||||||
return
|
|
||||||
|
|
||||||
def reset(self):
|
|
||||||
"""Reset all key values back to default values depending on the value type."""
|
|
||||||
for key in self.keys():
|
|
||||||
if isinstance(self[key], (float, int)):
|
|
||||||
self[key] = 0
|
|
||||||
elif isinstance(self[key], bool):
|
|
||||||
self[key] = False
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
return
|
|
||||||
|
@ -73,6 +73,8 @@ screen gold(old, new):
|
|||||||
tag gold
|
tag gold
|
||||||
zorder 50
|
zorder 50
|
||||||
|
|
||||||
|
default d = DynamicDisplayable(show_gold, old, new)
|
||||||
|
|
||||||
frame:
|
frame:
|
||||||
xpadding 10
|
xpadding 10
|
||||||
ysize 44
|
ysize 44
|
||||||
@ -80,7 +82,7 @@ screen gold(old, new):
|
|||||||
background Frame(gui.format("interface/frames/{}/iconmed.webp"), 6, 6)
|
background Frame(gui.format("interface/frames/{}/iconmed.webp"), 6, 6)
|
||||||
pos (50, 50)
|
pos (50, 50)
|
||||||
|
|
||||||
add DynamicDisplayable(show_gold, old, new) yoffset 3
|
add d yoffset 3
|
||||||
|
|
||||||
timer 3.0 action Hide("gold")
|
timer 3.0 action Hide("gold")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user