fixes for get-more-characters and get-more-icons functionality in player profile editor

This commit is contained in:
Eric 2024-09-25 21:16:05 -07:00
parent 86d2a78974
commit 489d8134ca
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
8 changed files with 86 additions and 62 deletions

56
.efrocachemap generated
View File

@ -4096,26 +4096,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "65b928385abc5fb852a9bfca74e25515",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "949ec63b1c4049ca8b53177e3a1b4125",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "3e8a83e2a34261d99879c6be7a035f76",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "b23e959d29accbcacbb2e07983a4585b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "293bb35597a0f9b39b4a940094b25c80",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1c79a0db39022e7341c1f4228bbf1bfe",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "3dfaacb9b36d61081d39493ac5e95ae9",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "61a7153508cc55bad48bd9102a672b58",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "daf24f76db0462c10219c0422bef7651",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "4ad78818230f71946ecd45dddad495d3",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "1c22dcc8b478a5673e81eec9484b4c95",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "3ea63c2c531c1201511bd65cc84328c0",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "d1dda1bcd25be89d924f59daeb76deb4",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "461dd43017d4b9ddd66f07b663ea073a",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "8b5f76faeb062bf526f4de2e36756e86",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "b11df699748ceaeabb9d7b1d575d574b",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "0273dbc73771533d13d88636c0a0d920",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "c95d98be2122ffb63ea7ba2ea00bdc94",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "5945a64fbd6a70d3fed7e6cfe042515c",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "dfc3f3e2501435163035e43b2996624f",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "855a05f0dde692555dcd240456c63397",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "46b1d1929707bd20d50509c53c406f80",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "8f0f4ed6508328a4a75c95450ecae525",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "14d5f4e4cdaa859100b6e247f713f23b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "586cdec51141ee2c2553450b917ccf13",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "cb68c967d6cc12fb98865bd391b630c7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "8ba734f236f8b3d76a0f3a634d088ef1",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "59a854138d18b814e0913a4608b7fe87",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "cfa3a2f7ef36c88736a88c8229a7389d",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "27677f0f0d72c4b487070dada1e494dd",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "02124d81c73f4212be27028c97bca2b2",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "81297de9661e18bf6c67c20927a6d6b8",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "99e2c966b4855f712fb383a167ae2bb5",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "fc534000c33ad4db9cc0d7756e171947",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "753846937971a4353045178dacc9fd76",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "6ea4ace6e74840ae2534d7df1ebe4b1c",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "c25040a973dbbbe0c51b51934bd13df9",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8db99aef1dd403903f6d433314d1ca66",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "af04c5cbfad31760865ae59079ee32a4",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "ec2bd6cc16ae27771271eb250634d6b1",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "ad908b297b41c2fdf13582e34c434245",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "086a2ce72497e44079ad6b747fc5439f",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "ad908b297b41c2fdf13582e34c434245",
@ -4132,14 +4132,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "d7a1d4deb51b0792d083737477e6833b",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "4c11b81a574aa9af593f54db4d998e61",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "d7a1d4deb51b0792d083737477e6833b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "07ac2d15d5fdcaaf8505439b07b5f2aa",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c55f3ea6d1e8d3f951e0ca08460e853f",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "c93e65e95335b64a5a7de102094bfe75",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "a276c3209acad4d12cdce69936044160",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "464fdc0293df656486ec70358b0bf9e8",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "f827037308d6d4a9b4fc978a362d166f",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "14f7fe0fa80210300c86ba65a5c70b75",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "75a7444330624357cb388077eccd9e69",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "8eea688090f6d2be7b003c1469afc244",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "9409dfcaf0598768143e06690d33ce65",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "a85fb3ac57086dc5f271b3afea90b489",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "30b60a444fba031a67c96ed9193050da",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "b06998159410ed4b02591ca2998b9c38",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "51553d3162f0af5acfd5e55880e454c9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "215dbbb47e8def7b1f63448275b4d33b",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "52dd9b73e6d72412ca6b273fb342368e",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 22014, api 9, 2024-09-25)
### 1.7.37 (build 22015, api 9, 2024-09-25)
- Bumping api version to 9. As you'll see below, there's some UI changes that
will require a bit of work for any UI mods to adapt to. If your mods don't
touch UI stuff at all you can simply bump your api version and call it a day.

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 22014
TARGET_BALLISTICA_BUILD = 22015
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -327,10 +327,10 @@ def ui_upkeep() -> None:
print(
'WARNING:',
obj,
'is still alive 5 second after its widget died;'
'is still alive 5 second after its Widget died;'
' you might have a memory leak. Look for circular'
' references or outside things referencing your window'
' instance. See efro.debug module'
' references or outside things referencing your Window'
' class instance. See efro.debug module'
' for tools that can help debug this sort of thing.',
)
else:

View File

@ -14,6 +14,18 @@ if TYPE_CHECKING:
from typing import Any, Sequence
class IconPickerDelegate:
"""Delegate for character-picker."""
def on_icon_picker_pick(self, icon: str) -> None:
"""Called when a character is selected."""
raise NotImplementedError()
def on_icon_picker_get_more_press(self) -> None:
"""Called when the 'get more characters' button is pressed."""
raise NotImplementedError()
class IconPicker(PopupWindow):
"""Picker for icons."""
@ -21,7 +33,7 @@ class IconPicker(PopupWindow):
self,
parent: bui.Widget,
position: tuple[float, float] = (0.0, 0.0),
delegate: Any = None,
delegate: IconPickerDelegate | None = None,
scale: float | None = None,
*,
offset: tuple[float, float] = (0.0, 0.0),
@ -161,24 +173,17 @@ class IconPicker(PopupWindow):
def _on_store_press(self) -> None:
from bauiv1lib.account import show_sign_in_prompt
# from bauiv1lib.store.browser import StoreBrowserWindow
plus = bui.app.plus
assert plus is not None
if plus.get_v1_account_state() != 'signed_in':
show_sign_in_prompt()
return
# self._transition_out()
bui.screenmessage('UNDER CONSTRUCTION')
return
if self._delegate is not None:
self._delegate.on_icon_picker_get_more_press()
# StoreBrowserWindow(
# modal=True,
# show_tab=StoreBrowserWindow.TabID.ICONS,
# origin_widget=self._get_more_icons_button,
# )
self._transition_out()
def _select_icon(self, icon: str) -> None:
if self._delegate is not None:

View File

@ -9,11 +9,14 @@ from typing import cast, override
from bauiv1lib.colorpicker import ColorPicker
from bauiv1lib.characterpicker import CharacterPickerDelegate
from bauiv1lib.iconpicker import IconPickerDelegate
import bauiv1 as bui
import bascenev1 as bs
class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
class EditProfileWindow(
bui.MainWindow, CharacterPickerDelegate, IconPickerDelegate
):
"""Window for editing a player profile."""
def reload_window(self) -> None:
@ -30,10 +33,12 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
back_state=self.main_window_back_state,
)
# def __del__(self) -> None:
# print(f'~EditProfileWindow({id(self)})')
def __init__(
self,
existing_profile: str | None,
# in_main_menu: bool,
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
):
@ -41,12 +46,13 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
assert bui.app.classic is not None
# print(f'EditProfileWindow({id(self)})')
plus = bui.app.plus
assert plus is not None
# self._in_main_menu = in_main_menu
self._existing_profile = existing_profile
self._r = 'editProfileWindow'
self._spazzes: list[str] = []
@ -82,10 +88,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
(0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
),
toolbar_visibility=(
# 'menu_minimal'
None
if uiscale is bui.UIScale.SMALL
else 'menu_full'
None if uiscale is bui.UIScale.SMALL else 'menu_full'
),
),
transition=transition,
@ -523,12 +526,16 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes.
cls = type(self)
# Pull things out of self here; if we do it within the lambda
# we'll keep ourself alive which is bad.
existing_profile = self._existing_profile
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition,
origin_widget=origin_widget,
existing_profile=self._existing_profile,
# in_main_menu=self._in_main_menu,
existing_profile=existing_profile,
)
)
@ -638,18 +645,35 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
for s in self._spazzes
]
@override
def on_icon_picker_pick(self, icon: str) -> None:
"""An icon has been selected by the picker."""
self._icon = icon
self._update_icon()
@override
def on_icon_picker_get_more_press(self) -> None:
"""User wants to get more icons."""
from bauiv1lib.store.browser import StoreBrowserWindow
if not self.main_window_has_control():
return
self.main_window_replace(
StoreBrowserWindow(
minimal_toolbars=True,
show_tab=StoreBrowserWindow.TabID.ICONS,
)
)
@override
def on_character_picker_pick(self, character: str) -> None:
"""A character has been selected by the picker."""
if not self._root_widget:
return
# The player could have bought a new one while the picker was up.
# The player could have bought a new one while the picker was
# up.
self.refresh_characters()
self._icon_index = (
self._spazzes.index(character) if character in self._spazzes else 0
@ -848,8 +872,8 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
}
)
# Also lets be aware we're no longer global if we're taking a
# new name (will need to re-request it).
# Also lets be aware we're no longer global if we're taking
# a new name (will need to re-request it).
self._global = False
plus.add_v1_account_transaction(

View File

@ -247,11 +247,6 @@ class ProfileUpgradeWindow(bui.Window):
self._cancel()
return
# try:
# t_str = str(plus.get_v1_account_ticket_count())
# except Exception:
# t_str = '?'
# Once we've kicked off an upgrade attempt and all transactions go
# through, we're done.
if (

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 22014;
const int kEngineBuildNumber = 22015;
const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9;