mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 16:13:23 +08:00
added ba.app.add_coop_practice_level()
This commit is contained in:
parent
e5e54a64e6
commit
2039d44a03
@ -1,6 +1,8 @@
|
|||||||
### 1.7.4 (20638, 2022-07-07)
|
### 1.7.4 (20638, 2022-07-07)
|
||||||
- Fixed the trophies list showing an incorrect total (Thanks itsre3!)
|
- Fixed the trophies list showing an incorrect total (Thanks itsre3!)
|
||||||
- ba.app.meta.metascan is now ba.app.meta.scanresults
|
- ba.app.meta.metascan is now ba.app.meta.scanresults
|
||||||
|
- Cleaned up co-op ui code a bit
|
||||||
|
- Added a utility function to add custom co-op games in the practice section: `ba.app.add_coop_practice_level`. Also added new workspace template script which uses it to define a new co-op game type.
|
||||||
|
|
||||||
### 1.7.3 (20634, 2022-07-06)
|
### 1.7.3 (20634, 2022-07-06)
|
||||||
- Fixed an issue with King of the Hill flag regions not working when players entered them (Thanks itsre3!)
|
- Fixed an issue with King of the Hill flag regions not working when players entered them (Thanks itsre3!)
|
||||||
|
|||||||
@ -29,6 +29,7 @@ if TYPE_CHECKING:
|
|||||||
from ba._cloud import CloudSubsystem
|
from ba._cloud import CloudSubsystem
|
||||||
from bastd.actor import spazappearance
|
from bastd.actor import spazappearance
|
||||||
from ba._accountv2 import AccountV2Subsystem
|
from ba._accountv2 import AccountV2Subsystem
|
||||||
|
from ba._level import Level
|
||||||
|
|
||||||
|
|
||||||
class App:
|
class App:
|
||||||
@ -274,6 +275,7 @@ class App:
|
|||||||
|
|
||||||
# Co-op Campaigns.
|
# Co-op Campaigns.
|
||||||
self.campaigns: dict[str, ba.Campaign] = {}
|
self.campaigns: dict[str, ba.Campaign] = {}
|
||||||
|
self.custom_coop_practice_games: list[str] = []
|
||||||
|
|
||||||
# Server Mode.
|
# Server Mode.
|
||||||
self.server: ba.ServerController | None = None
|
self.server: ba.ServerController | None = None
|
||||||
@ -527,6 +529,15 @@ class App:
|
|||||||
# FIXME: This should not be an actor attr.
|
# FIXME: This should not be an actor attr.
|
||||||
activity.paused_text = None
|
activity.paused_text = None
|
||||||
|
|
||||||
|
def add_coop_practice_level(self, level: Level) -> None:
|
||||||
|
"""Adds an individual level to the 'practice' section in Co-op."""
|
||||||
|
|
||||||
|
# Assign this level to our catch-all campaign.
|
||||||
|
self.campaigns['Challenges'].addlevel(level)
|
||||||
|
|
||||||
|
# Make note to add it to our challenges UI.
|
||||||
|
self.custom_coop_practice_games.append(f'Challenges:{level.name}')
|
||||||
|
|
||||||
def return_to_main_menu_session_gracefully(self,
|
def return_to_main_menu_session_gracefully(self,
|
||||||
reset_ui: bool = True) -> None:
|
reset_ui: bool = True) -> None:
|
||||||
"""Attempt to cleanly get back to the main menu."""
|
"""Attempt to cleanly get back to the main menu."""
|
||||||
|
|||||||
@ -49,12 +49,12 @@ class Campaign:
|
|||||||
"""Whether this Campaign's levels must be played in sequence."""
|
"""Whether this Campaign's levels must be played in sequence."""
|
||||||
return self._sequential
|
return self._sequential
|
||||||
|
|
||||||
def addlevel(self, level: ba.Level) -> None:
|
def addlevel(self, level: ba.Level, index: int = -1) -> None:
|
||||||
"""Adds a ba.Level to the Campaign."""
|
"""Adds a ba.Level to the Campaign."""
|
||||||
if level.campaign is not None:
|
if level.campaign is not None:
|
||||||
raise RuntimeError('Level already belongs to a campaign.')
|
raise RuntimeError('Level already belongs to a campaign.')
|
||||||
level.set_campaign(self, len(self._levels))
|
level.set_campaign(self, len(self._levels))
|
||||||
self._levels.append(level)
|
self._levels.insert(index, level)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def levels(self) -> list[ba.Level]:
|
def levels(self) -> list[ba.Level]:
|
||||||
|
|||||||
@ -720,7 +720,7 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
self.run_tournament)))
|
self.run_tournament)))
|
||||||
v -= 200
|
v -= 200
|
||||||
|
|
||||||
# Custom Games.
|
# Custom Games. (called 'Practice' in UI these days).
|
||||||
v -= 50
|
v -= 50
|
||||||
ba.textwidget(parent=w_parent,
|
ba.textwidget(parent=w_parent,
|
||||||
position=(h_base + 27, v + 30 + 198),
|
position=(h_base + 27, v + 30 + 198),
|
||||||
@ -751,11 +751,9 @@ class CoopBrowserWindow(ba.Window):
|
|||||||
'Challenges:Pro Easter Egg Hunt',
|
'Challenges:Pro Easter Egg Hunt',
|
||||||
] + items
|
] + items
|
||||||
|
|
||||||
# add all custom user levels here..
|
# If we've defined custom games, put them at the beginning.
|
||||||
# items += [
|
if ba.app.custom_coop_practice_games:
|
||||||
# 'User:' + l.getname()
|
items = ba.app.custom_coop_practice_games + items
|
||||||
# for l in getcampaign('User').getlevels()
|
|
||||||
# ]
|
|
||||||
|
|
||||||
self._custom_h_scroll = custom_h_scroll = h_scroll = ba.hscrollwidget(
|
self._custom_h_scroll = custom_h_scroll = h_scroll = ba.hscrollwidget(
|
||||||
parent=w_parent,
|
parent=w_parent,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user