update from origin

This commit is contained in:
Ayush Saini 2023-09-30 17:21:33 +05:30
parent 8beb334d64
commit bf2f252ee5
91 changed files with 1839 additions and 1281 deletions

View file

@ -50,6 +50,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
super().on_transition_in()
random.seed(123)
app = bs.app
env = app.env
assert app.classic is not None
plus = bui.app.plus
@ -59,9 +60,9 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
# the host is VR mode or not (clients may differ in that regard).
# Any differences need to happen at the engine level so everyone
# sees things in their own optimal way.
vr_mode = bs.app.vr_mode
vr_mode = bs.app.env.vr
if not bs.app.toolbar_test:
if not bs.app.ui_v1.use_toolbars:
color = (1.0, 1.0, 1.0, 1.0) if vr_mode else (0.5, 0.6, 0.5, 0.6)
# FIXME: Need a node attr for vr-specific-scale.
@ -117,21 +118,21 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
# the host is vr mode or not (clients may not be or vice versa).
# Any differences need to happen at the engine level so everyone sees
# things in their own optimal way.
vr_mode = app.vr_mode
vr_mode = app.env.vr
uiscale = app.ui_v1.uiscale
# In cases where we're doing lots of dev work lets always show the
# build number.
force_show_build_number = False
if not bs.app.toolbar_test:
if app.debug_build or app.test_build or force_show_build_number:
if app.debug_build:
if not bs.app.ui_v1.use_toolbars:
if env.debug or env.test or force_show_build_number:
if env.debug:
text = bs.Lstr(
value='${V} (${B}) (${D})',
subs=[
('${V}', app.version),
('${B}', str(app.build_number)),
('${V}', app.env.version),
('${B}', str(app.env.build_number)),
('${D}', bs.Lstr(resource='debugText')),
],
)
@ -139,12 +140,12 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
text = bs.Lstr(
value='${V} (${B})',
subs=[
('${V}', app.version),
('${B}', str(app.build_number)),
('${V}', app.env.version),
('${B}', str(app.env.build_number)),
],
)
else:
text = bs.Lstr(value='${V}', subs=[('${V}', app.version)])
text = bs.Lstr(value='${V}', subs=[('${V}', app.env.version)])
scale = 0.9 if (uiscale is bs.UIScale.SMALL or vr_mode) else 0.7
color = (1, 1, 1, 1) if vr_mode else (0.5, 0.6, 0.5, 0.7)
self.version = bs.NodeActor(
@ -168,31 +169,9 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
assert self.version.node
bs.animate(self.version.node, 'opacity', {2.3: 0, 3.0: 1.0})
# Show the iircade logo on our iircade build.
if app.iircade_mode:
img = bs.NodeActor(
bs.newnode(
'image',
attrs={
'texture': bs.gettexture('iircadeLogo'),
'attach': 'center',
'scale': (250, 250),
'position': (0, 0),
'tilt_translate': 0.21,
'absolute_scale': True,
},
)
).autoretain()
imgdelay = (
0.0 if app.classic.main_menu_did_initial_transition else 1.0
)
bs.animate(
img.node, 'opacity', {imgdelay + 1.5: 0.0, imgdelay + 2.5: 1.0}
)
# Throw in test build info.
self.beta_info = self.beta_info_2 = None
if app.test_build and not (app.demo_mode or app.arcade_mode):
if env.test and not (env.demo or env.arcade):
pos = (230, 35)
self.beta_info = bs.NodeActor(
bs.newnode(
@ -313,7 +292,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
random.seed()
if not (app.demo_mode or app.arcade_mode) and not app.toolbar_test:
if not (env.demo or env.arcade) and not app.ui_v1.use_toolbars:
self._news = NewsDisplay(self)
# Bring up the last place we were, or start at the main menu otherwise.
@ -330,7 +309,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
# When coming back from a kiosk-mode game, jump to
# the kiosk start screen.
if bs.app.demo_mode or bs.app.arcade_mode:
if env.demo or env.arcade:
# pylint: disable=cyclic-import
from bauiv1lib.kiosk import KioskWindow
@ -417,6 +396,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
# pylint: disable=too-many-locals
# pylint: disable=too-many-statements
app = bs.app
env = app.env
assert app.classic is not None
# Update logo in case it changes.
@ -460,7 +440,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
base_x = -270.0
x = base_x - 20.0
spacing = 85.0 * base_scale
y_extra = 0.0 if (app.demo_mode or app.arcade_mode) else 0.0
y_extra = 0.0 if (env.demo or env.arcade) else 0.0
self._make_logo(
x - 110 + 50,
113 + y + 1.2 * y_extra,
@ -525,7 +505,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
base_x = -170
x = base_x - 20
spacing = 55 * base_scale
y_extra = 0 if (app.demo_mode or app.arcade_mode) else 0
y_extra = 0 if (env.demo or env.arcade) else 0
xv1 = x
delay1 = delay
for shadow in (True, False):
@ -677,7 +657,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
# Add a bit of stop-motion-y jitter to the logo
# (unless we're in VR mode in which case its best to
# leave things still).
if not bs.app.vr_mode:
if not bs.app.env.vr:
cmb: bs.Node | None
cmb2: bs.Node | None
if not shadow:
@ -796,7 +776,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
# (unless we're in VR mode in which case its best to
# leave things still).
assert logo.node
if not bs.app.vr_mode:
if not bs.app.env.vr:
cmb = bs.newnode('combine', owner=logo.node, attrs={'size': 2})
cmb.connectattr('output', logo.node, 'position')
keys = {}
@ -904,7 +884,7 @@ class NewsDisplay:
self._phrases.insert(0, phr)
val = self._phrases.pop()
if val == '__ACH__':
vrmode = app.vr_mode
vrmode = app.env.vr
Text(
bs.Lstr(resource='nextAchievementsText'),
color=((1, 1, 1, 1) if vrmode else (0.95, 0.9, 1, 0.4)),
@ -970,7 +950,7 @@ class NewsDisplay:
# Show upcoming achievements in non-vr versions
# (currently too hard to read in vr).
self._used_phrases = (['__ACH__'] if not bs.app.vr_mode else []) + [
self._used_phrases = (['__ACH__'] if not bs.app.env.vr else []) + [
s for s in news.split('<br>\n') if s != ''
]
self._phrase_change_timer = bs.Timer(
@ -982,12 +962,12 @@ class NewsDisplay:
assert bs.app.classic is not None
scl = (
1.2
if (bs.app.ui_v1.uiscale is bs.UIScale.SMALL or bs.app.vr_mode)
if (bs.app.ui_v1.uiscale is bs.UIScale.SMALL or bs.app.env.vr)
else 0.8
)
color2 = (1, 1, 1, 1) if bs.app.vr_mode else (0.7, 0.65, 0.75, 1.0)
shadow = 1.0 if bs.app.vr_mode else 0.4
color2 = (1, 1, 1, 1) if bs.app.env.vr else (0.7, 0.65, 0.75, 1.0)
shadow = 1.0 if bs.app.env.vr else 0.4
self._text = bs.NodeActor(
bs.newnode(
'text',