mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 15:03:33 +08:00
more still
This commit is contained in:
parent
b329d10c61
commit
77dc36f8d0
@ -6,9 +6,9 @@ from __future__ import annotations
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _babase
|
import babase
|
||||||
import _bauiv1
|
import bauiv1
|
||||||
import _bascenev1
|
import bascenev1
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Callable, Any
|
from typing import Callable, Any
|
||||||
@ -37,15 +37,15 @@ class AdsSubsystem:
|
|||||||
from babase._language import Lstr
|
from babase._language import Lstr
|
||||||
|
|
||||||
# Print this message once every 10 minutes at most.
|
# Print this message once every 10 minutes at most.
|
||||||
tval = _babase.apptime()
|
tval = babase.apptime()
|
||||||
if self.last_in_game_ad_remove_message_show_time is None or (
|
if self.last_in_game_ad_remove_message_show_time is None or (
|
||||||
tval - self.last_in_game_ad_remove_message_show_time > 60 * 10
|
tval - self.last_in_game_ad_remove_message_show_time > 60 * 10
|
||||||
):
|
):
|
||||||
self.last_in_game_ad_remove_message_show_time = tval
|
self.last_in_game_ad_remove_message_show_time = tval
|
||||||
with _babase.ContextRef.empty():
|
with babase.ContextRef.empty():
|
||||||
_babase.apptimer(
|
babase.apptimer(
|
||||||
1.0,
|
1.0,
|
||||||
lambda: _babase.screenmessage(
|
lambda: babase.screenmessage(
|
||||||
Lstr(
|
Lstr(
|
||||||
resource='removeInGameAdsText',
|
resource='removeInGameAdsText',
|
||||||
subs=[
|
subs=[
|
||||||
@ -65,7 +65,7 @@ class AdsSubsystem:
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
self.last_ad_purpose = purpose
|
self.last_ad_purpose = purpose
|
||||||
_bauiv1.show_ad(purpose, on_completion_call)
|
bauiv1.show_ad(purpose, on_completion_call)
|
||||||
|
|
||||||
def show_ad_2(
|
def show_ad_2(
|
||||||
self,
|
self,
|
||||||
@ -74,7 +74,7 @@ class AdsSubsystem:
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""(internal)"""
|
"""(internal)"""
|
||||||
self.last_ad_purpose = purpose
|
self.last_ad_purpose = purpose
|
||||||
_bauiv1.show_ad_2(purpose, on_completion_call)
|
bauiv1.show_ad_2(purpose, on_completion_call)
|
||||||
|
|
||||||
def call_after_ad(self, call: Callable[[], Any]) -> None:
|
def call_after_ad(self, call: Callable[[], Any]) -> None:
|
||||||
"""Run a call after potentially showing an ad."""
|
"""Run a call after potentially showing an ad."""
|
||||||
@ -82,7 +82,7 @@ class AdsSubsystem:
|
|||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
|
|
||||||
app = _babase.app
|
app = babase.app
|
||||||
plus = app.plus
|
plus = app.plus
|
||||||
classic = app.classic
|
classic = app.classic
|
||||||
assert plus is not None
|
assert plus is not None
|
||||||
@ -90,12 +90,12 @@ class AdsSubsystem:
|
|||||||
show = True
|
show = True
|
||||||
|
|
||||||
# No ads without net-connections, etc.
|
# No ads without net-connections, etc.
|
||||||
if not _bauiv1.can_show_ad():
|
if not bauiv1.can_show_ad():
|
||||||
show = False
|
show = False
|
||||||
if classic.accounts.have_pro():
|
if classic.accounts.have_pro():
|
||||||
show = False # Pro disables interstitials.
|
show = False # Pro disables interstitials.
|
||||||
try:
|
try:
|
||||||
session = _bascenev1.get_foreground_host_session()
|
session = bascenev1.get_foreground_host_session()
|
||||||
assert session is not None
|
assert session is not None
|
||||||
is_tournament = session.tournament_id is not None
|
is_tournament = session.tournament_id is not None
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -128,7 +128,7 @@ class AdsSubsystem:
|
|||||||
# ad-show-threshold and see if we should *actually* show
|
# ad-show-threshold and see if we should *actually* show
|
||||||
# (we reach our threshold faster the longer we've been
|
# (we reach our threshold faster the longer we've been
|
||||||
# playing).
|
# playing).
|
||||||
base = 'ads' if _bauiv1.has_video_ads() else 'ads2'
|
base = 'ads' if bauiv1.has_video_ads() else 'ads2'
|
||||||
min_lc = plus.get_v1_account_misc_read_val(base + '.minLC', 0.0)
|
min_lc = plus.get_v1_account_misc_read_val(base + '.minLC', 0.0)
|
||||||
max_lc = plus.get_v1_account_misc_read_val(base + '.maxLC', 5.0)
|
max_lc = plus.get_v1_account_misc_read_val(base + '.maxLC', 5.0)
|
||||||
min_lc_scale = plus.get_v1_account_misc_read_val(
|
min_lc_scale = plus.get_v1_account_misc_read_val(
|
||||||
@ -166,7 +166,7 @@ class AdsSubsystem:
|
|||||||
self.last_ad_completion_time is None
|
self.last_ad_completion_time is None
|
||||||
or (
|
or (
|
||||||
interval is not None
|
interval is not None
|
||||||
and _babase.apptime() - self.last_ad_completion_time
|
and babase.apptime() - self.last_ad_completion_time
|
||||||
> (interval * interval_mult)
|
> (interval * interval_mult)
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
@ -201,12 +201,12 @@ class AdsSubsystem:
|
|||||||
+ 's ago); purpose='
|
+ 's ago); purpose='
|
||||||
+ app.classic.ads.last_ad_purpose
|
+ app.classic.ads.last_ad_purpose
|
||||||
)
|
)
|
||||||
_babase.pushcall(self._call)
|
babase.pushcall(self._call)
|
||||||
self._ran = True
|
self._ran = True
|
||||||
|
|
||||||
payload = _Payload(call)
|
payload = _Payload(call)
|
||||||
with _babase.ContextRef.empty():
|
with babase.ContextRef.empty():
|
||||||
_babase.apptimer(5.0, lambda: payload.run(fallback=True))
|
babase.apptimer(5.0, lambda: payload.run(fallback=True))
|
||||||
self.show_ad('between_game', on_completion_call=payload.run)
|
self.show_ad('between_game', on_completion_call=payload.run)
|
||||||
else:
|
else:
|
||||||
_babase.pushcall(call) # Just run the callback without the ad.
|
babase.pushcall(call) # Just run the callback without the ad.
|
||||||
|
|||||||
@ -6,8 +6,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import _babase
|
import babase
|
||||||
import _bascenev1
|
import bascenev1
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
pass
|
pass
|
||||||
@ -17,15 +17,17 @@ def game_begin_analytics() -> None:
|
|||||||
"""Update analytics events for the start of a game."""
|
"""Update analytics events for the start of a game."""
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=cyclic-import
|
# pylint: disable=cyclic-import
|
||||||
from bascenev1._dualteamsession import DualTeamSession
|
from bascenev1 import (
|
||||||
from bascenev1._freeforallsession import FreeForAllSession
|
DualTeamSession,
|
||||||
from bascenev1._coopsession import CoopSession
|
FreeForAllSession,
|
||||||
from bascenev1._gameactivity import GameActivity
|
CoopSession,
|
||||||
|
GameActivity,
|
||||||
|
)
|
||||||
|
|
||||||
assert _babase.app.classic is not None
|
assert babase.app.classic is not None
|
||||||
|
|
||||||
activity = _bascenev1.getactivity(False)
|
activity = bascenev1.getactivity(False)
|
||||||
session = _bascenev1.getsession(False)
|
session = bascenev1.getsession(False)
|
||||||
|
|
||||||
# Fail gracefully if we didn't cleanly get a session and game activity.
|
# Fail gracefully if we didn't cleanly get a session and game activity.
|
||||||
if not activity or not session or not isinstance(activity, GameActivity):
|
if not activity or not session or not isinstance(activity, GameActivity):
|
||||||
@ -34,64 +36,60 @@ def game_begin_analytics() -> None:
|
|||||||
if isinstance(session, CoopSession):
|
if isinstance(session, CoopSession):
|
||||||
campaign = session.campaign
|
campaign = session.campaign
|
||||||
assert campaign is not None
|
assert campaign is not None
|
||||||
_babase.set_analytics_screen(
|
babase.set_analytics_screen(
|
||||||
'Coop Game: '
|
'Coop Game: '
|
||||||
+ campaign.name
|
+ campaign.name
|
||||||
+ ' '
|
+ ' '
|
||||||
+ campaign.getlevel(
|
+ campaign.getlevel(
|
||||||
_babase.app.classic.coop_session_args['level']
|
babase.app.classic.coop_session_args['level']
|
||||||
).name
|
).name
|
||||||
)
|
)
|
||||||
_babase.increment_analytics_count('Co-op round start')
|
babase.increment_analytics_count('Co-op round start')
|
||||||
if len(activity.players) == 1:
|
if len(activity.players) == 1:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count('Co-op round start 1 human player')
|
||||||
'Co-op round start 1 human player'
|
|
||||||
)
|
|
||||||
elif len(activity.players) == 2:
|
elif len(activity.players) == 2:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Co-op round start 2 human players'
|
'Co-op round start 2 human players'
|
||||||
)
|
)
|
||||||
elif len(activity.players) == 3:
|
elif len(activity.players) == 3:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Co-op round start 3 human players'
|
'Co-op round start 3 human players'
|
||||||
)
|
)
|
||||||
elif len(activity.players) >= 4:
|
elif len(activity.players) >= 4:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Co-op round start 4+ human players'
|
'Co-op round start 4+ human players'
|
||||||
)
|
)
|
||||||
|
|
||||||
elif isinstance(session, DualTeamSession):
|
elif isinstance(session, DualTeamSession):
|
||||||
_babase.set_analytics_screen('Teams Game: ' + activity.getname())
|
babase.set_analytics_screen('Teams Game: ' + activity.getname())
|
||||||
_babase.increment_analytics_count('Teams round start')
|
babase.increment_analytics_count('Teams round start')
|
||||||
if len(activity.players) == 1:
|
if len(activity.players) == 1:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count('Teams round start 1 human player')
|
||||||
'Teams round start 1 human player'
|
|
||||||
)
|
|
||||||
elif 1 < len(activity.players) < 8:
|
elif 1 < len(activity.players) < 8:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Teams round start '
|
'Teams round start '
|
||||||
+ str(len(activity.players))
|
+ str(len(activity.players))
|
||||||
+ ' human players'
|
+ ' human players'
|
||||||
)
|
)
|
||||||
elif len(activity.players) >= 8:
|
elif len(activity.players) >= 8:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Teams round start 8+ human players'
|
'Teams round start 8+ human players'
|
||||||
)
|
)
|
||||||
|
|
||||||
elif isinstance(session, FreeForAllSession):
|
elif isinstance(session, FreeForAllSession):
|
||||||
_babase.set_analytics_screen('FreeForAll Game: ' + activity.getname())
|
babase.set_analytics_screen('FreeForAll Game: ' + activity.getname())
|
||||||
_babase.increment_analytics_count('Free-for-all round start')
|
babase.increment_analytics_count('Free-for-all round start')
|
||||||
if len(activity.players) == 1:
|
if len(activity.players) == 1:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Free-for-all round start 1 human player'
|
'Free-for-all round start 1 human player'
|
||||||
)
|
)
|
||||||
elif 1 < len(activity.players) < 8:
|
elif 1 < len(activity.players) < 8:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Free-for-all round start '
|
'Free-for-all round start '
|
||||||
+ str(len(activity.players))
|
+ str(len(activity.players))
|
||||||
+ ' human players'
|
+ ' human players'
|
||||||
)
|
)
|
||||||
elif len(activity.players) >= 8:
|
elif len(activity.players) >= 8:
|
||||||
_babase.increment_analytics_count(
|
babase.increment_analytics_count(
|
||||||
'Free-for-all round start 8+ human players'
|
'Free-for-all round start 8+ human players'
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import logging
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
@ -123,9 +124,7 @@ class MusicSubsystem:
|
|||||||
]:
|
]:
|
||||||
self.get_music_player()
|
self.get_music_player()
|
||||||
except Exception:
|
except Exception:
|
||||||
from babase import _error
|
logging.exception('Error prepping music-player.')
|
||||||
|
|
||||||
_error.print_exception('error prepping music-player')
|
|
||||||
|
|
||||||
def on_app_shutdown(self) -> None:
|
def on_app_shutdown(self) -> None:
|
||||||
"""Should be called when the app is shutting down."""
|
"""Should be called when the app is shutting down."""
|
||||||
@ -213,9 +212,7 @@ class MusicSubsystem:
|
|||||||
return entry_type
|
return entry_type
|
||||||
raise ValueError('invalid soundtrack entry:' + str(entry))
|
raise ValueError('invalid soundtrack entry:' + str(entry))
|
||||||
except Exception:
|
except Exception:
|
||||||
from babase import _error
|
logging.exception('Error in get_soundtrack_entry_type.')
|
||||||
|
|
||||||
_error.print_exception()
|
|
||||||
return 'default'
|
return 'default'
|
||||||
|
|
||||||
def get_soundtrack_entry_name(self, entry: Any) -> str:
|
def get_soundtrack_entry_name(self, entry: Any) -> str:
|
||||||
@ -239,9 +236,7 @@ class MusicSubsystem:
|
|||||||
return entry['name']
|
return entry['name']
|
||||||
raise ValueError('invalid soundtrack entry:' + str(entry))
|
raise ValueError('invalid soundtrack entry:' + str(entry))
|
||||||
except Exception:
|
except Exception:
|
||||||
from babase import _error
|
logging.exception('Error in get_soundtrack_entry_name.')
|
||||||
|
|
||||||
_error.print_exception()
|
|
||||||
return 'default'
|
return 'default'
|
||||||
|
|
||||||
def on_app_resume(self) -> None:
|
def on_app_resume(self) -> None:
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from bacommon.servermanager import (
|
|||||||
ClientListCommand,
|
ClientListCommand,
|
||||||
KickCommand,
|
KickCommand,
|
||||||
)
|
)
|
||||||
import _babase
|
import babase
|
||||||
import bascenev1
|
import bascenev1
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -33,30 +33,30 @@ def _cmd(command_data: bytes) -> None:
|
|||||||
"""Handle commands coming in from our server manager parent process."""
|
"""Handle commands coming in from our server manager parent process."""
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
assert _babase.app.classic is not None
|
assert babase.app.classic is not None
|
||||||
|
|
||||||
command = pickle.loads(command_data)
|
command = pickle.loads(command_data)
|
||||||
assert isinstance(command, ServerCommand)
|
assert isinstance(command, ServerCommand)
|
||||||
|
|
||||||
if isinstance(command, StartServerModeCommand):
|
if isinstance(command, StartServerModeCommand):
|
||||||
assert _babase.app.classic.server is None
|
assert babase.app.classic.server is None
|
||||||
_babase.app.classic.server = ServerController(command.config)
|
babase.app.classic.server = ServerController(command.config)
|
||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(command, ShutdownCommand):
|
if isinstance(command, ShutdownCommand):
|
||||||
assert _babase.app.classic.server is not None
|
assert babase.app.classic.server is not None
|
||||||
_babase.app.classic.server.shutdown(
|
babase.app.classic.server.shutdown(
|
||||||
reason=command.reason, immediate=command.immediate
|
reason=command.reason, immediate=command.immediate
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(command, ChatMessageCommand):
|
if isinstance(command, ChatMessageCommand):
|
||||||
assert _babase.app.classic.server is not None
|
assert babase.app.classic.server is not None
|
||||||
bascenev1.chatmessage(command.message, clients=command.clients)
|
bascenev1.chatmessage(command.message, clients=command.clients)
|
||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(command, ScreenMessageCommand):
|
if isinstance(command, ScreenMessageCommand):
|
||||||
assert _babase.app.classic.server is not None
|
assert babase.app.classic.server is not None
|
||||||
|
|
||||||
# Note: we have to do transient messages if
|
# Note: we have to do transient messages if
|
||||||
# clients is specified, so they won't show up
|
# clients is specified, so they won't show up
|
||||||
@ -70,13 +70,13 @@ def _cmd(command_data: bytes) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(command, ClientListCommand):
|
if isinstance(command, ClientListCommand):
|
||||||
assert _babase.app.classic.server is not None
|
assert babase.app.classic.server is not None
|
||||||
_babase.app.classic.server.print_client_list()
|
babase.app.classic.server.print_client_list()
|
||||||
return
|
return
|
||||||
|
|
||||||
if isinstance(command, KickCommand):
|
if isinstance(command, KickCommand):
|
||||||
assert _babase.app.classic.server is not None
|
assert babase.app.classic.server is not None
|
||||||
_babase.app.classic.server.kick(
|
babase.app.classic.server.kick(
|
||||||
client_id=command.client_id, ban_time=command.ban_time
|
client_id=command.client_id, ban_time=command.ban_time
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@ -113,8 +113,8 @@ class ServerController:
|
|||||||
# Now sit around doing any pre-launch prep such as waiting for
|
# Now sit around doing any pre-launch prep such as waiting for
|
||||||
# account sign-in or fetching playlists; this will kick off the
|
# account sign-in or fetching playlists; this will kick off the
|
||||||
# session once done.
|
# session once done.
|
||||||
with _babase.ContextRef.empty():
|
with babase.ContextRef.empty():
|
||||||
self._prep_timer = _babase.AppTimer(
|
self._prep_timer = babase.AppTimer(
|
||||||
0.25, self._prepare_to_serve, repeat=True
|
0.25, self._prepare_to_serve, repeat=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -184,15 +184,13 @@ class ServerController:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def _execute_shutdown(self) -> None:
|
def _execute_shutdown(self) -> None:
|
||||||
from babase._language import Lstr
|
|
||||||
|
|
||||||
if self._executing_shutdown:
|
if self._executing_shutdown:
|
||||||
return
|
return
|
||||||
self._executing_shutdown = True
|
self._executing_shutdown = True
|
||||||
timestrval = time.strftime('%c')
|
timestrval = time.strftime('%c')
|
||||||
if self._shutdown_reason is ShutdownReason.RESTARTING:
|
if self._shutdown_reason is ShutdownReason.RESTARTING:
|
||||||
_babase.screenmessage(
|
babase.screenmessage(
|
||||||
Lstr(resource='internal.serverRestartingText'),
|
babase.Lstr(resource='internal.serverRestartingText'),
|
||||||
color=(1, 0.5, 0.0),
|
color=(1, 0.5, 0.0),
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
@ -200,24 +198,24 @@ class ServerController:
|
|||||||
f' at {timestrval}.{Clr.RST}'
|
f' at {timestrval}.{Clr.RST}'
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
_babase.screenmessage(
|
babase.screenmessage(
|
||||||
Lstr(resource='internal.serverShuttingDownText'),
|
babase.Lstr(resource='internal.serverShuttingDownText'),
|
||||||
color=(1, 0.5, 0.0),
|
color=(1, 0.5, 0.0),
|
||||||
)
|
)
|
||||||
print(
|
print(
|
||||||
f'{Clr.SBLU}Exiting for server-shutdown'
|
f'{Clr.SBLU}Exiting for server-shutdown'
|
||||||
f' at {timestrval}.{Clr.RST}'
|
f' at {timestrval}.{Clr.RST}'
|
||||||
)
|
)
|
||||||
with _babase.ContextRef.empty():
|
with babase.ContextRef.empty():
|
||||||
_babase.apptimer(2.0, _babase.quit)
|
babase.apptimer(2.0, babase.quit)
|
||||||
|
|
||||||
def _run_access_check(self) -> None:
|
def _run_access_check(self) -> None:
|
||||||
"""Check with the master server to see if we're likely joinable."""
|
"""Check with the master server to see if we're likely joinable."""
|
||||||
assert _babase.app.classic is not None
|
assert babase.app.classic is not None
|
||||||
|
|
||||||
_babase.app.classic.master_server_v1_get(
|
babase.app.classic.master_server_v1_get(
|
||||||
'bsAccessCheck',
|
'bsAccessCheck',
|
||||||
{'port': bascenev1.get_game_port(), 'b': _babase.app.build_number},
|
{'port': bascenev1.get_game_port(), 'b': babase.app.build_number},
|
||||||
callback=self._access_check_response,
|
callback=self._access_check_response,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -256,7 +254,7 @@ class ServerController:
|
|||||||
|
|
||||||
def _prepare_to_serve(self) -> None:
|
def _prepare_to_serve(self) -> None:
|
||||||
"""Run in a timer to do prep before beginning to serve."""
|
"""Run in a timer to do prep before beginning to serve."""
|
||||||
plus = _babase.app.plus
|
plus = babase.app.plus
|
||||||
assert plus is not None
|
assert plus is not None
|
||||||
signed_in = plus.get_v1_account_state() == 'signed_in'
|
signed_in = plus.get_v1_account_state() == 'signed_in'
|
||||||
if not signed_in:
|
if not signed_in:
|
||||||
@ -296,7 +294,7 @@ class ServerController:
|
|||||||
|
|
||||||
if can_launch:
|
if can_launch:
|
||||||
self._prep_timer = None
|
self._prep_timer = None
|
||||||
_babase.pushcall(self._launch_server_session)
|
babase.pushcall(self._launch_server_session)
|
||||||
|
|
||||||
def _on_playlist_fetch_response(
|
def _on_playlist_fetch_response(
|
||||||
self,
|
self,
|
||||||
@ -337,7 +335,7 @@ class ServerController:
|
|||||||
"""Kick off a host-session based on the current server config."""
|
"""Kick off a host-session based on the current server config."""
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
app = _babase.app
|
app = babase.app
|
||||||
classic = app.classic
|
classic = app.classic
|
||||||
plus = app.plus
|
plus = app.plus
|
||||||
assert plus is not None
|
assert plus is not None
|
||||||
@ -382,7 +380,7 @@ class ServerController:
|
|||||||
if self._first_run:
|
if self._first_run:
|
||||||
curtimestr = time.strftime('%c')
|
curtimestr = time.strftime('%c')
|
||||||
startupmsg = (
|
startupmsg = (
|
||||||
f'{Clr.BLD}{Clr.BLU}{_babase.appnameupper()} {app.version}'
|
f'{Clr.BLD}{Clr.BLU}{babase.appnameupper()} {app.version}'
|
||||||
f' ({app.build_number})'
|
f' ({app.build_number})'
|
||||||
f' entering server-mode {curtimestr}{Clr.RST}'
|
f' entering server-mode {curtimestr}{Clr.RST}'
|
||||||
)
|
)
|
||||||
@ -426,8 +424,8 @@ class ServerController:
|
|||||||
# And here.. we.. go.
|
# And here.. we.. go.
|
||||||
if self._config.stress_test_players is not None:
|
if self._config.stress_test_players is not None:
|
||||||
# Special case: run a stress test.
|
# Special case: run a stress test.
|
||||||
assert _babase.app.classic is not None
|
assert babase.app.classic is not None
|
||||||
_babase.app.classic.run_stress_test(
|
babase.app.classic.run_stress_test(
|
||||||
playlist_type='Random',
|
playlist_type='Random',
|
||||||
playlist_name='__default__',
|
playlist_name='__default__',
|
||||||
player_count=self._config.stress_test_players,
|
player_count=self._config.stress_test_players,
|
||||||
|
|||||||
@ -145,8 +145,6 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||||||
return self._env['user_agent_string']
|
return self._env['user_agent_string']
|
||||||
|
|
||||||
def on_app_loading(self) -> None:
|
def on_app_loading(self) -> None:
|
||||||
from bascenev1 import _campaign
|
|
||||||
from bascenev1 import _map
|
|
||||||
from bascenev1lib.actor import spazappearance
|
from bascenev1lib.actor import spazappearance
|
||||||
from bascenev1lib import maps as stdmaps
|
from bascenev1lib import maps as stdmaps
|
||||||
|
|
||||||
@ -190,10 +188,10 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||||||
stdmaps.Courtyard,
|
stdmaps.Courtyard,
|
||||||
stdmaps.Rampage,
|
stdmaps.Rampage,
|
||||||
]:
|
]:
|
||||||
_map.register_map(maptype)
|
bascenev1.register_map(maptype)
|
||||||
|
|
||||||
spazappearance.register_appearances()
|
spazappearance.register_appearances()
|
||||||
_campaign.init_campaigns()
|
bascenev1.init_campaigns()
|
||||||
|
|
||||||
launch_count = cfg.get('launchCount', 0)
|
launch_count = cfg.get('launchCount', 0)
|
||||||
launch_count += 1
|
launch_count += 1
|
||||||
@ -345,10 +343,10 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||||||
self.coop_session_args[arg_name] = arg_val
|
self.coop_session_args[arg_name] = arg_val
|
||||||
|
|
||||||
def _fade_end() -> None:
|
def _fade_end() -> None:
|
||||||
from bascenev1 import _coopsession
|
from bascenev1 import CoopSession
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bascenev1.new_host_session(_coopsession.CoopSession)
|
bascenev1.new_host_session(CoopSession)
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception('Error creating coopsession after fade end.')
|
logging.exception('Error creating coopsession after fade end.')
|
||||||
from bascenev1lib.mainmenu import MainMenuSession
|
from bascenev1lib.mainmenu import MainMenuSession
|
||||||
|
|||||||
@ -146,9 +146,10 @@ from bascenev1._profile import (
|
|||||||
get_player_profile_icon,
|
get_player_profile_icon,
|
||||||
get_player_profile_colors,
|
get_player_profile_colors,
|
||||||
)
|
)
|
||||||
|
from bascenev1._campaign import init_campaigns
|
||||||
from bascenev1._appmode import SceneV1AppMode
|
from bascenev1._appmode import SceneV1AppMode
|
||||||
from bascenev1._session import Session
|
from bascenev1._session import Session
|
||||||
from bascenev1._map import Map
|
from bascenev1._map import Map, register_map
|
||||||
from bascenev1._coopsession import CoopSession
|
from bascenev1._coopsession import CoopSession
|
||||||
from bascenev1._debug import print_live_object_warnings
|
from bascenev1._debug import print_live_object_warnings
|
||||||
from bascenev1._multiteamsession import MultiTeamSession
|
from bascenev1._multiteamsession import MultiTeamSession
|
||||||
@ -410,6 +411,8 @@ __all__ = [
|
|||||||
'get_player_profile_icon',
|
'get_player_profile_icon',
|
||||||
'get_player_profile_colors',
|
'get_player_profile_colors',
|
||||||
'set_master_server_source',
|
'set_master_server_source',
|
||||||
|
'init_campaigns',
|
||||||
|
'register_map',
|
||||||
]
|
]
|
||||||
|
|
||||||
# We want stuff here to show up as bascenev1.Foo instead of
|
# We want stuff here to show up as bascenev1.Foo instead of
|
||||||
|
|||||||
@ -83,6 +83,9 @@ from babase import (
|
|||||||
is_browser_likely_available,
|
is_browser_likely_available,
|
||||||
)
|
)
|
||||||
from _bauiv1 import (
|
from _bauiv1 import (
|
||||||
|
show_ad,
|
||||||
|
show_ad_2,
|
||||||
|
can_show_ad,
|
||||||
show_online_score_ui,
|
show_online_score_ui,
|
||||||
uibounds,
|
uibounds,
|
||||||
set_party_window_open,
|
set_party_window_open,
|
||||||
@ -211,6 +214,9 @@ __all__ = [
|
|||||||
'AppIntentExec',
|
'AppIntentExec',
|
||||||
'AppMode',
|
'AppMode',
|
||||||
'UIV1Subsystem',
|
'UIV1Subsystem',
|
||||||
|
'show_ad',
|
||||||
|
'show_ad_2',
|
||||||
|
'can_show_ad',
|
||||||
]
|
]
|
||||||
|
|
||||||
# We want stuff to show up as bauiv1.Foo instead of bauiv1._sub.Foo.
|
# We want stuff to show up as bauiv1.Foo instead of bauiv1._sub.Foo.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user