mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 16:13:23 +08:00
Update browser.py
This commit is contained in:
parent
bd6e8f9822
commit
d79b5773f2
@ -104,6 +104,19 @@ class CoopBrowserWindow(bui.Window):
|
|||||||
'campaignDifficulty', 'easy'
|
'campaignDifficulty', 'easy'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (
|
||||||
|
self._campaign_difficulty == 'hard'
|
||||||
|
and not app.classic.accounts.have_pro_options()
|
||||||
|
):
|
||||||
|
plus.add_v1_account_transaction(
|
||||||
|
{
|
||||||
|
'type': 'SET_MISC_VAL',
|
||||||
|
'name': 'campaignDifficulty',
|
||||||
|
'value': 'easy',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self._campaign_difficulty = 'easy'
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
root_widget=bui.containerwidget(
|
root_widget=bui.containerwidget(
|
||||||
size=(self._width, self._height + top_extra),
|
size=(self._width, self._height + top_extra),
|
||||||
@ -290,7 +303,6 @@ 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.
|
||||||
@ -498,11 +510,7 @@ 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(
|
def _set_campaign_difficulty(self, difficulty: str) -> None:
|
||||||
self,
|
|
||||||
difficulty: str,
|
|
||||||
check: bool
|
|
||||||
) -> None:
|
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bauiv1lib.purchase import PurchaseWindow
|
from bauiv1lib.purchase import PurchaseWindow
|
||||||
|
|
||||||
@ -510,16 +518,13 @@ 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()
|
||||||
):
|
):
|
||||||
if check:
|
PurchaseWindow(items=['pro'])
|
||||||
PurchaseWindow(items=['pro'])
|
return
|
||||||
return
|
|
||||||
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)
|
||||||
@ -565,9 +570,7 @@ 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(
|
on_activate_call=bui.Call(self._set_campaign_difficulty, 'easy'),
|
||||||
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'
|
||||||
@ -593,9 +596,7 @@ 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(
|
on_activate_call=bui.Call(self._set_campaign_difficulty, 'hard'),
|
||||||
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