Merge pull request #15 from Dliwk/fix-store-buy

Fix buy method in StoreBrowserWindow
This commit is contained in:
Eric Froemling 2020-04-09 22:04:42 -07:00 committed by GitHub
commit 29a0da417e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ class StoreBrowserWindow(ba.Window):
self._request: Any = None
self._r = 'store'
self._last_buy_time = None
self._last_buy_time: Optional[Union[float, int]] = None
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + extra_top),
@ -476,7 +476,8 @@ class StoreBrowserWindow(ba.Window):
# Prevent pressing buy within a few seconds of the last press
# (gives the buttons time to disable themselves and whatnot).
curtime = ba.time(ba.TimeType.REAL)
if self._last_buy_time is None or curtime - self._last_buy_time < 2.0:
if self._last_buy_time is not None and (curtime -
self._last_buy_time) < 2.0:
ba.playsound(ba.getsound('error'))
else:
if _ba.get_account_state() != 'signed_in':