mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 16:13:23 +08:00
Edit browser.py
This commit is contained in:
parent
f11d4ac261
commit
203f659aac
@ -290,6 +290,7 @@ class CoopBrowserWindow(bui.Window):
|
|||||||
|
|
||||||
self._refresh()
|
self._refresh()
|
||||||
self._restore_state()
|
self._restore_state()
|
||||||
|
self._set_campaign_difficulty(self._campaign_difficulty, False)
|
||||||
|
|
||||||
# Even though we might display cached tournament data immediately, we
|
# Even though we might display cached tournament data immediately, we
|
||||||
# don't consider it valid until we've pinged.
|
# don't consider it valid until we've pinged.
|
||||||
@ -497,7 +498,11 @@ class CoopBrowserWindow(bui.Window):
|
|||||||
self._doing_tournament_query = False
|
self._doing_tournament_query = False
|
||||||
self._update_for_data(tournament_data)
|
self._update_for_data(tournament_data)
|
||||||
|
|
||||||
def _set_campaign_difficulty(self, difficulty: str) -> None:
|
def _set_campaign_difficulty(
|
||||||
|
self,
|
||||||
|
difficulty: str,
|
||||||
|
check: bool | True
|
||||||
|
) -> None:
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bauiv1lib.purchase import PurchaseWindow
|
from bauiv1lib.purchase import PurchaseWindow
|
||||||
|
|
||||||
@ -505,13 +510,17 @@ class CoopBrowserWindow(bui.Window):
|
|||||||
assert plus is not None
|
assert plus is not None
|
||||||
|
|
||||||
assert bui.app.classic is not None
|
assert bui.app.classic is not None
|
||||||
if difficulty != self._campaign_difficulty:
|
#if difficulty != self._campaign_difficulty
|
||||||
|
if True:
|
||||||
if (
|
if (
|
||||||
difficulty == 'hard'
|
difficulty == 'hard'
|
||||||
and not bui.app.classic.accounts.have_pro_options()
|
and not bui.app.classic.accounts.have_pro_options()
|
||||||
):
|
):
|
||||||
PurchaseWindow(items=['pro'])
|
if check:
|
||||||
return
|
PurchaseWindow(items=['pro'])
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
difficulty = 'easy'
|
||||||
bui.getsound('gunCocking').play()
|
bui.getsound('gunCocking').play()
|
||||||
if difficulty not in ('easy', 'hard'):
|
if difficulty not in ('easy', 'hard'):
|
||||||
print('ERROR: invalid campaign difficulty:', difficulty)
|
print('ERROR: invalid campaign difficulty:', difficulty)
|
||||||
@ -557,7 +566,9 @@ class CoopBrowserWindow(bui.Window):
|
|||||||
button_type='square',
|
button_type='square',
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
enable_sound=False,
|
enable_sound=False,
|
||||||
on_activate_call=bui.Call(self._set_campaign_difficulty, 'easy'),
|
on_activate_call=bui.Call(
|
||||||
|
self._set_campaign_difficulty, 'easy', True
|
||||||
|
),
|
||||||
on_select_call=bui.Call(self.sel_change, 'campaign', 'easyButton'),
|
on_select_call=bui.Call(self.sel_change, 'campaign', 'easyButton'),
|
||||||
color=sel_color
|
color=sel_color
|
||||||
if self._campaign_difficulty == 'easy'
|
if self._campaign_difficulty == 'easy'
|
||||||
@ -583,7 +594,9 @@ class CoopBrowserWindow(bui.Window):
|
|||||||
button_type='square',
|
button_type='square',
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
enable_sound=False,
|
enable_sound=False,
|
||||||
on_activate_call=bui.Call(self._set_campaign_difficulty, 'hard'),
|
on_activate_call=bui.Call(
|
||||||
|
self._set_campaign_difficulty, 'hard', True
|
||||||
|
),
|
||||||
on_select_call=bui.Call(self.sel_change, 'campaign', 'hardButton'),
|
on_select_call=bui.Call(self.sel_change, 'campaign', 'hardButton'),
|
||||||
color=sel_color_hard
|
color=sel_color_hard
|
||||||
if self._campaign_difficulty == 'hard'
|
if self._campaign_difficulty == 'hard'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user