Merge branch 'efroemling:main' into master

This commit is contained in:
Vishal 2024-09-28 03:14:05 +05:30 committed by GitHub
commit 918988f5cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 934 additions and 718 deletions

56
.efrocachemap generated
View File

@ -4096,26 +4096,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "21a16533b62c491d0581609132c22dd5", "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "855a05f0dde692555dcd240456c63397",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "fd60f24823b5fd2951acf06ad92d124b", "build/prefab/full/linux_arm64_gui/release/ballisticakit": "46b1d1929707bd20d50509c53c406f80",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "87bba2b52609ee3ae31c2b1255218d93", "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "8f0f4ed6508328a4a75c95450ecae525",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "bb123af5ef4bdede5248e4d0e086d623", "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "14d5f4e4cdaa859100b6e247f713f23b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "78e44932b961f079ddf15fae69fed639", "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "586cdec51141ee2c2553450b917ccf13",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "49210bd0982bf5eda8dd1074b0b26152", "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "cb68c967d6cc12fb98865bd391b630c7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "85fcee6b23abbf1c5a8e64fd95567b6e", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "8ba734f236f8b3d76a0f3a634d088ef1",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "6c881b22460cb58f93249bc9f7a95724", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "59a854138d18b814e0913a4608b7fe87",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "625390166d0eac624f14fc1688c638e7", "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "cfa3a2f7ef36c88736a88c8229a7389d",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "66cfb48fb1975ca32a750754d16055eb", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "27677f0f0d72c4b487070dada1e494dd",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b459b77672b95838742903e0afd1d9ae", "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "02124d81c73f4212be27028c97bca2b2",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "f17dd55c15904f515e53fc676658194f", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "81297de9661e18bf6c67c20927a6d6b8",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "b1a493c944b9e60a80482e0097699695", "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "99e2c966b4855f712fb383a167ae2bb5",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "018ca530ee4e8eaf78c2ea50059f2da4", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "fc534000c33ad4db9cc0d7756e171947",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "83ef6001e1ef561a33207c396a7dc8b0", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "753846937971a4353045178dacc9fd76",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "a00d2cff684ae4df75e52159ead85824", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "6ea4ace6e74840ae2534d7df1ebe4b1c",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "775c7f67370eff8d333eda82a626531f", "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "c25040a973dbbbe0c51b51934bd13df9",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "1fa9c1e758e790c263b45315b016fe11", "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "8db99aef1dd403903f6d433314d1ca66",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "8b9e532091efbf224cb410ebf66cfbcf", "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "af04c5cbfad31760865ae59079ee32a4",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "7fbbd61ecdcbb4a8e162b6045d2dcf53", "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/debug/libballisticaplus.a": "ad908b297b41c2fdf13582e34c434245",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "086a2ce72497e44079ad6b747fc5439f", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "086a2ce72497e44079ad6b747fc5439f",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "ad908b297b41c2fdf13582e34c434245", "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_gui/release/libballisticaplus.a": "d7a1d4deb51b0792d083737477e6833b",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "4c11b81a574aa9af593f54db4d998e61", "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/mac_x86_64_server/release/libballisticaplus.a": "d7a1d4deb51b0792d083737477e6833b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "564675e2f00a311387a6e621f3b67332", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "8eea688090f6d2be7b003c1469afc244",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "93395e2263f9ed10160dd8e80811be77", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "9409dfcaf0598768143e06690d33ce65",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "24445c70a851b691690803c87af33c81", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "a85fb3ac57086dc5f271b3afea90b489",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "cf286af8eb7762893ee935e08975eb60", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "30b60a444fba031a67c96ed9193050da",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "33b5f0f70ad2d8775dee1fd810f319e5", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "b06998159410ed4b02591ca2998b9c38",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "74a2c3fa9e709ca034a106d56c3b3e36", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "51553d3162f0af5acfd5e55880e454c9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "8d97d249be1218c6277dc1de54e5c6b8", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "215dbbb47e8def7b1f63448275b4d33b",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "892e10ddcf3b8f1dd83e5d0303594273", "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/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad", "src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d", "src/ballistica/base/mgen/pyembed/binding_base.inc": "efa61468cf098f77cc6a234461d8b86d",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 22010, api 9, 2024-09-24) ### 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 - 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 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. touch UI stuff at all you can simply bump your api version and call it a day.
@ -101,6 +101,11 @@
- There is now a `ba*.app.classic.save_ui_state()` method that should be called - There is now a `ba*.app.classic.save_ui_state()` method that should be called
right before jumping into a game/replay/etc. This will save a state that will right before jumping into a game/replay/etc. This will save a state that will
automatically be restored the next time the main menu activity is entered. automatically be restored the next time the main menu activity is entered.
- (build 22010) Added the concept of 'auxiliary' windows and used them to make
various window navigation more intuitive. Example: previously, if you were on
the co-op screen and pressed the trophy toolbar icon to see your league rank
and then pressed back, you would be taken back to the top level main menu. Now
it will take you back to the co-op screen.
### 1.7.36 (build 21944, api 8, 2024-07-26) ### 1.7.36 (build 21944, api 8, 2024-07-26)
- Wired up Tokens, BombSquad's new purchasable currency. The first thing these - Wired up Tokens, BombSquad's new purchasable currency. The first thing these

View File

@ -6,7 +6,7 @@ mypy==1.11.2
pbxproj==4.2.1 pbxproj==4.2.1
pdoc==14.7.0 pdoc==14.7.0
pur==7.3.2 pur==7.3.2
pylint==3.3.0 pylint==3.3.1
pylsp-mypy==0.6.9 pylsp-mypy==0.6.9
pytest==8.3.3 pytest==8.3.3
python-daemon==3.0.1 python-daemon==3.0.1

View File

@ -367,7 +367,6 @@
"ba_data/python/bauiv1lib/__pycache__/__init__.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/__init__.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/benchmarks.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc",
@ -380,7 +379,7 @@
"ba_data/python/bauiv1lib/__pycache__/fileselector.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/fileselector.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/helpui.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/help.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc",
@ -421,7 +420,6 @@
"ba_data/python/bauiv1lib/account/viewer.py", "ba_data/python/bauiv1lib/account/viewer.py",
"ba_data/python/bauiv1lib/achievements.py", "ba_data/python/bauiv1lib/achievements.py",
"ba_data/python/bauiv1lib/appinvite.py", "ba_data/python/bauiv1lib/appinvite.py",
"ba_data/python/bauiv1lib/benchmarks.py",
"ba_data/python/bauiv1lib/characterpicker.py", "ba_data/python/bauiv1lib/characterpicker.py",
"ba_data/python/bauiv1lib/colorpicker.py", "ba_data/python/bauiv1lib/colorpicker.py",
"ba_data/python/bauiv1lib/config.py", "ba_data/python/bauiv1lib/config.py",
@ -456,7 +454,7 @@
"ba_data/python/bauiv1lib/gather/publictab.py", "ba_data/python/bauiv1lib/gather/publictab.py",
"ba_data/python/bauiv1lib/getremote.py", "ba_data/python/bauiv1lib/getremote.py",
"ba_data/python/bauiv1lib/gettokens.py", "ba_data/python/bauiv1lib/gettokens.py",
"ba_data/python/bauiv1lib/helpui.py", "ba_data/python/bauiv1lib/help.py",
"ba_data/python/bauiv1lib/iconpicker.py", "ba_data/python/bauiv1lib/iconpicker.py",
"ba_data/python/bauiv1lib/inbox.py", "ba_data/python/bauiv1lib/inbox.py",
"ba_data/python/bauiv1lib/ingamemenu.py", "ba_data/python/bauiv1lib/ingamemenu.py",
@ -516,6 +514,7 @@
"ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/benchmarks.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc",
"ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc", "ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc",
@ -533,6 +532,7 @@
"ba_data/python/bauiv1lib/settings/advanced.py", "ba_data/python/bauiv1lib/settings/advanced.py",
"ba_data/python/bauiv1lib/settings/allsettings.py", "ba_data/python/bauiv1lib/settings/allsettings.py",
"ba_data/python/bauiv1lib/settings/audio.py", "ba_data/python/bauiv1lib/settings/audio.py",
"ba_data/python/bauiv1lib/settings/benchmarks.py",
"ba_data/python/bauiv1lib/settings/controls.py", "ba_data/python/bauiv1lib/settings/controls.py",
"ba_data/python/bauiv1lib/settings/devtools.py", "ba_data/python/bauiv1lib/settings/devtools.py",
"ba_data/python/bauiv1lib/settings/gamepad.py", "ba_data/python/bauiv1lib/settings/gamepad.py",

View File

@ -341,7 +341,6 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/account/viewer.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/account/viewer.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/achievements.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/achievements.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/appinvite.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/appinvite.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/benchmarks.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/characterpicker.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/characterpicker.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/colorpicker.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/colorpicker.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/config.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/config.py \
@ -365,7 +364,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/gather/publictab.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/gather/publictab.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/getremote.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/getremote.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/gettokens.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/gettokens.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/helpui.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/help.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/iconpicker.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/iconpicker.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/inbox.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/inbox.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/ingamemenu.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/ingamemenu.py \
@ -406,6 +405,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/advanced.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/advanced.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/allsettings.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/allsettings.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/audio.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/audio.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/benchmarks.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/controls.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/controls.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/devtools.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/devtools.py \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/gamepad.py \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/gamepad.py \
@ -619,7 +619,6 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/account/__pycache__/viewer.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/account/__pycache__/viewer.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/achievements.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/appinvite.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/benchmarks.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/characterpicker.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/colorpicker.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/config.cpython-312.opt-1.pyc \
@ -643,7 +642,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/gather/__pycache__/publictab.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/gather/__pycache__/publictab.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/getremote.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/gettokens.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/helpui.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/help.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/iconpicker.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/inbox.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/__pycache__/ingamemenu.cpython-312.opt-1.pyc \
@ -684,6 +683,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/advanced.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/allsettings.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/audio.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/benchmarks.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/controls.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/devtools.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc \ $(BUILD_DIR)/ba_data/python/bauiv1lib/settings/__pycache__/gamepad.cpython-312.opt-1.pyc \

View File

@ -15,14 +15,16 @@ from babase import (
AppIntentDefault, AppIntentDefault,
invoke_main_menu, invoke_main_menu,
screenmessage, screenmessage,
in_main_menu, # in_main_menu,
) )
import _baclassic import _baclassic
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Callable
from babase import AppIntent from babase import AppIntent
from bauiv1 import UIV1AppSubsystem, MainWindow from bauiv1 import UIV1AppSubsystem, MainWindow, MainWindowState
class ClassicAppMode(AppMode): class ClassicAppMode(AppMode):
@ -124,38 +126,6 @@ class ClassicAppMode(AppMode):
if not app.active: if not app.active:
invoke_main_menu() invoke_main_menu()
def _jump_to_main_window(self, window: MainWindow) -> None:
"""Jump to a window with the main menu as its parent."""
from bauiv1lib.mainmenu import MainMenuWindow
from bauiv1lib.ingamemenu import InGameMenuWindow
ui = app.ui_v1
old_window = ui.get_main_window()
if isinstance(old_window, (MainMenuWindow, InGameMenuWindow)):
# If we're currently in the top level menu window, just push
# our mainwindow on to the end.
old_window.main_window_replace(window)
else:
# Blow away the window stack and build a fresh one.
ui.clear_main_window()
back_state = (
MainMenuWindow.do_get_main_window_state()
if in_main_menu()
else InGameMenuWindow.do_get_main_window_state()
)
# set_main_window() needs this to be set.
back_state.is_top_level = True
ui.set_main_window(
window,
from_window=False, # Disable from-check.
back_state=back_state,
suppress_warning=True,
)
def _root_ui_menu_press(self) -> None: def _root_ui_menu_press(self) -> None:
from babase import push_back_press from babase import push_back_press
@ -173,18 +143,11 @@ class ClassicAppMode(AppMode):
import bauiv1 import bauiv1
from bauiv1lib.account.settings import AccountSettingsWindow from bauiv1lib.account.settings import AccountSettingsWindow
ui = app.ui_v1 self._auxiliary_window_nav(
win_type=AccountSettingsWindow,
# If the window is already showing, back out of it. win_create_call=lambda: AccountSettingsWindow(
current_main_window = ui.get_main_window()
if isinstance(current_main_window, AccountSettingsWindow):
current_main_window.main_window_back()
return
self._jump_to_main_window(
AccountSettingsWindow(
origin_widget=bauiv1.get_special_widget('account_button') origin_widget=bauiv1.get_special_widget('account_button')
) ),
) )
def _root_ui_squad_press(self) -> None: def _root_ui_squad_press(self) -> None:
@ -201,52 +164,133 @@ class ClassicAppMode(AppMode):
import bauiv1 import bauiv1
from bauiv1lib.settings.allsettings import AllSettingsWindow from bauiv1lib.settings.allsettings import AllSettingsWindow
self._auxiliary_window_nav(
win_type=AllSettingsWindow,
win_create_call=lambda: AllSettingsWindow(
origin_widget=bauiv1.get_special_widget('settings_button')
),
)
def _auxiliary_window_nav(
self,
win_type: type[MainWindow],
win_create_call: Callable[[], MainWindow],
) -> None:
"""Navigate to or away from a particular type of Auxiliary window."""
# pylint: disable=unidiomatic-typecheck
ui = app.ui_v1 ui = app.ui_v1
# If the window is already showing, back out of it.
current_main_window = ui.get_main_window() current_main_window = ui.get_main_window()
if isinstance(current_main_window, AllSettingsWindow):
# Scan our ancestors for auxiliary states matching our type as
# well as auxiliary states in general.
aux_matching_state: MainWindowState | None = None
aux_state: MainWindowState | None = None
if current_main_window is None:
raise RuntimeError(
'Not currently handling no-top-level-window case.'
)
state = current_main_window.main_window_back_state
while state is not None:
assert state.window_type is not None
if state.is_auxiliary:
if state.window_type is win_type:
aux_matching_state = state
else:
aux_state = state
state = state.parent
# If there's an ancestor auxiliary window-state matching our
# type, back out past it (example: poking settings, navigating
# down a level or two, and then poking settings again should
# back out of settings).
if aux_matching_state is not None:
current_main_window.main_window_back_state = (
aux_matching_state.parent
)
current_main_window.main_window_back() current_main_window.main_window_back()
return return
self._jump_to_main_window( # If there's an ancestory auxiliary state *not* matching our
AllSettingsWindow( # type, crop the state and swap in our new auxiliary UI
origin_widget=bauiv1.get_special_widget('settings_button') # (example: poking settings, then poking account, then poking
# back should end up where things were before the settings
# poke).
if aux_state is not None:
# Blow away the window stack and build a fresh one.
ui.clear_main_window()
ui.set_main_window(
win_create_call(),
from_window=False, # Disable from-check.
back_state=aux_state.parent,
suppress_warning=True,
is_auxiliary=True,
) )
return
# Ok, no auxiliary states found. Now if current window is auxiliary
# and the type matches, simply do a back.
if (
current_main_window.main_window_is_auxiliary
and type(current_main_window) is win_type
):
current_main_window.main_window_back()
return
# If current window is auxiliary but type doesn't match,
# swap it out for our new auxiliary UI.
if current_main_window.main_window_is_auxiliary:
ui.clear_main_window()
ui.set_main_window(
win_create_call(),
from_window=False, # Disable from-check.
back_state=current_main_window.main_window_back_state,
suppress_warning=True,
is_auxiliary=True,
)
return
# Ok, no existing auxiliary stuff was found period. Just
# navigate forward to this UI.
current_main_window.main_window_replace(
win_create_call(), is_auxiliary=True
) )
def _root_ui_achievements_press(self) -> None: def _root_ui_achievements_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.achievements import AchievementsWindow from bauiv1lib.achievements import AchievementsWindow
btn = bauiv1.get_special_widget('achievements_button') self._auxiliary_window_nav(
win_type=AchievementsWindow,
AchievementsWindow(position=btn.get_screen_space_center()) win_create_call=lambda: AchievementsWindow(
origin_widget=bauiv1.get_special_widget('achievements_button')
),
)
def _root_ui_inbox_press(self) -> None: def _root_ui_inbox_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.inbox import InboxWindow from bauiv1lib.inbox import InboxWindow
btn = bauiv1.get_special_widget('inbox_button') self._auxiliary_window_nav(
win_type=InboxWindow,
InboxWindow(position=btn.get_screen_space_center()) win_create_call=lambda: InboxWindow(
origin_widget=bauiv1.get_special_widget('inbox_button')
),
)
def _root_ui_store_press(self) -> None: def _root_ui_store_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.store.browser import StoreBrowserWindow from bauiv1lib.store.browser import StoreBrowserWindow
ui = app.ui_v1 self._auxiliary_window_nav(
win_type=StoreBrowserWindow,
# If the window is already showing, back out of it. win_create_call=lambda: StoreBrowserWindow(
current_main_window = ui.get_main_window()
if isinstance(current_main_window, StoreBrowserWindow):
current_main_window.main_window_back()
return
self._jump_to_main_window(
StoreBrowserWindow(
origin_widget=bauiv1.get_special_widget('store_button') origin_widget=bauiv1.get_special_widget('store_button')
) ),
) )
def _root_ui_tickets_meter_press(self) -> None: def _root_ui_tickets_meter_press(self) -> None:
@ -270,25 +314,17 @@ class ClassicAppMode(AppMode):
from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.account import show_sign_in_prompt
from bauiv1lib.league.rankwindow import LeagueRankWindow from bauiv1lib.league.rankwindow import LeagueRankWindow
ui = app.ui_v1
# If the window is already showing, back out of it.
current_main_window = ui.get_main_window()
if isinstance(current_main_window, LeagueRankWindow):
current_main_window.main_window_back()
return
plus = bauiv1.app.plus plus = bauiv1.app.plus
assert plus is not None assert plus is not None
if plus.get_v1_account_state() != 'signed_in': if plus.get_v1_account_state() != 'signed_in':
show_sign_in_prompt() show_sign_in_prompt()
return return
self._jump_to_main_window( self._auxiliary_window_nav(
LeagueRankWindow( win_type=LeagueRankWindow,
win_create_call=lambda: LeagueRankWindow(
origin_widget=bauiv1.get_special_widget('trophy_meter') origin_widget=bauiv1.get_special_widget('trophy_meter')
) ),
) )
def _root_ui_level_meter_press(self) -> None: def _root_ui_level_meter_press(self) -> None:
@ -303,26 +339,22 @@ class ClassicAppMode(AppMode):
import bauiv1 import bauiv1
from bauiv1lib.inventory import InventoryWindow from bauiv1lib.inventory import InventoryWindow
ui = app.ui_v1 self._auxiliary_window_nav(
win_type=InventoryWindow,
# If the window is already showing, back out of it. win_create_call=lambda: InventoryWindow(
current_main_window = ui.get_main_window()
if isinstance(current_main_window, InventoryWindow):
current_main_window.main_window_back()
return
self._jump_to_main_window(
InventoryWindow(
origin_widget=bauiv1.get_special_widget('inventory_button') origin_widget=bauiv1.get_special_widget('inventory_button')
) ),
) )
def _root_ui_get_tokens_press(self) -> None: def _root_ui_get_tokens_press(self) -> None:
import bauiv1 import bauiv1
from bauiv1lib.gettokens import GetTokensWindow from bauiv1lib.gettokens import GetTokensWindow
GetTokensWindow( self._auxiliary_window_nav(
origin_widget=bauiv1.get_special_widget('get_tokens_button') win_type=GetTokensWindow,
win_create_call=lambda: GetTokensWindow(
origin_widget=bauiv1.get_special_widget('get_tokens_button')
),
) )
def _root_ui_chest_slot_pressed(self, index: int) -> None: def _root_ui_chest_slot_pressed(self, index: int) -> None:

View File

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

View File

@ -181,8 +181,10 @@ class UIV1AppSubsystem(babase.AppSubsystem):
f' cannot use auto-back.' f' cannot use auto-back.'
) )
# Valid states should have a value here. # Valid states should have values here.
assert back_state.is_top_level is not None assert back_state.is_top_level is not None
assert back_state.is_auxiliary is not None
assert back_state.window_type is not None
backwin = back_state.create_window(transition='in_left') backwin = back_state.create_window(transition='in_left')
@ -205,6 +207,7 @@ class UIV1AppSubsystem(babase.AppSubsystem):
from_window: bauiv1.MainWindow | None | bool = True, from_window: bauiv1.MainWindow | None | bool = True,
is_back: bool = False, is_back: bool = False,
is_top_level: bool = False, is_top_level: bool = False,
is_auxiliary: bool = False,
back_state: MainWindowState | None = None, back_state: MainWindowState | None = None,
suppress_warning: bool = False, suppress_warning: bool = False,
) -> None: ) -> None:
@ -214,6 +217,7 @@ class UIV1AppSubsystem(babase.AppSubsystem):
MainWindow methods main_window_replace() and main_window_back() MainWindow methods main_window_replace() and main_window_back()
should be used when possible for navigation. should be used when possible for navigation.
""" """
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
from bauiv1._uitypes import MainWindow from bauiv1._uitypes import MainWindow
@ -254,9 +258,13 @@ class UIV1AppSubsystem(babase.AppSubsystem):
# If they passed a back-state, make sure it is fully filled out. # If they passed a back-state, make sure it is fully filled out.
if back_state is not None: if back_state is not None:
if back_state.is_top_level is None: if (
back_state.is_top_level is None
or back_state.is_auxiliary is None
or back_state.window_type is None
):
raise RuntimeError( raise RuntimeError(
'back_state.is_top_level has not been set.' 'Provided back_state is incomplete.'
' Make sure to only pass fully-filled-out MainWindowStates.' ' Make sure to only pass fully-filled-out MainWindowStates.'
) )
# If a top-level main-window is being set, complain if there already # If a top-level main-window is being set, complain if there already
@ -309,18 +317,24 @@ class UIV1AppSubsystem(babase.AppSubsystem):
logging.exception('Error checking from_window') logging.exception('Error checking from_window')
if is_back: if is_back:
# is_top_level should never be True here (only applies forward). # These values should only be passed for forward navigation.
assert not is_top_level assert not is_top_level
# Always should have back_state in this case. assert not is_auxiliary
# Make sure back state is complete.
assert back_state is not None assert back_state is not None
assert back_state.is_top_level is not None assert back_state.is_top_level is not None
assert back_state.is_auxiliary is not None
assert back_state.window_type is type(window)
window.main_window_back_state = back_state.parent window.main_window_back_state = back_state.parent
window.main_window_is_top_level = back_state.is_top_level window.main_window_is_top_level = back_state.is_top_level
window.main_window_is_auxiliary = back_state.is_auxiliary
else: else:
# Store if the window is top-level so we won't complain later if # Store if the window is top-level so we won't complain later if
# we go back from it and there's nowhere to go to. # we go back from it and there's nowhere to go to.
window.main_window_is_top_level = is_top_level window.main_window_is_top_level = is_top_level
window.main_window_is_auxiliary = is_auxiliary
# When navigating forward, generate a back-window-state from # When navigating forward, generate a back-window-state from
# the outgoing window. # the outgoing window.
if is_top_level: if is_top_level:
@ -386,6 +400,8 @@ class UIV1AppSubsystem(babase.AppSubsystem):
# Store some common window stuff on its state. # Store some common window stuff on its state.
winstate.parent = window.main_window_back_state winstate.parent = window.main_window_back_state
winstate.is_top_level = window.main_window_is_top_level winstate.is_top_level = window.main_window_is_top_level
winstate.is_auxiliary = window.main_window_is_auxiliary
winstate.window_type = type(window)
return winstate return winstate
@ -397,12 +413,15 @@ class UIV1AppSubsystem(babase.AppSubsystem):
# Valid states should have a value here. # Valid states should have a value here.
assert state.is_top_level is not None assert state.is_top_level is not None
assert state.is_auxiliary is not None
assert state.window_type is not None
win = state.create_window(transition=None) win = state.create_window(transition=None)
self.set_main_window( self.set_main_window(
win, win,
from_window=False, # disable check from_window=False, # disable check
is_top_level=state.is_top_level, is_top_level=state.is_top_level,
is_auxiliary=state.is_auxiliary,
back_state=state.parent, back_state=state.parent,
suppress_warning=True, suppress_warning=True,
) )

View File

@ -65,6 +65,13 @@ class MainWindow(Window):
self.main_window_is_top_level: bool = False self.main_window_is_top_level: bool = False
# Windows can be flagged as auxiliary when not related to the
# main UI task at hand. UI code may choose to handle auxiliary
# windows in special ways, such as by implicitly replacing
# existing auxiliary windows with new ones instead of keeping
# old ones as back targets.
self.main_window_is_auxiliary: bool = False
self._main_window_transition = transition self._main_window_transition = transition
self._main_window_origin_widget = origin_widget self._main_window_origin_widget = origin_widget
super().__init__(root_widget, cleanupcheck) super().__init__(root_widget, cleanupcheck)
@ -147,7 +154,10 @@ class MainWindow(Window):
self.main_window_close() self.main_window_close()
def main_window_replace( def main_window_replace(
self, new_window: MainWindow, back_state: MainWindowState | None = None self,
new_window: MainWindow,
back_state: MainWindowState | None = None,
is_auxiliary: bool = False,
) -> None: ) -> None:
"""Replace ourself with a new MainWindow.""" """Replace ourself with a new MainWindow."""
@ -177,6 +187,7 @@ class MainWindow(Window):
new_window, new_window,
from_window=self, from_window=self,
back_state=back_state, back_state=back_state,
is_auxiliary=is_auxiliary,
suppress_warning=True, suppress_warning=True,
) )
@ -203,6 +214,8 @@ class MainWindowState:
# The window that back/cancel navigation should take us to. # The window that back/cancel navigation should take us to.
self.parent: MainWindowState | None = None self.parent: MainWindowState | None = None
self.is_top_level: bool | None = None self.is_top_level: bool | None = None
self.is_auxiliary: bool | None = None
self.window_type: type[MainWindow] | None = None
def create_window( def create_window(
self, self,
@ -314,10 +327,10 @@ def ui_upkeep() -> None:
print( print(
'WARNING:', 'WARNING:',
obj, 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' ' you might have a memory leak. Look for circular'
' references or outside things referencing your window' ' references or outside things referencing your Window'
' instance. See efro.debug module' ' class instance. See efro.debug module'
' for tools that can help debug this sort of thing.', ' for tools that can help debug this sort of thing.',
) )
else: else:

View File

@ -334,20 +334,6 @@ class AccountSettingsWindow(bui.MainWindow):
) )
linked_accounts_text_space = 60.0 linked_accounts_text_space = 60.0
# Always show achievements except in the game-center case where
# its unified UI covers them.
# show_achievements_button =
# self._v1_signed_in and not game_center_active
# Update: No longer showing this since its visible on main
# toolbar.
show_achievements_button = False
achievements_button_space = 60.0
# show_achievements_text = (
# self._v1_signed_in and not show_achievements_button
# )
# Update: No longer showing this since its visible on main # Update: No longer showing this since its visible on main
# toolbar. # toolbar.
show_achievements_text = False show_achievements_text = False
@ -422,8 +408,6 @@ class AccountSettingsWindow(bui.MainWindow):
self._sub_height += linked_accounts_text_space self._sub_height += linked_accounts_text_space
if show_achievements_text: if show_achievements_text:
self._sub_height += achievements_text_space self._sub_height += achievements_text_space
if show_achievements_button:
self._sub_height += achievements_button_space
if show_leaderboards_button: if show_leaderboards_button:
self._sub_height += leaderboards_button_space self._sub_height += leaderboards_button_space
if show_campaign_progress: if show_campaign_progress:
@ -876,43 +860,7 @@ class AccountSettingsWindow(bui.MainWindow):
else: else:
self._achievements_text = None self._achievements_text = None
self._achievements_button: bui.Widget | None if show_achievements_text:
if show_achievements_button:
button_width = 300
v -= achievements_button_space * 0.85
self._achievements_button = btn = bui.buttonwidget(
parent=self._subcontainer,
position=((self._sub_width - button_width) * 0.5, v),
color=(0.55, 0.5, 0.6),
textcolor=(0.75, 0.7, 0.8),
autoselect=True,
icon=bui.gettexture(
'googlePlayAchievementsIcon'
if gpgs_active
else 'achievementsIcon'
),
icon_color=(
(0.8, 0.95, 0.7) if gpgs_active else (0.85, 0.8, 0.9)
),
on_activate_call=(
self._on_custom_achievements_press
if gpgs_active
else self._on_achievements_press
),
size=(button_width, 50),
label='',
)
if first_selectable is None:
first_selectable = btn
bui.widget(
edit=btn, right_widget=bui.get_special_widget('squad_button')
)
bui.widget(edit=btn, left_widget=bbtn)
v -= achievements_button_space * 0.15
else:
self._achievements_button = None
if show_achievements_text or show_achievements_button:
self._refresh_achievements() self._refresh_achievements()
self._leaderboards_button: bui.Widget | None self._leaderboards_button: bui.Widget | None
@ -1212,15 +1160,6 @@ class AccountSettingsWindow(bui.MainWindow):
else: else:
logging.warning('show_game_service_ui requires plus feature-set.') logging.warning('show_game_service_ui requires plus feature-set.')
def _on_achievements_press(self) -> None:
# pylint: disable=cyclic-import
from bauiv1lib import achievements
assert self._achievements_button is not None
achievements.AchievementsWindow(
position=self._achievements_button.get_screen_space_center()
)
def _on_manage_account_press(self) -> None: def _on_manage_account_press(self) -> None:
self._do_manage_account_press(WebLocation.ACCOUNT_EDITOR) self._do_manage_account_press(WebLocation.ACCOUNT_EDITOR)
@ -1401,10 +1340,7 @@ class AccountSettingsWindow(bui.MainWindow):
def _refresh_achievements(self) -> None: def _refresh_achievements(self) -> None:
assert bui.app.classic is not None assert bui.app.classic is not None
if ( if self._achievements_text is None:
self._achievements_text is None
and self._achievements_button is None
):
return return
complete = sum( complete = sum(
1 if a.complete else 0 for a in bui.app.classic.ach.achievements 1 if a.complete else 0 for a in bui.app.classic.ach.achievements
@ -1417,8 +1353,6 @@ class AccountSettingsWindow(bui.MainWindow):
if self._achievements_text is not None: if self._achievements_text is not None:
bui.textwidget(edit=self._achievements_text, text=txt_final) bui.textwidget(edit=self._achievements_text, text=txt_final)
if self._achievements_button is not None:
bui.buttonwidget(edit=self._achievements_button, label=txt_final)
def _link_accounts_press(self) -> None: def _link_accounts_press(self) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import

View File

@ -6,55 +6,70 @@ from __future__ import annotations
from typing import override from typing import override
from bauiv1lib.popup import PopupWindow
import bauiv1 as bui import bauiv1 as bui
class AchievementsWindow(PopupWindow): class AchievementsWindow(bui.MainWindow):
"""Popup window to view achievements.""" """Popup window to view achievements."""
def __init__( def __init__(
self, position: tuple[float, float], scale: float | None = None self,
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
): ):
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
if scale is None: self._width = 600 if uiscale is bui.UIScale.SMALL else 450
scale = (
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
)
self._transitioning_out = False
self._width = 450
self._height = ( self._height = (
300 380
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 370 if uiscale is bui.UIScale.MEDIUM else 450 else 370 if uiscale is bui.UIScale.MEDIUM else 450
) )
bg_color = (0.5, 0.4, 0.6) yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
# creates our _root_widget
super().__init__( super().__init__(
position=position, root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
scale=scale, toolbar_visibility=(
bg_color=bg_color, 'menu_minimal'
edge_buffer_scale=4.0, # Try to keep button unobscured. if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
scale=(
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
),
stack_offset=(
(0, 0)
if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
),
),
transition=transition,
origin_widget=origin_widget,
) )
self._cancel_button = bui.buttonwidget( if uiscale is bui.UIScale.SMALL:
parent=self.root_widget, bui.containerwidget(
position=(50, self._height - 30), edit=self._root_widget, on_cancel_call=self.main_window_back
size=(50, 50), )
scale=0.5, self._back_button = None
label='', else:
color=bg_color, self._back_button = bui.buttonwidget(
on_activate_call=self._on_cancel_press, parent=self._root_widget,
autoselect=True, autoselect=True,
icon=bui.gettexture('crossOut'), position=(50, self._height - 38 + yoffs),
iconscale=1.2, size=(60, 60),
) scale=0.6,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
on_activate_call=self.main_window_back,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._back_button
)
achievements = bui.app.classic.ach.achievements achievements = bui.app.classic.ach.achievements
num_complete = len([a for a in achievements if a.complete]) num_complete = len([a for a in achievements if a.complete])
@ -67,8 +82,13 @@ class AchievementsWindow(PopupWindow):
], ],
) )
self._title_text = bui.textwidget( self._title_text = bui.textwidget(
parent=self.root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 20), position=(
self._width * 0.5,
self._height
- (27 if uiscale is bui.UIScale.SMALL else 20)
+ yoffs,
),
size=(0, 0), size=(0, 0),
h_align='center', h_align='center',
v_align='center', v_align='center',
@ -79,16 +99,27 @@ class AchievementsWindow(PopupWindow):
) )
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self.root_widget, parent=self._root_widget,
size=(self._width - 60, self._height - 70), size=(
position=(30, 30), self._width - 60,
self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
),
position=(
30,
(110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
),
capture_arrows=True, capture_arrows=True,
simple_culling_v=10, simple_culling_v=10,
) )
bui.widget(edit=self._scrollwidget, autoselect=True) bui.widget(edit=self._scrollwidget, autoselect=True)
if uiscale is bui.UIScale.SMALL:
bui.widget(
edit=self._scrollwidget,
left_widget=bui.get_special_widget('back_button'),
)
bui.containerwidget( bui.containerwidget(
edit=self.root_widget, cancel_button=self._cancel_button edit=self._root_widget, cancel_button=self._back_button
) )
incr = 36 incr = 36
@ -224,15 +255,12 @@ class AchievementsWindow(PopupWindow):
v_align='center', v_align='center',
) )
def _on_cancel_press(self) -> None:
self._transition_out()
def _transition_out(self) -> None:
if not self._transitioning_out:
self._transitioning_out = True
bui.containerwidget(edit=self.root_widget, transition='out_scale')
@override @override
def on_popup_cancel(self) -> None: def get_main_window_state(self) -> bui.MainWindowState:
bui.getsound('swish').play() # Support recreating our window for back/refresh purposes.
self._transition_out() cls = type(self)
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition, origin_widget=origin_widget
)
)

View File

@ -195,8 +195,6 @@ class CharacterPicker(PopupWindow):
def _on_store_press(self) -> None: def _on_store_press(self) -> None:
from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.account import show_sign_in_prompt
# from bauiv1lib.store.browser import StoreBrowserWindow
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
@ -209,15 +207,6 @@ class CharacterPicker(PopupWindow):
self._transition_out() self._transition_out()
# bui.screenmessage('UNDER CONSTRUCTION')
# return
# StoreBrowserWindow(
# modal=True,
# show_tab=StoreBrowserWindow.TabID.CHARACTERS,
# origin_widget=self._get_more_characters_button,
# )
def _select_character(self, character: str) -> None: def _select_character(self, character: str) -> None:
if self._delegate is not None: if self._delegate is not None:
self._delegate.on_character_picker_pick(character) self._delegate.on_character_picker_pick(character)

View File

@ -47,7 +47,7 @@ class CoopBrowserWindow(bui.MainWindow):
# Quick note to players that tourneys won't work in ballistica # Quick note to players that tourneys won't work in ballistica
# core builds. (need to split the word so it won't get subbed # core builds. (need to split the word so it won't get subbed
# out) # out)
if 'ballistica' + 'kit' == bui.appname(): if 'ballistica' + 'kit' == bui.appname() and bui.do_once():
bui.apptimer( bui.apptimer(
1.0, 1.0,
lambda: bui.screenmessage( lambda: bui.screenmessage(
@ -77,12 +77,12 @@ class CoopBrowserWindow(bui.MainWindow):
self._width = 1520 if uiscale is bui.UIScale.SMALL else 1120 self._width = 1520 if uiscale is bui.UIScale.SMALL else 1120
self._x_inset = x_inset = 200 if uiscale is bui.UIScale.SMALL else 0 self._x_inset = x_inset = 200 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
565 600
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 730 if uiscale is bui.UIScale.MEDIUM else 800 else 730 if uiscale is bui.UIScale.MEDIUM else 800
) )
self._r = 'coopSelectWindow' self._r = 'coopSelectWindow'
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 top_extra = 0 if uiscale is bui.UIScale.SMALL else 0
self._tourney_data_up_to_date = False self._tourney_data_up_to_date = False
@ -109,7 +109,7 @@ class CoopBrowserWindow(bui.MainWindow):
size=(self._width, self._height + top_extra), size=(self._width, self._height + top_extra),
toolbar_visibility='menu_full', toolbar_visibility='menu_full',
stack_offset=( stack_offset=(
(0, -17) (0, -8)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -256,7 +256,7 @@ class CoopBrowserWindow(bui.MainWindow):
self._scroll_width = self._width - (130 + 2 * x_inset) self._scroll_width = self._width - (130 + 2 * x_inset)
self._scroll_height = self._height - ( self._scroll_height = self._height - (
185 if uiscale is bui.UIScale.SMALL else 160 219 if uiscale is bui.UIScale.SMALL else 160
) )
self._subcontainerwidth = 800.0 self._subcontainerwidth = 800.0

View File

@ -32,7 +32,7 @@ class CreditsWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 990 if uiscale is bui.UIScale.SMALL else 670 width = 990 if uiscale is bui.UIScale.SMALL else 670
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
height = 398 if uiscale is bui.UIScale.SMALL else 500 height = 450 if uiscale is bui.UIScale.SMALL else 500
self._r = 'creditsWindow' self._r = 'creditsWindow'
super().__init__( super().__init__(
@ -86,7 +86,7 @@ class CreditsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - (65 if uiscale is bui.UIScale.SMALL else 54)), position=(0, height - (93 if uiscale is bui.UIScale.SMALL else 54)),
size=(width, 30), size=(width, 30),
scale=0.8 if uiscale is bui.UIScale.SMALL else 1.0, scale=0.8 if uiscale is bui.UIScale.SMALL else 1.0,
text=bui.Lstr( text=bui.Lstr(
@ -101,8 +101,11 @@ class CreditsWindow(bui.MainWindow):
scroll = bui.scrollwidget( scroll = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(40 + x_inset, 35), position=(40 + x_inset, 62 if uiscale is bui.UIScale.SMALL else 35),
size=(width - (80 + 2 * x_inset), height - 100), size=(
width - (80 + 2 * x_inset),
height - (160 if uiscale is bui.UIScale.SMALL else 100),
),
capture_arrows=True, capture_arrows=True,
) )

View File

@ -90,8 +90,9 @@ class GatherWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 1640 if uiscale is bui.UIScale.SMALL else 1040 self._width = 1640 if uiscale is bui.UIScale.SMALL else 1040
x_offs = 200 if uiscale is bui.UIScale.SMALL else 0 x_offs = 200 if uiscale is bui.UIScale.SMALL else 0
y_offs = -65 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
550 650
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 680 if uiscale is bui.UIScale.MEDIUM else 800 else 680 if uiscale is bui.UIScale.MEDIUM else 800
) )
@ -113,7 +114,7 @@ class GatherWindow(bui.MainWindow):
else 0.95 if uiscale is bui.UIScale.MEDIUM else 0.7 else 0.95 if uiscale is bui.UIScale.MEDIUM else 0.7
), ),
stack_offset=( stack_offset=(
(0, -20) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -130,7 +131,7 @@ class GatherWindow(bui.MainWindow):
else: else:
self._back_button = btn = bui.buttonwidget( self._back_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(70 + x_offs, self._height - 74), position=(70 + x_offs, self._height - 74 + y_offs),
size=(140, 60), size=(140, 60),
scale=1.1, scale=1.1,
autoselect=True, autoselect=True,
@ -153,7 +154,7 @@ class GatherWindow(bui.MainWindow):
) )
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 42 + t_offs_y), position=(self._width * 0.5, self._height - 42 + t_offs_y + y_offs),
size=(0, 0), size=(0, 0),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
scale=( scale=(
@ -197,7 +198,10 @@ class GatherWindow(bui.MainWindow):
self._tab_row = TabRow( self._tab_row = TabRow(
self._root_widget, self._root_widget,
tabdefs, tabdefs,
pos=(tab_buffer_h * 0.5, self._height - 130 + tabs_top_extra), pos=(
tab_buffer_h * 0.5,
self._height - 130 + tabs_top_extra + y_offs,
),
size=(self._width - tab_buffer_h, 50), size=(self._width - tab_buffer_h, 50),
on_select_call=bui.WeakCall(self._set_tab), on_select_call=bui.WeakCall(self._set_tab),
) )
@ -227,11 +231,20 @@ class GatherWindow(bui.MainWindow):
) )
self._scroll_width = self._width - scroll_buffer_h self._scroll_width = self._width - scroll_buffer_h
self._scroll_height = self._height - 180.0 + tabs_top_extra self._scroll_height = (
self._height
- (270.0 if uiscale is bui.UIScale.SMALL else 180.0)
+ tabs_top_extra
)
self._scroll_left = (self._width - self._scroll_width) * 0.5 self._scroll_left = (self._width - self._scroll_width) * 0.5
self._scroll_bottom = ( self._scroll_bottom = (
self._height - self._scroll_height - 79 - 48 + tabs_top_extra self._height
- self._scroll_height
- 79
- 48
+ tabs_top_extra
+ y_offs
) )
buffer_h = 10 buffer_h = 10
buffer_v = 4 buffer_v = 4

View File

@ -24,7 +24,7 @@ from bacommon.net import (
from bauiv1lib.gather import GatherTab from bauiv1lib.gather import GatherTab
from bauiv1lib.play import PlaylistSelectContext from bauiv1lib.play import PlaylistSelectContext
from bauiv1lib.gettokens import GetTokensWindow, show_get_tokens_prompt from bauiv1lib.gettokens import show_get_tokens_prompt
import bascenev1 as bs import bascenev1 as bs
import bauiv1 as bui import bauiv1 as bui
@ -551,13 +551,13 @@ class PrivateGatherTab(GatherTab):
edit=self._join_party_code_text, on_return_press_call=btn.activate edit=self._join_party_code_text, on_return_press_call=btn.activate
) )
def _on_get_tokens_press(self) -> None: # def _on_get_tokens_press(self) -> None:
if self._waiting_for_start_stop_response: # if self._waiting_for_start_stop_response:
return # return
# Bring up get-tickets window and then kill ourself (we're on # # Bring up get-tickets window and then kill ourself (we're on
# the overlay layer so we'd show up above it). # # the overlay layer so we'd show up above it).
GetTokensWindow(origin_widget=self._get_tokens_button) # GetTokensWindow(origin_widget=self._get_tokens_button)
def _build_host_tab(self) -> None: def _build_host_tab(self) -> None:
# pylint: disable=too-many-branches # pylint: disable=too-many-branches

View File

@ -8,7 +8,7 @@ import time
from enum import Enum from enum import Enum
from functools import partial from functools import partial
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, assert_never from typing import TYPE_CHECKING, assert_never, override
import bacommon.cloud import bacommon.cloud
import bauiv1 as bui import bauiv1 as bui
@ -54,7 +54,7 @@ class _TxtDef:
rotate: float | None = None rotate: float | None = None
class GetTokensWindow(bui.Window): class GetTokensWindow(bui.MainWindow):
"""Window for purchasing/acquiring classic tickets.""" """Window for purchasing/acquiring classic tickets."""
class State(Enum): class State(Enum):
@ -67,12 +67,10 @@ class GetTokensWindow(bui.Window):
def __init__( def __init__(
self, self,
transition: str = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
restore_previous_call: Callable[[bui.Widget], None] | None = None, # restore_previous_call: Callable[[bui.Widget], None] | None = None,
): ):
# pylint: disable=too-many-locals
bwidthstd = 170 bwidthstd = 170
bwidthwide = 300 bwidthwide = 300
ycolor = (0, 0, 0.3) ycolor = (0, 0, 0.3)
@ -304,7 +302,7 @@ class GetTokensWindow(bui.Window):
] ]
self._transitioning_out = False self._transitioning_out = False
self._restore_previous_call = restore_previous_call # self._restore_previous_call = restore_previous_call
self._textcolor = (0.92, 0.92, 2.0) self._textcolor = (0.92, 0.92, 2.0)
self._query_in_flight = False self._query_in_flight = False
@ -314,14 +312,14 @@ class GetTokensWindow(bui.Window):
) )
# If they provided an origin-widget, scale up from that. # If they provided an origin-widget, scale up from that.
scale_origin: tuple[float, float] | None # scale_origin: tuple[float, float] | None
if origin_widget is not None: # if origin_widget is not None:
self._transition_out = 'out_scale' # self._transition_out = 'out_scale'
scale_origin = origin_widget.get_screen_space_center() # scale_origin = origin_widget.get_screen_space_center()
transition = 'in_scale' # transition = 'in_scale'
else: # else:
self._transition_out = 'out_right' # self._transition_out = 'out_right'
scale_origin = None # scale_origin = None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 1000.0 if uiscale is bui.UIScale.SMALL else 800.0 self._width = 1000.0 if uiscale is bui.UIScale.SMALL else 800.0
@ -334,8 +332,8 @@ class GetTokensWindow(bui.Window):
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
transition=transition, # transition=transition,
scale_origin_stack_offset=scale_origin, # scale_origin_stack_offset=scale_origin,
color=(0.3, 0.23, 0.36), color=(0.3, 0.23, 0.36),
scale=( scale=(
1.5 1.5
@ -346,13 +344,19 @@ class GetTokensWindow(bui.Window):
(0, -3) if uiscale is bui.UIScale.SMALL else (0, 0) (0, -3) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
# toolbar_visibility='menu_minimal', # toolbar_visibility='menu_minimal',
toolbar_visibility='get_tokens', toolbar_visibility=(
) 'get_tokens'
if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
),
transition=transition,
origin_widget=origin_widget,
) )
if uiscale is bui.UIScale.SMALL: if uiscale is bui.UIScale.SMALL:
bui.containerwidget( bui.containerwidget(
edit=self._root_widget, on_cancel_call=self._back edit=self._root_widget, on_cancel_call=self.main_window_back
) )
self._back_button = bui.get_special_widget('back_button') self._back_button = bui.get_special_widget('back_button')
else: else:
@ -363,23 +367,26 @@ class GetTokensWindow(bui.Window):
self._height - 80 + self._y_offset, self._height - 80 + self._y_offset,
), ),
size=( size=(
(140, 60) # (140, 60)
if self._restore_previous_call is None # if self._restore_previous_call is None
else (60, 60) # else
(60, 60)
), ),
scale=1.0, scale=1.0,
autoselect=True, autoselect=True,
label=( label=(
bui.Lstr(resource='doneText') # bui.Lstr(resource='doneText')
if self._restore_previous_call is None # if self._restore_previous_call is None
else bui.charstr(bui.SpecialChar.BACK) # else
bui.charstr(bui.SpecialChar.BACK)
), ),
button_type=( button_type=(
'regular' # 'regular'
if self._restore_previous_call is None # if self._restore_previous_call is None
else 'backSmall' # else
'backSmall'
), ),
on_activate_call=self._back, on_activate_call=self.main_window_back,
) )
# if uiscale is bui.UIScale.SMALL: # if uiscale is bui.UIScale.SMALL:
# bui.widget( # bui.widget(
@ -446,6 +453,16 @@ class GetTokensWindow(bui.Window):
# self._ticking_sound.stop() # self._ticking_sound.stop()
# self._ticking_sound = None # self._ticking_sound = None
@override
def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes.
cls = type(self)
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition, origin_widget=origin_widget
)
)
def _update(self) -> None: def _update(self) -> None:
# No-op if our underlying widget is dead or on its way out. # No-op if our underlying widget is dead or on its way out.
if not self._root_widget or self._root_widget.transitioning_out: if not self._root_widget or self._root_widget.transitioning_out:
@ -815,17 +832,18 @@ class GetTokensWindow(bui.Window):
# self._ticking_sound = None # self._ticking_sound = None
# bui.getsound('cashRegister2').play() # bui.getsound('cashRegister2').play()
def _back(self) -> None: # def _back(self) -> None:
# No-op if our underlying widget is dead or on its way out. # self.main_
if not self._root_widget or self._root_widget.transitioning_out: # No-op if our underlying widget is dead or on its way out.
return # if not self._root_widget or self._root_widget.transitioning_out:
# return
bui.containerwidget( # bui.containerwidget(
edit=self._root_widget, transition=self._transition_out # edit=self._root_widget, transition=self._transition_out
) # )
if self._restore_previous_call is not None: # if self._restore_previous_call is not None:
self._restore_previous_call(self._root_widget) # self._restore_previous_call(self._root_widget)
def _on_learn_more_press(self, url: str) -> None: def _on_learn_more_press(self, url: str) -> None:
bui.open_url(url) bui.open_url(url)

View File

@ -26,13 +26,14 @@ class HelpWindow(bui.MainWindow):
getres = bui.app.lang.get_resource getres = bui.app.lang.get_resource
# self._main_menu = main_menu
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 1050 if uiscale is bui.UIScale.SMALL else 750 width = 1050 if uiscale is bui.UIScale.SMALL else 750
x_offs = 70 if uiscale is bui.UIScale.SMALL else 0 xoffs = 70 if uiscale is bui.UIScale.SMALL else 0
yoffs = -33 if uiscale is bui.UIScale.SMALL else 0
height = ( height = (
460 500
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 530 if uiscale is bui.UIScale.MEDIUM else 600 else 530 if uiscale is bui.UIScale.MEDIUM else 600
) )
@ -51,7 +52,7 @@ class HelpWindow(bui.MainWindow):
else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -24) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -62,7 +63,10 @@ class HelpWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)), position=(
0,
height - (50 if uiscale is bui.UIScale.SMALL else 45) + yoffs,
),
size=(width, 25), size=(width, 25),
text=bui.Lstr( text=bui.Lstr(
resource=f'{self._r}.titleText', resource=f'{self._r}.titleText',
@ -75,11 +79,14 @@ class HelpWindow(bui.MainWindow):
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(44 + x_offs, 55 if uiscale is bui.UIScale.SMALL else 55), position=(
44 + xoffs,
(92 if uiscale is bui.UIScale.SMALL else 55) + yoffs,
),
simple_culling_v=100.0, simple_culling_v=100.0,
size=( size=(
width - (88 + 2 * x_offs), width - (88 + 2 * xoffs),
height - 120 + (5 if uiscale is bui.UIScale.SMALL else 0), height - (150 if uiscale is bui.UIScale.SMALL else 120),
), ),
capture_arrows=True, capture_arrows=True,
) )
@ -105,7 +112,7 @@ class HelpWindow(bui.MainWindow):
else: else:
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(x_offs + 50, height - 55), position=(xoffs + 50, height - 55),
size=(60, 55), size=(60, 55),
scale=0.8, scale=0.8,
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),

View File

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

View File

@ -6,58 +6,79 @@ from __future__ import annotations
from typing import override from typing import override
from bauiv1lib.popup import PopupWindow # from bauiv1lib.popup import PopupWindow
import bauiv1 as bui import bauiv1 as bui
class InboxWindow(PopupWindow): class InboxWindow(bui.MainWindow):
"""Popup window to show account messages.""" """Popup window to show account messages."""
def __init__( def __init__(
self, position: tuple[float, float], scale: float | None = None self,
transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None,
): ):
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
if scale is None: self._width = 600 if uiscale is bui.UIScale.SMALL else 450
scale = (
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
)
self._transitioning_out = False
self._width = 450
self._height = ( self._height = (
300 380
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 370 if uiscale is bui.UIScale.MEDIUM else 450 else 370 if uiscale is bui.UIScale.MEDIUM else 450
) )
bg_color = (0.5, 0.4, 0.6) yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
# creates our _root_widget
super().__init__( super().__init__(
position=position, root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
scale=scale, toolbar_visibility=(
bg_color=bg_color, 'menu_minimal'
edge_buffer_scale=4.0, # Try to keep button unobscured. if uiscale is bui.UIScale.SMALL
else 'menu_full'
),
scale=(
2.3
if uiscale is bui.UIScale.SMALL
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
),
stack_offset=(
(0, 0)
if uiscale is bui.UIScale.SMALL
else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
),
),
transition=transition,
origin_widget=origin_widget,
) )
self._cancel_button = bui.buttonwidget( if uiscale is bui.UIScale.SMALL:
parent=self.root_widget, bui.containerwidget(
position=(50, self._height - 30), edit=self._root_widget, on_cancel_call=self.main_window_back
size=(50, 50), )
scale=0.5, self._back_button = None
label='', else:
color=bg_color, self._back_button = bui.buttonwidget(
on_activate_call=self._on_cancel_press, parent=self._root_widget,
autoselect=True, autoselect=True,
icon=bui.gettexture('crossOut'), position=(50, self._height - 38 + yoffs),
iconscale=1.2, size=(60, 60),
) scale=0.6,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
on_activate_call=self.main_window_back,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._back_button
)
self._title_text = bui.textwidget( self._title_text = bui.textwidget(
parent=self.root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 20), position=(
self._width * 0.5,
self._height
- (27 if uiscale is bui.UIScale.SMALL else 20)
+ yoffs,
),
size=(0, 0), size=(0, 0),
h_align='center', h_align='center',
v_align='center', v_align='center',
@ -68,16 +89,27 @@ class InboxWindow(PopupWindow):
) )
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self.root_widget, parent=self._root_widget,
size=(self._width - 60, self._height - 70), size=(
position=(30, 30), self._width - 60,
self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
),
position=(
30,
(110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
),
capture_arrows=True, capture_arrows=True,
simple_culling_v=10, simple_culling_v=10,
) )
bui.widget(edit=self._scrollwidget, autoselect=True) bui.widget(edit=self._scrollwidget, autoselect=True)
if uiscale is bui.UIScale.SMALL:
bui.widget(
edit=self._scrollwidget,
left_widget=bui.get_special_widget('back_button'),
)
bui.containerwidget( bui.containerwidget(
edit=self.root_widget, cancel_button=self._cancel_button edit=self._root_widget, cancel_button=self._back_button
) )
entries: list[str] = [] entries: list[str] = []
@ -105,15 +137,26 @@ class InboxWindow(PopupWindow):
v_align='center', v_align='center',
) )
def _on_cancel_press(self) -> None:
self._transition_out()
def _transition_out(self) -> None:
if not self._transitioning_out:
self._transitioning_out = True
bui.containerwidget(edit=self.root_widget, transition='out_scale')
@override @override
def on_popup_cancel(self) -> None: def get_main_window_state(self) -> bui.MainWindowState:
bui.getsound('swish').play() # Support recreating our window for back/refresh purposes.
self._transition_out() cls = type(self)
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
transition=transition, origin_widget=origin_widget
)
)
# def _on_cancel_press(self) -> None:
# self._transition_out()
# def _transition_out(self) -> None:
# if not self._transitioning_out:
# self._transitioning_out = True
# bui.containerwidget(
# edit=self._root_widget, transition='out_scale')
# @override
# def on_popup_cancel(self) -> None:
# bui.getsound('swish').play()
# self._transition_out()

View File

@ -24,11 +24,12 @@ class InventoryWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 1050 if uiscale is bui.UIScale.SMALL else 750 width = 1050 if uiscale is bui.UIScale.SMALL else 750
height = ( height = (
460 500
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 530 if uiscale is bui.UIScale.MEDIUM else 600 else 530 if uiscale is bui.UIScale.MEDIUM else 600
) )
x_offs = 70 if uiscale is bui.UIScale.SMALL else 0 x_offs = 70 if uiscale is bui.UIScale.SMALL else 0
yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
@ -44,7 +45,7 @@ class InventoryWindow(bui.MainWindow):
else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.15 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -24) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -55,7 +56,7 @@ class InventoryWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)), position=(0, height - 45 + yoffs),
size=(width, 25), size=(width, 25),
text='INVENTORY', text='INVENTORY',
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -70,7 +71,7 @@ class InventoryWindow(bui.MainWindow):
else: else:
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(x_offs + 50, height - 55), position=(x_offs + 50, height - 55 + yoffs),
size=(60, 55), size=(60, 55),
scale=0.8, scale=0.8,
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),
@ -83,7 +84,7 @@ class InventoryWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - 120), position=(0, height - 120 + yoffs),
size=(width, 25), size=(width, 25),
text='(under construction)', text='(under construction)',
scale=0.7, scale=0.7,
@ -94,7 +95,7 @@ class InventoryWindow(bui.MainWindow):
button_width = 300 button_width = 300
self._player_profiles_button = btn = bui.buttonwidget( self._player_profiles_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=((width - button_width) * 0.5, height - 200), position=((width - button_width) * 0.5, height - 200 + yoffs),
autoselect=True, autoselect=True,
size=(button_width, 60), size=(button_width, 60),
label=bui.Lstr(resource='playerProfilesWindow.titleText'), label=bui.Lstr(resource='playerProfilesWindow.titleText'),

View File

@ -186,16 +186,14 @@ class LeagueRankWindow(bui.MainWindow):
self._update(show=info is None) self._update(show=info is None)
def _on_achievements_press(self) -> None: def _on_achievements_press(self) -> None:
from bauiv1lib import achievements from bauiv1lib.achievements import AchievementsWindow
# only allow this for all-time or the current season # only allow this for all-time or the current season
# (we currently don't keep specific achievement data for old seasons) # (we currently don't keep specific achievement data for old seasons)
if self._season == 'a' or self._is_current_season: if self._season == 'a' or self._is_current_season:
prab = self._power_ranking_achievements_button prab = self._power_ranking_achievements_button
assert prab is not None assert prab is not None
achievements.AchievementsWindow( self.main_window_replace(AchievementsWindow(origin_widget=prab))
position=prab.get_screen_space_center()
)
else: else:
bui.screenmessage( bui.screenmessage(
bui.Lstr( bui.Lstr(

View File

@ -91,7 +91,7 @@ class MainMenuWindow(bui.MainWindow):
import bauiv1lib.account.settings as _unused5 import bauiv1lib.account.settings as _unused5
import bauiv1lib.store.browser as _unused6 import bauiv1lib.store.browser as _unused6
import bauiv1lib.credits as _unused7 import bauiv1lib.credits as _unused7
import bauiv1lib.helpui as _unused8 import bauiv1lib.help as _unused8
import bauiv1lib.settings.allsettings as _unused9 import bauiv1lib.settings.allsettings as _unused9
import bauiv1lib.gather as _unused10 import bauiv1lib.gather as _unused10
import bauiv1lib.watch as _unused11 import bauiv1lib.watch as _unused11
@ -524,7 +524,7 @@ class MainMenuWindow(bui.MainWindow):
def _howtoplay(self) -> None: def _howtoplay(self) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bauiv1lib.helpui import HelpWindow from bauiv1lib.help import HelpWindow
# no-op if we're not currently in control. # no-op if we're not currently in control.
if not self.main_window_has_control(): if not self.main_window_has_control():

View File

@ -28,17 +28,18 @@ class PlaylistAddGameWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 750 if uiscale is bui.UIScale.SMALL else 650 self._width = 750 if uiscale is bui.UIScale.SMALL else 650
x_inset = 50 if uiscale is bui.UIScale.SMALL else 0 x_inset = 50 if uiscale is bui.UIScale.SMALL else 0
yoffs = -44 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
346 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 380 if uiscale is bui.UIScale.MEDIUM else 440 else 400 if uiscale is bui.UIScale.MEDIUM else 460
) )
top_extra = 30 if uiscale is bui.UIScale.SMALL else 20
self._scroll_width = 210 self._scroll_width = 210
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height),
scale=( scale=(
1.95 1.95
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
@ -56,7 +57,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(58 + x_inset, self._height - 53), position=(58 + x_inset, self._height - 53 + yoffs),
size=(60, 48), size=(60, 48),
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),
autoselect=True, autoselect=True,
@ -65,7 +66,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
) )
self._select_button = select_button = bui.buttonwidget( self._select_button = select_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - (172 + x_inset), self._height - 50), position=(self._width - (172 + x_inset), self._height - 50 + yoffs),
autoselect=True, autoselect=True,
size=(160, 60), size=(160, 60),
scale=0.75, scale=0.75,
@ -81,7 +82,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 28), position=(self._width * 0.5, self._height - 28 + yoffs),
size=(0, 0), size=(0, 0),
scale=1.0, scale=1.0,
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
@ -90,7 +91,7 @@ class PlaylistAddGameWindow(bui.MainWindow):
maxwidth=250, maxwidth=250,
v_align='center', v_align='center',
) )
v = self._height - 64 v = self._height - 64 + yoffs
self._selected_title_text = bui.textwidget( self._selected_title_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
@ -114,9 +115,11 @@ class PlaylistAddGameWindow(bui.MainWindow):
h_align='left', h_align='left',
) )
scroll_height = self._height - 100 scroll_height = self._height - (
160 if uiscale is bui.UIScale.SMALL else 100
)
v = self._height - 60 v = self._height - 60 + yoffs
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -61,7 +61,7 @@ class PlaylistBrowserWindow(bui.MainWindow):
else 510 if uiscale is bui.UIScale.MEDIUM else 580 else 510 if uiscale is bui.UIScale.MEDIUM else 580
) )
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 top_extra = 30 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
@ -80,7 +80,7 @@ class PlaylistBrowserWindow(bui.MainWindow):
else 1.05 if uiscale is bui.UIScale.MEDIUM else 0.9 else 1.05 if uiscale is bui.UIScale.MEDIUM else 0.9
), ),
stack_offset=( stack_offset=(
(0, -56) if uiscale is bui.UIScale.SMALL else (0, 0) (0, -46) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,

View File

@ -45,20 +45,20 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 970.0 if uiscale is bui.UIScale.SMALL else 650.0 self._width = 970.0 if uiscale is bui.UIScale.SMALL else 650.0
x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0 x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0
yoffs = -51 if uiscale is bui.UIScale.SMALL else 0.0
self._height = ( self._height = (
380.0 440.0
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 420.0 if uiscale is bui.UIScale.MEDIUM else 500.0 else 420.0 if uiscale is bui.UIScale.MEDIUM else 500.0
) )
top_extra = 20.0 if uiscale is bui.UIScale.SMALL else 0.0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height),
scale=( scale=(
1.83 1.8
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
toolbar_visibility=( toolbar_visibility=(
'menu_minimal' 'menu_minimal'
@ -66,7 +66,7 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
else 'menu_full' else 'menu_full'
), ),
stack_offset=( stack_offset=(
(0, -10) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -82,7 +82,7 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(43 + x_inset, self._height - 60), position=(43 + x_inset, self._height - 60 + yoffs),
size=(160, 68), size=(160, 68),
scale=0.77, scale=0.77,
autoselect=True, autoselect=True,
@ -99,7 +99,12 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, self._height - 47), position=(
0,
self._height
- (47 if uiscale is bui.UIScale.SMALL else 47)
+ yoffs,
),
size=(self._width, 25), size=(self._width, 25),
text=bui.Lstr( text=bui.Lstr(
resource=f'{self._r}.titleText', resource=f'{self._r}.titleText',
@ -111,7 +116,7 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
v_align='center', v_align='center',
) )
v = self._height - 59.0 v = self._height - 59.0 + yoffs
h = 41 + x_inset h = 41 + x_inset
b_color = (0.6, 0.53, 0.63) b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
@ -260,8 +265,10 @@ class PlaylistCustomizeBrowserWindow(bui.MainWindow):
) )
) )
v = self._height - 75 v = self._height - 75 + yoffs
self._scroll_height = self._height - 119 self._scroll_height = self._height - (
180 if uiscale is bui.UIScale.SMALL else 119
)
scrollwidget = bui.scrollwidget( scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(140 + x_inset, v - self._scroll_height), position=(140 + x_inset, v - self._scroll_height),

View File

@ -35,22 +35,22 @@ class PlaylistEditWindow(bui.MainWindow):
self._width = 870 if uiscale is bui.UIScale.SMALL else 670 self._width = 870 if uiscale is bui.UIScale.SMALL else 670
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
400 500
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 470 if uiscale is bui.UIScale.MEDIUM else 540 else 470 if uiscale is bui.UIScale.MEDIUM else 540
) )
yoffs = -68 if uiscale is bui.UIScale.SMALL else 0
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height + top_extra), size=(self._width, self._height),
scale=( scale=(
1.8 1.76
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -16) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -58,7 +58,7 @@ class PlaylistEditWindow(bui.MainWindow):
) )
cancel_button = bui.buttonwidget( cancel_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(35 + x_inset, self._height - 60), position=(35 + x_inset, self._height - 60 + yoffs),
scale=0.8, scale=0.8,
size=(175, 60), size=(175, 60),
autoselect=True, autoselect=True,
@ -67,7 +67,7 @@ class PlaylistEditWindow(bui.MainWindow):
) )
save_button = btn = bui.buttonwidget( save_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - (195 + x_inset), self._height - 60), position=(self._width - (195 + x_inset), self._height - 60 + yoffs),
scale=0.8, scale=0.8,
size=(190, 60), size=(190, 60),
autoselect=True, autoselect=True,
@ -89,7 +89,7 @@ class PlaylistEditWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(-10, self._height - 50), position=(-10, self._height - 50 + yoffs),
size=(self._width, 25), size=(self._width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -99,7 +99,7 @@ class PlaylistEditWindow(bui.MainWindow):
maxwidth=270, maxwidth=270,
) )
v = self._height - 115.0 v = self._height - 115.0 + yoffs
self._scroll_width = self._width - (205 + 2 * x_inset) self._scroll_width = self._width - (205 + 2 * x_inset)
@ -136,7 +136,7 @@ class PlaylistEditWindow(bui.MainWindow):
self._list_widgets: list[bui.Widget] = [] self._list_widgets: list[bui.Widget] = []
h = 40 + x_inset h = 40 + x_inset
v = self._height - 172.0 v = self._height - 172.0 + yoffs
b_color = (0.6, 0.53, 0.63) b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
@ -222,8 +222,10 @@ class PlaylistEditWindow(bui.MainWindow):
repeat=True, repeat=True,
) )
v = self._height - 100 v = self._height - 100 + yoffs
scroll_height = self._height - 155 scroll_height = self._height - (
250 if uiscale is bui.UIScale.SMALL else 155
)
scrollwidget = bui.scrollwidget( scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(160 + x_inset, v - scroll_height), position=(160 + x_inset, v - scroll_height),

View File

@ -109,13 +109,14 @@ class PlaylistEditGameWindow(bui.MainWindow):
width = 820 if uiscale is bui.UIScale.SMALL else 620 width = 820 if uiscale is bui.UIScale.SMALL else 620
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
height = ( height = (
365 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 460 if uiscale is bui.UIScale.MEDIUM else 550 else 460 if uiscale is bui.UIScale.MEDIUM else 550
) )
spacing = 52 spacing = 52
y_extra = 15 y_extra = 15
y_extra2 = 21 y_extra2 = 21
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
map_tex_name = get_map_class(self._map).get_preview_texture_name() map_tex_name = get_map_class(self._map).get_preview_texture_name()
if map_tex_name is None: if map_tex_name is None:
@ -132,7 +133,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.35 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -17) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -141,7 +142,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(45 + x_inset, height - 82 + y_extra2), position=(45 + x_inset, height - 82 + y_extra2 + yoffs),
size=(60, 48) if is_add else (180, 65), size=(60, 48) if is_add else (180, 65),
label=( label=(
bui.charstr(bui.SpecialChar.BACK) bui.charstr(bui.SpecialChar.BACK)
@ -158,7 +159,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
add_button = bui.buttonwidget( add_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width - (193 + x_inset), height - 82 + y_extra2), position=(width - (193 + x_inset), height - 82 + y_extra2 + yoffs),
size=(200, 65), size=(200, 65),
scale=0.75, scale=0.75,
text_scale=1.3, text_scale=1.3,
@ -174,7 +175,7 @@ class PlaylistEditGameWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(-8, height - 70 + y_extra2), position=(-8, height - 70 + y_extra2 + yoffs),
size=(width, 25), size=(width, 25),
text=gametype.get_display_string(), text=gametype.get_display_string(),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -194,8 +195,14 @@ class PlaylistEditGameWindow(bui.MainWindow):
scroll_width = width - (86 + 2 * x_inset) scroll_width = width - (86 + 2 * x_inset)
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(44 + x_inset, 35 + y_extra), position=(
size=(scroll_width, height - 116), 44 + x_inset,
(80 if uiscale is bui.UIScale.SMALL else 35) + y_extra + yoffs,
),
size=(
scroll_width,
height - (166 if uiscale is bui.UIScale.SMALL else 116),
),
highlight=False, highlight=False,
claims_left_right=True, claims_left_right=True,
claims_tab=True, claims_tab=True,

View File

@ -53,22 +53,22 @@ class PlaylistMapSelectWindow(bui.MainWindow):
width = 815 if uiscale is bui.UIScale.SMALL else 615 width = 815 if uiscale is bui.UIScale.SMALL else 615
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
height = ( height = (
400 420
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 480 if uiscale is bui.UIScale.MEDIUM else 600 else 480 if uiscale is bui.UIScale.MEDIUM else 600
) )
yoffs = -37 if uiscale is bui.UIScale.SMALL else 0
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(width, height + top_extra), size=(width, height),
scale=( scale=(
1.95 1.95
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -27) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -77,7 +77,7 @@ class PlaylistMapSelectWindow(bui.MainWindow):
self._cancel_button = btn = bui.buttonwidget( self._cancel_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(38 + x_inset, height - 67), position=(38 + x_inset, height - 67 + yoffs),
size=(140, 50), size=(140, 50),
scale=0.9, scale=0.9,
text_scale=1.0, text_scale=1.0,
@ -89,7 +89,7 @@ class PlaylistMapSelectWindow(bui.MainWindow):
bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.containerwidget(edit=self._root_widget, cancel_button=btn)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, height - 46), position=(width * 0.5, height - 46 + yoffs),
size=(0, 0), size=(0, 0),
maxwidth=260, maxwidth=260,
scale=1.1, scale=1.1,
@ -101,9 +101,11 @@ class PlaylistMapSelectWindow(bui.MainWindow):
h_align='center', h_align='center',
v_align='center', v_align='center',
) )
v = height - 70 v = height - 70 + yoffs
self._scroll_width = width - (80 + 2 * x_inset) self._scroll_width = width - (80 + 2 * x_inset)
self._scroll_height = height - 140 self._scroll_height = height - (
170 if uiscale is bui.UIScale.SMALL else 140
)
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -9,11 +9,14 @@ from typing import cast, override
from bauiv1lib.colorpicker import ColorPicker from bauiv1lib.colorpicker import ColorPicker
from bauiv1lib.characterpicker import CharacterPickerDelegate from bauiv1lib.characterpicker import CharacterPickerDelegate
from bauiv1lib.iconpicker import IconPickerDelegate
import bauiv1 as bui import bauiv1 as bui
import bascenev1 as bs import bascenev1 as bs
class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate): class EditProfileWindow(
bui.MainWindow, CharacterPickerDelegate, IconPickerDelegate
):
"""Window for editing a player profile.""" """Window for editing a player profile."""
def reload_window(self) -> None: def reload_window(self) -> None:
@ -30,10 +33,12 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
back_state=self.main_window_back_state, back_state=self.main_window_back_state,
) )
# def __del__(self) -> None:
# print(f'~EditProfileWindow({id(self)})')
def __init__( def __init__(
self, self,
existing_profile: str | None, existing_profile: str | None,
# in_main_menu: bool,
transition: str | None = 'in_right', transition: str | None = 'in_right',
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):
@ -41,12 +46,13 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
assert bui.app.classic is not None assert bui.app.classic is not None
# print(f'EditProfileWindow({id(self)})')
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
# self._in_main_menu = in_main_menu
self._existing_profile = existing_profile self._existing_profile = existing_profile
self._r = 'editProfileWindow' self._r = 'editProfileWindow'
self._spazzes: list[str] = [] self._spazzes: list[str] = []
@ -62,10 +68,11 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
self._width = width = 880.0 if uiscale is bui.UIScale.SMALL else 680.0 self._width = width = 880.0 if uiscale is bui.UIScale.SMALL else 680.0
self._x_inset = x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0 self._x_inset = x_inset = 100.0 if uiscale is bui.UIScale.SMALL else 0.0
self._height = height = ( self._height = height = (
450.0 500.0
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 400.0 if uiscale is bui.UIScale.MEDIUM else 450.0 else 400.0 if uiscale is bui.UIScale.MEDIUM else 450.0
) )
yoffs = -42 if uiscale is bui.UIScale.SMALL else 0
spacing = 40 spacing = 40
self._base_scale = ( self._base_scale = (
1.6 1.6
@ -78,13 +85,10 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
size=(width, height + top_extra), size=(width, height + top_extra),
scale=self._base_scale, scale=self._base_scale,
stack_offset=( stack_offset=(
(0, -40) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
toolbar_visibility=( 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, transition=transition,
@ -92,7 +96,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
) )
cancel_button = btn = bui.buttonwidget( cancel_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(52 + x_inset, height - 60), position=(52 + x_inset, height - 60 + yoffs),
size=(155, 60), size=(155, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -102,7 +106,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.containerwidget(edit=self._root_widget, cancel_button=btn)
save_button = btn = bui.buttonwidget( save_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width - (177 + x_inset), height - 60), position=(width - (177 + x_inset), height - 60 + yoffs),
size=(155, 60), size=(155, 60),
autoselect=True, autoselect=True,
scale=0.8, scale=0.8,
@ -113,7 +117,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
bui.containerwidget(edit=self._root_widget, start_button=btn) bui.containerwidget(edit=self._root_widget, start_button=btn)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, height - 38), position=(self._width * 0.5, height - 38 + yoffs),
size=(0, 0), size=(0, 0),
text=( text=(
bui.Lstr(resource=f'{self._r}.titleNewText') bui.Lstr(resource=f'{self._r}.titleNewText')
@ -163,7 +167,7 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
self._icon_index = icon_index self._icon_index = icon_index
bui.buttonwidget(edit=save_button, on_activate_call=self.save) bui.buttonwidget(edit=save_button, on_activate_call=self.save)
v = height - 115.0 v = height - 115.0 + yoffs
self._name = ( self._name = (
'' if self._existing_profile is None else self._existing_profile '' if self._existing_profile is None else self._existing_profile
) )
@ -522,12 +526,16 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
def get_main_window_state(self) -> bui.MainWindowState: def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes. # Support recreating our window for back/refresh purposes.
cls = type(self) 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( return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls( create_call=lambda transition, origin_widget: cls(
transition=transition, transition=transition,
origin_widget=origin_widget, origin_widget=origin_widget,
existing_profile=self._existing_profile, existing_profile=existing_profile,
# in_main_menu=self._in_main_menu,
) )
) )
@ -637,18 +645,35 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
for s in self._spazzes for s in self._spazzes
] ]
@override
def on_icon_picker_pick(self, icon: str) -> None: def on_icon_picker_pick(self, icon: str) -> None:
"""An icon has been selected by the picker.""" """An icon has been selected by the picker."""
self._icon = icon self._icon = icon
self._update_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 @override
def on_character_picker_pick(self, character: str) -> None: def on_character_picker_pick(self, character: str) -> None:
"""A character has been selected by the picker.""" """A character has been selected by the picker."""
if not self._root_widget: if not self._root_widget:
return 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.refresh_characters()
self._icon_index = ( self._icon_index = (
self._spazzes.index(character) if character in self._spazzes else 0 self._spazzes.index(character) if character in self._spazzes else 0
@ -847,8 +872,8 @@ class EditProfileWindow(bui.MainWindow, CharacterPickerDelegate):
} }
) )
# Also lets be aware we're no longer global if we're taking a # Also lets be aware we're no longer global if we're taking
# new name (will need to re-request it). # a new name (will need to re-request it).
self._global = False self._global = False
plus.add_v1_account_transaction( plus.add_v1_account_transaction(

View File

@ -34,13 +34,14 @@ class ProfileUpgradeWindow(bui.Window):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 750 if uiscale is bui.UIScale.SMALL else 680 self._width = 750 if uiscale is bui.UIScale.SMALL else 680
self._height = 350 self._height = 450 if uiscale is bui.UIScale.SMALL else 350
assert bui.app.classic is not None assert bui.app.classic is not None
self._base_scale = ( self._base_scale = (
1.9 1.9
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.2 else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.2
) )
yoffs = -60.0 if uiscale is bui.UIScale.SMALL else 0
self._upgrade_start_time: float | None = None self._upgrade_start_time: float | None = None
self._name = edit_profile_window.getname() self._name = edit_profile_window.getname()
self._edit_profile_window = weakref.ref(edit_profile_window) self._edit_profile_window = weakref.ref(edit_profile_window)
@ -53,13 +54,13 @@ class ProfileUpgradeWindow(bui.Window):
transition=transition, transition=transition,
scale=self._base_scale, scale=self._base_scale,
stack_offset=( stack_offset=(
(0, -30) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
) )
) )
cancel_button = bui.buttonwidget( cancel_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(52, 60), position=(52, self._height - 290 + yoffs),
size=(155, 60), size=(155, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -68,7 +69,7 @@ class ProfileUpgradeWindow(bui.Window):
) )
self._upgrade_button = bui.buttonwidget( self._upgrade_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - 190, 60), position=(self._width - 190, self._height - 290 + yoffs),
size=(155, 60), size=(155, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -85,7 +86,7 @@ class ProfileUpgradeWindow(bui.Window):
assert bui.app.classic is not None assert bui.app.classic is not None
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 38), position=(self._width * 0.5, self._height - 38 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.upgradeToGlobalProfileText'), text=bui.Lstr(resource=f'{self._r}.upgradeToGlobalProfileText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -98,7 +99,7 @@ class ProfileUpgradeWindow(bui.Window):
assert bui.app.classic is not None assert bui.app.classic is not None
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 100), position=(self._width * 0.5, self._height - 100 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.upgradeProfileInfoText'), text=bui.Lstr(resource=f'{self._r}.upgradeProfileInfoText'),
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
@ -110,7 +111,7 @@ class ProfileUpgradeWindow(bui.Window):
self._status_text = bui.textwidget( self._status_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 160), position=(self._width * 0.5, self._height - 160 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr( text=bui.Lstr(
resource=f'{self._r}.checkingAvailabilityText', resource=f'{self._r}.checkingAvailabilityText',
@ -125,7 +126,7 @@ class ProfileUpgradeWindow(bui.Window):
self._price_text = bui.textwidget( self._price_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 230), position=(self._width * 0.5, self._height - 230 + yoffs),
size=(0, 0), size=(0, 0),
text='', text='',
color=(0.2, 1, 0.2), color=(0.2, 1, 0.2),
@ -135,22 +136,6 @@ class ProfileUpgradeWindow(bui.Window):
v_align='center', v_align='center',
) )
self._tickets_text: bui.Widget | None
# if not bui.app.ui_v1.use_toolbars:
# self._tickets_text = bui.textwidget(
# parent=self._root_widget,
# position=(self._width * 0.9 - 5, self._height - 30),
# size=(0, 0),
# text=bui.charstr(bui.SpecialChar.TICKET) + '123',
# color=(0.2, 1, 0.2),
# maxwidth=100,
# scale=0.5,
# h_align='right',
# v_align='center',
# )
# else:
self._tickets_text = None
bui.app.classic.master_server_v1_get( bui.app.classic.master_server_v1_get(
'bsGlobalProfileCheck', 'bsGlobalProfileCheck',
{'name': self._name, 'b': bui.app.env.engine_build_number}, {'name': self._name, 'b': bui.app.env.engine_build_number},
@ -161,7 +146,7 @@ class ProfileUpgradeWindow(bui.Window):
) )
self._status: str | None = 'waiting' self._status: str | None = 'waiting'
self._update_timer = bui.AppTimer( self._update_timer = bui.AppTimer(
1.0, bui.WeakCall(self._update), repeat=True 1.023, bui.WeakCall(self._update), repeat=True
) )
self._update() self._update()
@ -256,23 +241,11 @@ class ProfileUpgradeWindow(bui.Window):
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
try: # If our originating window dies at any point, cancel.
t_str = str(plus.get_v1_account_ticket_count()) edit_profile_window = self._edit_profile_window()
except Exception: if edit_profile_window is None:
t_str = '?' self._cancel()
if self._tickets_text is not None: return
bui.textwidget(
edit=self._tickets_text,
text=bui.Lstr(
resource='getTicketsWindow.youHaveShortText',
subs=[
(
'${COUNT}',
bui.charstr(bui.SpecialChar.TICKET) + t_str,
)
],
),
)
# Once we've kicked off an upgrade attempt and all transactions go # Once we've kicked off an upgrade attempt and all transactions go
# through, we're done. # through, we're done.

View File

@ -81,7 +81,9 @@ class AdvancedSettingsWindow(bui.MainWindow):
self._show_always_use_internal_keyboard = not app.env.vr self._show_always_use_internal_keyboard = not app.env.vr
self._scroll_width = self._width - (100 + 2 * x_inset) self._scroll_width = self._width - (100 + 2 * x_inset)
self._scroll_height = self._height - 115.0 self._scroll_height = self._height - (
125.0 if uiscale is bui.UIScale.SMALL else 115.0
)
self._sub_width = self._scroll_width * 0.95 self._sub_width = self._scroll_width * 0.95
self._sub_height = 870.0 self._sub_height = 870.0
@ -129,10 +131,10 @@ class AdvancedSettingsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=( position=(
self._width * 0.5, self._width * 0.5,
self._height - (57 if uiscale is bui.UIScale.SMALL else 40), self._height - (61 if uiscale is bui.UIScale.SMALL else 40),
), ),
size=(0, 0), size=(0, 0),
scale=0.65 if uiscale is bui.UIScale.SMALL else 1.0, scale=0.85 if uiscale is bui.UIScale.SMALL else 1.0,
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=app.ui_v1.title_color, color=app.ui_v1.title_color,
h_align='center', h_align='center',
@ -201,7 +203,7 @@ class AdvancedSettingsWindow(bui.MainWindow):
from bauiv1lib import appinvite as _unused5 from bauiv1lib import appinvite as _unused5
from bauiv1lib import account as _unused6 from bauiv1lib import account as _unused6
from bauiv1lib import sendinfo as _unused7 from bauiv1lib import sendinfo as _unused7
from bauiv1lib import benchmarks as _unused8 from bauiv1lib.settings import benchmarks as _unused8
from bauiv1lib.settings import plugins as _unused9 from bauiv1lib.settings import plugins as _unused9
from bauiv1lib.settings import devtools as _unused10 from bauiv1lib.settings import devtools as _unused10
@ -783,7 +785,7 @@ class AdvancedSettingsWindow(bui.MainWindow):
) )
def _on_benchmark_press(self) -> None: def _on_benchmark_press(self) -> None:
from bauiv1lib.benchmarks import BenchmarksAndStressTestsWindow from bauiv1lib.settings.benchmarks import BenchmarksAndStressTestsWindow
# no-op if we're not in control. # no-op if we're not in control.
if not self.main_window_has_control(): if not self.main_window_has_control():

View File

@ -33,9 +33,10 @@ class AllSettingsWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 1000 if uiscale is bui.UIScale.SMALL else 580 width = 1000 if uiscale is bui.UIScale.SMALL else 580
x_inset = 125 if uiscale is bui.UIScale.SMALL else 0 x_inset = 125 if uiscale is bui.UIScale.SMALL else 0
height = 435 height = 500 if uiscale is bui.UIScale.SMALL else 435
self._r = 'settingsWindow' self._r = 'settingsWindow'
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0 top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
super().__init__( super().__init__(
@ -68,7 +69,7 @@ class AllSettingsWindow(bui.MainWindow):
self._back_button = btn = bui.buttonwidget( self._back_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
autoselect=True, autoselect=True,
position=(40 + x_inset, height - 55), position=(40 + x_inset, height - 55 + yoffs),
size=(130, 60), size=(130, 60),
scale=0.8, scale=0.8,
text_scale=1.2, text_scale=1.2,
@ -80,7 +81,7 @@ class AllSettingsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, height - 44), position=(0, height - 44 + yoffs),
size=(width, 25), size=(width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
@ -97,7 +98,7 @@ class AllSettingsWindow(bui.MainWindow):
label=bui.charstr(bui.SpecialChar.BACK), label=bui.charstr(bui.SpecialChar.BACK),
) )
v = height - 80 v = height - 80 + yoffs
v -= 145 v -= 145
basew = 280 if uiscale is bui.UIScale.SMALL else 230 basew = 280 if uiscale is bui.UIScale.SMALL else 230

View File

@ -150,7 +150,7 @@ class ControlsSettingsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=( position=(
0, 0,
height + yoffs - (75 if uiscale is bui.UIScale.SMALL else 50), height + yoffs - (53 if uiscale is bui.UIScale.SMALL else 50),
), ),
size=(width, 25), size=(width, 25),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
@ -159,7 +159,7 @@ class ControlsSettingsWindow(bui.MainWindow):
v_align='top', v_align='top',
) )
v = height - 75 + yoffs v = height - (85 if uiscale is bui.UIScale.SMALL else 75) + yoffs
v -= spacing v -= spacing
if show_touch: if show_touch:

View File

@ -92,7 +92,7 @@ class DevToolsWindow(bui.MainWindow):
self._height - (64 if uiscale is bui.UIScale.SMALL else 48), self._height - (64 if uiscale is bui.UIScale.SMALL else 48),
), ),
size=(0, 25), size=(0, 25),
scale=(0.6 if uiscale is bui.UIScale.SMALL else 1.0), scale=(0.8 if uiscale is bui.UIScale.SMALL else 1.0),
maxwidth=self._width - 200, maxwidth=self._width - 200,
text=bui.Lstr(resource='settingsWindowAdvanced.devToolsText'), text=bui.Lstr(resource='settingsWindowAdvanced.devToolsText'),
color=app.ui_v1.title_color, color=app.ui_v1.title_color,

View File

@ -32,7 +32,9 @@ class NetTestingWindow(bui.MainWindow):
): ):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 820 self._width = 820
self._height = 400 if uiscale is bui.UIScale.SMALL else 500 self._height = 500 if uiscale is bui.UIScale.SMALL else 500
yoffs = -50 if uiscale is bui.UIScale.SMALL else 0
self._printed_lines: list[str] = [] self._printed_lines: list[str] = []
assert bui.app.classic is not None assert bui.app.classic is not None
super().__init__( super().__init__(
@ -53,23 +55,33 @@ class NetTestingWindow(bui.MainWindow):
transition=transition, transition=transition,
origin_widget=origin_widget, origin_widget=origin_widget,
) )
self._done_button: bui.Widget | None = bui.buttonwidget( self._done_button: bui.Widget | None
parent=self._root_widget, if uiscale is bui.UIScale.SMALL:
position=(46, self._height - 77), bui.containerwidget(
size=(60, 60), edit=self._root_widget, on_cancel_call=self.main_window_back
scale=0.9, )
label=bui.charstr(bui.SpecialChar.BACK), self._done_button = None
button_type='backSmall', else:
autoselect=True, self._done_button = bui.buttonwidget(
on_activate_call=self.main_window_back, parent=self._root_widget,
) position=(46, self._height - 77 + yoffs),
size=(60, 60),
scale=0.9,
label=bui.charstr(bui.SpecialChar.BACK),
button_type='backSmall',
autoselect=True,
on_activate_call=self.main_window_back,
)
bui.containerwidget(
edit=self._root_widget, cancel_button=self._done_button
)
# Avoid squads button on small mode. # Avoid squads button on small mode.
xinset = -50 if uiscale is bui.UIScale.SMALL else 0 xinset = -50 if uiscale is bui.UIScale.SMALL else 0
self._copy_button = bui.buttonwidget( self._copy_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - 200 + xinset, self._height - 77), position=(self._width - 200 + xinset, self._height - 77 + yoffs),
size=(100, 60), size=(100, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -79,7 +91,7 @@ class NetTestingWindow(bui.MainWindow):
self._settings_button = bui.buttonwidget( self._settings_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - 100 + xinset, self._height - 77), position=(self._width - 100 + xinset, self._height - 77 + yoffs),
size=(60, 60), size=(60, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -90,7 +102,7 @@ class NetTestingWindow(bui.MainWindow):
twidth = self._width - 540 twidth = self._width - 540
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 55), position=(self._width * 0.5, self._height - 55 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'), text=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'),
color=(0.8, 0.8, 0.8, 1.0), color=(0.8, 0.8, 0.8, 1.0),
@ -101,24 +113,19 @@ class NetTestingWindow(bui.MainWindow):
self._scroll = bui.scrollwidget( self._scroll = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(50, 50), position=(
size=(self._width - 100, self._height - 140), 50,
(140 if uiscale is bui.UIScale.SMALL else 50) + yoffs,
),
size=(
self._width - 100,
self._height - (220 if uiscale is bui.UIScale.SMALL else 140),
),
capture_arrows=True, capture_arrows=True,
autoselect=True, autoselect=True,
) )
self._rows = bui.columnwidget(parent=self._scroll) self._rows = bui.columnwidget(parent=self._scroll)
if uiscale is bui.UIScale.SMALL:
bui.containerwidget(
edit=self._root_widget, on_cancel_call=self.main_window_back
)
self._done_button.delete()
self._done_button = None
else:
bui.containerwidget(
edit=self._root_widget, cancel_button=self._done_button
)
# Now kick off the tests. # Now kick off the tests.
# Pass a weak-ref to this window so we don't keep it alive # Pass a weak-ref to this window so we don't keep it alive
# if we back out before it completes. Also set is as daemon # if we back out before it completes. Also set is as daemon
@ -169,7 +176,7 @@ class NetTestingWindow(bui.MainWindow):
if not self.main_window_has_control(): if not self.main_window_has_control():
return return
self.main_window_replace(NetValTestingWindow()) self.main_window_replace(get_net_val_testing_window())
def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None: def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None:
@ -461,26 +468,48 @@ def _test_nearby_zone_ping(nearest_zone: tuple[str, float] | None) -> None:
raise RuntimeError('Ping too high.') raise RuntimeError('Ping too high.')
class NetValTestingWindow(TestingWindow): def get_net_val_testing_window() -> TestingWindow:
"""Window to test network related settings.""" """Create a window for testing net values."""
entries = [
{'name': 'bufferTime', 'label': 'Buffer Time', 'increment': 1.0},
{
'name': 'delaySampling',
'label': 'Delay Sampling',
'increment': 1.0,
},
{
'name': 'dynamicsSyncTime',
'label': 'Dynamics Sync Time',
'increment': 10,
},
{'name': 'showNetInfo', 'label': 'Show Net Info', 'increment': 1},
]
return TestingWindow(
title=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'),
entries=entries,
)
def __init__(self, transition: str = 'in_right'):
entries = [ # class NetValTestingWindow(TestingWindow):
{'name': 'bufferTime', 'label': 'Buffer Time', 'increment': 1.0}, # """Window to test network related settings."""
{
'name': 'delaySampling', # def __init__(self, transition: str = 'in_right'):
'label': 'Delay Sampling', # entries = [
'increment': 1.0, # {'name': 'bufferTime', 'label': 'Buffer Time', 'increment': 1.0},
}, # {
{ # 'name': 'delaySampling',
'name': 'dynamicsSyncTime', # 'label': 'Delay Sampling',
'label': 'Dynamics Sync Time', # 'increment': 1.0,
'increment': 10, # },
}, # {
{'name': 'showNetInfo', 'label': 'Show Net Info', 'increment': 1}, # 'name': 'dynamicsSyncTime',
] # 'label': 'Dynamics Sync Time',
super().__init__( # 'increment': 10,
title=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'), # },
entries=entries, # {'name': 'showNetInfo', 'label': 'Show Net Info', 'increment': 1},
transition=transition, # ]
) # super().__init__(
# title=bui.Lstr(resource='settingsWindowAdvanced.netTestingText'),
# entries=entries,
# transition=transition,
# )

View File

@ -44,12 +44,13 @@ class PluginWindow(bui.MainWindow):
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 870.0 if uiscale is bui.UIScale.SMALL else 670.0 self._width = 870.0 if uiscale is bui.UIScale.SMALL else 670.0
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
yoffs = -55.0 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
370.0 450.0
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 450.0 if uiscale is bui.UIScale.MEDIUM else 520.0 else 450.0 if uiscale is bui.UIScale.MEDIUM else 520.0
) )
top_extra = 10 if uiscale is bui.UIScale.SMALL else 0 top_extra = 0 if uiscale is bui.UIScale.SMALL else 0
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),
@ -64,7 +65,7 @@ class PluginWindow(bui.MainWindow):
else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -25) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -72,7 +73,9 @@ class PluginWindow(bui.MainWindow):
) )
self._scroll_width = self._width - (100 + 2 * x_inset) self._scroll_width = self._width - (100 + 2 * x_inset)
self._scroll_height = self._height - 115.0 self._scroll_height = self._height - (
200.0 if uiscale is bui.UIScale.SMALL else 115.0
)
self._sub_width = self._scroll_width * 0.95 self._sub_width = self._scroll_width * 0.95
self._sub_height = 724.0 self._sub_height = 724.0
@ -85,7 +88,7 @@ class PluginWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(53 + x_inset, self._height - 60), position=(53 + x_inset, self._height - 60 + yoffs),
size=(140, 60), size=(140, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -99,7 +102,7 @@ class PluginWindow(bui.MainWindow):
self._title_text = bui.textwidget( self._title_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 41), position=(self._width * 0.5, self._height - 41 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource='pluginsText'), text=bui.Lstr(resource='pluginsText'),
color=app.ui_v1.title_color, color=app.ui_v1.title_color,
@ -120,7 +123,7 @@ class PluginWindow(bui.MainWindow):
self._num_plugins_text = bui.textwidget( self._num_plugins_text = bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(settings_button_x - 130, self._height - 41), position=(settings_button_x - 130, self._height - 41 + yoffs),
size=(0, 0), size=(0, 0),
text='', text='',
h_align='center', h_align='center',
@ -130,7 +133,7 @@ class PluginWindow(bui.MainWindow):
self._category_button = bui.buttonwidget( self._category_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
scale=0.7, scale=0.7,
position=(settings_button_x - 105, self._height - 60), position=(settings_button_x - 105, self._height - 60 + yoffs),
size=(130, 60), size=(130, 60),
label=bui.Lstr(resource='allText'), label=bui.Lstr(resource='allText'),
autoselect=True, autoselect=True,
@ -141,7 +144,7 @@ class PluginWindow(bui.MainWindow):
self._settings_button = bui.buttonwidget( self._settings_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(settings_button_x, self._height - 58), position=(settings_button_x, self._height - 58 + yoffs),
size=(40, 40), size=(40, 40),
label='', label='',
on_activate_call=self._open_settings, on_activate_call=self._open_settings,
@ -149,7 +152,7 @@ class PluginWindow(bui.MainWindow):
bui.imagewidget( bui.imagewidget(
parent=self._root_widget, parent=self._root_widget,
position=(settings_button_x + 3, self._height - 57), position=(settings_button_x + 3, self._height - 57 + yoffs),
draw_controller=self._settings_button, draw_controller=self._settings_button,
size=(35, 35), size=(35, 35),
texture=bui.gettexture('settingsIcon'), texture=bui.gettexture('settingsIcon'),
@ -163,7 +166,10 @@ class PluginWindow(bui.MainWindow):
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
position=(50 + x_inset, 50), position=(
50 + x_inset,
(135 if uiscale is bui.UIScale.SMALL else 50) + yoffs,
),
simple_culling_v=20.0, simple_culling_v=20.0,
highlight=False, highlight=False,
size=(self._scroll_width, self._scroll_height), size=(self._scroll_width, self._scroll_height),

View File

@ -21,17 +21,13 @@ class PluginSettingsWindow(bui.MainWindow):
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
width = 670.0 if uiscale is bui.UIScale.SMALL else 470.0 width = 750.0 if uiscale is bui.UIScale.SMALL else 470.0
height = ( height = 400.0 if uiscale is bui.UIScale.SMALL else 300.0
365.0 yoffs = -20 if uiscale is bui.UIScale.SMALL else 0
if uiscale is bui.UIScale.SMALL
else 300.0 if uiscale is bui.UIScale.MEDIUM else 370.0
)
top_extra = 10 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(width, height + top_extra), size=(width, height),
toolbar_visibility=( toolbar_visibility=(
'menu_minimal' 'menu_minimal'
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
@ -43,7 +39,7 @@ class PluginSettingsWindow(bui.MainWindow):
else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.4 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -25) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -51,7 +47,7 @@ class PluginSettingsWindow(bui.MainWindow):
) )
if uiscale is bui.UIScale.SMALL: if uiscale is bui.UIScale.SMALL:
xoffs = 90 xoffs = 135
self._back_button = bui.get_special_widget('back_button') self._back_button = bui.get_special_widget('back_button')
bui.containerwidget( bui.containerwidget(
edit=self._root_widget, on_cancel_call=self.main_window_back edit=self._root_widget, on_cancel_call=self.main_window_back
@ -60,7 +56,7 @@ class PluginSettingsWindow(bui.MainWindow):
xoffs = 0 xoffs = 0
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(53, height - 60), position=(53, height - 60 + yoffs),
size=(60, 60), size=(60, 60),
scale=0.8, scale=0.8,
autoselect=True, autoselect=True,
@ -76,7 +72,7 @@ class PluginSettingsWindow(bui.MainWindow):
parent=self._root_widget, parent=self._root_widget,
position=( position=(
width * 0.5, width * 0.5,
height - (45 if uiscale is bui.UIScale.SMALL else 35), height - (55 if uiscale is bui.UIScale.SMALL else 35) + yoffs,
), ),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource='pluginSettingsText'), text=bui.Lstr(resource='pluginSettingsText'),
@ -85,10 +81,10 @@ class PluginSettingsWindow(bui.MainWindow):
v_align='center', v_align='center',
) )
self._y_position = 170 if uiscale is bui.UIScale.MEDIUM else 205 self._y_position = height - 140 + yoffs
self._enable_plugins_button = bui.buttonwidget( self._enable_plugins_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(xoffs + 65, self._y_position), position=(xoffs + 65, self._y_position + yoffs),
size=(350, 60), size=(350, 60),
autoselect=True, autoselect=True,
label=bui.Lstr(resource='pluginsEnableAllText'), label=bui.Lstr(resource='pluginsEnableAllText'),
@ -101,7 +97,7 @@ class PluginSettingsWindow(bui.MainWindow):
self._y_position -= 70 self._y_position -= 70
self._disable_plugins_button = bui.buttonwidget( self._disable_plugins_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(xoffs + 65, self._y_position), position=(xoffs + 65, self._y_position + yoffs),
size=(350, 60), size=(350, 60),
autoselect=True, autoselect=True,
label=bui.Lstr(resource='pluginsDisableAllText'), label=bui.Lstr(resource='pluginsDisableAllText'),
@ -114,7 +110,7 @@ class PluginSettingsWindow(bui.MainWindow):
self._y_position -= 70 self._y_position -= 70
self._enable_new_plugins_check_box = bui.checkboxwidget( self._enable_new_plugins_check_box = bui.checkboxwidget(
parent=self._root_widget, parent=self._root_widget,
position=(xoffs + 65, self._y_position), position=(xoffs + 65, self._y_position + yoffs),
size=(350, 60), size=(350, 60),
value=bui.app.config.get( value=bui.app.config.get(
bui.app.plugins.AUTO_ENABLE_NEW_PLUGINS_CONFIG_KEY, bui.app.plugins.AUTO_ENABLE_NEW_PLUGINS_CONFIG_KEY,

View File

@ -21,7 +21,8 @@ class RemoteAppSettingsWindow(bui.MainWindow):
app = bui.app app = bui.app
uiscale = app.ui_v1.uiscale uiscale = app.ui_v1.uiscale
width = 800 if uiscale is bui.UIScale.SMALL else 700 width = 800 if uiscale is bui.UIScale.SMALL else 700
height = 390 height = 480 if uiscale is bui.UIScale.SMALL else 390
yoffs = -48 if uiscale is bui.UIScale.SMALL else 0
spacing = 40 spacing = 40
assert bui.app.classic is not None assert bui.app.classic is not None
super().__init__( super().__init__(
@ -33,12 +34,12 @@ class RemoteAppSettingsWindow(bui.MainWindow):
else 'menu_full' else 'menu_full'
), ),
scale=( scale=(
1.76 1.75
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.3 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(-10, 0) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -52,7 +53,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
else: else:
btn = bui.buttonwidget( btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(40, height - 67), position=(40, height - 67 + yoffs),
size=(140, 65), size=(140, 65),
scale=0.8, scale=0.8,
label=bui.Lstr(resource='backText'), label=bui.Lstr(resource='backText'),
@ -71,7 +72,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, height - 42), position=(width * 0.5, height - 42 + yoffs),
size=(0, 0), size=(0, 0),
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
maxwidth=370, maxwidth=370,
@ -85,7 +86,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
v -= spacing * 1.2 v -= spacing * 1.2
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(15, v - 26), position=(15, v - 26 + yoffs),
size=(width - 30, 30), size=(width - 30, 30),
maxwidth=width * 0.95, maxwidth=width * 0.95,
color=(0.7, 0.9, 0.7, 1.0), color=(0.7, 0.9, 0.7, 1.0),
@ -106,7 +107,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
# Update: now we just show link to the remote webpage. # Update: now we just show link to the remote webpage.
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, v + 5), position=(width * 0.5, v + 5 + yoffs),
size=(0, 0), size=(0, 0),
color=(0.7, 0.9, 0.7, 1.0), color=(0.7, 0.9, 0.7, 1.0),
scale=1.4, scale=1.4,
@ -120,7 +121,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5, v - 35), position=(width * 0.5, v - 35 + yoffs),
size=(0, 0), size=(0, 0),
color=(0.7, 0.9, 0.7, 0.8), color=(0.7, 0.9, 0.7, 0.8),
scale=0.65, scale=0.65,
@ -133,7 +134,7 @@ class RemoteAppSettingsWindow(bui.MainWindow):
bui.checkboxwidget( bui.checkboxwidget(
parent=self._root_widget, parent=self._root_widget,
position=(width * 0.5 - 150, v - 116), position=(width * 0.5 - 150, v - 116 + yoffs),
size=(300, 30), size=(300, 30),
maxwidth=300, maxwidth=300,
scale=0.8, scale=0.8,

View File

@ -5,7 +5,7 @@
from __future__ import annotations from __future__ import annotations
import copy import copy
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, override
import bauiv1 as bui import bauiv1 as bui
@ -25,9 +25,12 @@ class TestingWindow(bui.MainWindow):
): ):
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 700 if uiscale is bui.UIScale.SMALL else 600 self._width = 690 if uiscale is bui.UIScale.SMALL else 600
self._height = 324 if uiscale is bui.UIScale.SMALL else 400 self._height = 400 if uiscale is bui.UIScale.SMALL else 400
self._entries_orig = copy.deepcopy(entries)
self._entries = copy.deepcopy(entries) self._entries = copy.deepcopy(entries)
yoffs = -50 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
@ -37,7 +40,7 @@ class TestingWindow(bui.MainWindow):
else 1.2 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.2 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -20) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
toolbar_visibility=( toolbar_visibility=(
'menu_minimal' 'menu_minimal'
@ -58,7 +61,7 @@ class TestingWindow(bui.MainWindow):
self._back_button = btn = bui.buttonwidget( self._back_button = btn = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
autoselect=True, autoselect=True,
position=(65, self._height - 59), position=(65, self._height - 59 + yoffs),
size=(130, 60), size=(130, 60),
scale=0.8, scale=0.8,
text_scale=1.2, text_scale=1.2,
@ -74,25 +77,30 @@ class TestingWindow(bui.MainWindow):
) )
bui.containerwidget(edit=self._root_widget, cancel_button=btn) bui.containerwidget(edit=self._root_widget, cancel_button=btn)
self.title = title
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=( position=(
self._width * 0.5, self._width * 0.5,
self._height - (42 if uiscale is bui.UIScale.SMALL else 35), self._height
- (42 if uiscale is bui.UIScale.SMALL else 35)
+ yoffs,
), ),
size=(0, 0), size=(0, 0),
color=bui.app.ui_v1.title_color, color=bui.app.ui_v1.title_color,
h_align='center', h_align='center',
v_align='center', v_align='center',
maxwidth=245, maxwidth=245,
text=title, text=self.title,
) )
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=( position=(
self._width * 0.5, self._width * 0.5,
self._height - (80 if uiscale is bui.UIScale.SMALL else 80), self._height
- (80 if uiscale is bui.UIScale.SMALL else 80)
+ yoffs,
), ),
size=(0, 0), size=(0, 0),
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
@ -102,12 +110,17 @@ class TestingWindow(bui.MainWindow):
text=bui.Lstr(resource='settingsWindowAdvanced.forTestingText'), text=bui.Lstr(resource='settingsWindowAdvanced.forTestingText'),
) )
self._scroll_width = self._width - 130 self._scroll_width = self._width - 130
self._scroll_height = self._height - 140 self._scroll_height = self._height - (
220 if uiscale is bui.UIScale.SMALL else 140
)
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
size=(self._scroll_width, self._scroll_height), size=(self._scroll_width, self._scroll_height),
highlight=False, highlight=False,
position=((self._width - self._scroll_width) * 0.5, 40), position=(
(self._width - self._scroll_width) * 0.5,
(120 if uiscale is bui.UIScale.SMALL else 40) + yoffs,
),
) )
bui.containerwidget(edit=self._scrollwidget, claims_left_right=True) bui.containerwidget(edit=self._scrollwidget, claims_left_right=True)
@ -226,3 +239,22 @@ class TestingWindow(bui.MainWindow):
edit=entry['widget'], edit=entry['widget'],
text='%.4g' % bui.app.classic.value_test(entry['name']), text='%.4g' % bui.app.classic.value_test(entry['name']),
) )
@override
def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes.
cls = type(self)
# Pull values from self here; if we do it in the lambda we'll keep
# self alive which we don't want.
title = self.title
entries = self._entries_orig
return bui.BasicMainWindowState(
create_call=lambda transition, origin_widget: cls(
title=title,
entries=entries,
transition=transition,
origin_widget=origin_widget,
)
)

View File

@ -25,19 +25,21 @@ class SoundtrackBrowserWindow(bui.MainWindow):
origin_widget: bui.Widget | None = None, origin_widget: bui.Widget | None = None,
): ):
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
# pylint: disable=too-many-locals
self._r = 'editSoundtrackWindow' self._r = 'editSoundtrackWindow'
assert bui.app.classic is not None assert bui.app.classic is not None
uiscale = bui.app.ui_v1.uiscale uiscale = bui.app.ui_v1.uiscale
self._width = 800 if uiscale is bui.UIScale.SMALL else 600 self._width = 800 if uiscale is bui.UIScale.SMALL else 600
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
yoffs = -30 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
340 400
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 370 if uiscale is bui.UIScale.MEDIUM else 440 else 370 if uiscale is bui.UIScale.MEDIUM else 440
) )
spacing = 40.0 spacing = 40.0
v = self._height - 40.0 v = self._height - 40.0 + yoffs
v -= spacing * 1.0 v -= spacing * 1.0
super().__init__( super().__init__(
@ -54,7 +56,7 @@ class SoundtrackBrowserWindow(bui.MainWindow):
else 1.6 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.6 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -18) if uiscale is bui.UIScale.SMALL else (0, 0) (0, 0) if uiscale is bui.UIScale.SMALL else (0, 0)
), ),
), ),
transition=transition, transition=transition,
@ -67,7 +69,7 @@ class SoundtrackBrowserWindow(bui.MainWindow):
else: else:
self._back_button = bui.buttonwidget( self._back_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(45 + x_inset, self._height - 60), position=(45 + x_inset, self._height - 60 + yoffs),
size=(120, 60), size=(120, 60),
scale=0.8, scale=0.8,
label=bui.Lstr(resource='backText'), label=bui.Lstr(resource='backText'),
@ -82,7 +84,12 @@ class SoundtrackBrowserWindow(bui.MainWindow):
) )
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width * 0.5, self._height - 35), position=(
self._width * 0.5,
self._height
- (46 if uiscale is bui.UIScale.SMALL else 35)
+ yoffs,
),
size=(0, 0), size=(0, 0),
maxwidth=300, maxwidth=300,
text=bui.Lstr(resource=f'{self._r}.titleText'), text=bui.Lstr(resource=f'{self._r}.titleText'),
@ -92,7 +99,7 @@ class SoundtrackBrowserWindow(bui.MainWindow):
) )
h = 43 + x_inset h = 43 + x_inset
v = self._height - 60 v = self._height - 60 + yoffs
b_color = (0.6, 0.53, 0.63) b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8) b_textcolor = (0.75, 0.7, 0.8)
lock_tex = bui.gettexture('lock') lock_tex = bui.gettexture('lock')
@ -222,8 +229,10 @@ class SoundtrackBrowserWindow(bui.MainWindow):
) )
self._update() self._update()
v = self._height - 65 v = self._height - 65 + yoffs
scroll_height = self._height - 105 scroll_height = self._height - (
160 if uiscale is bui.UIScale.SMALL else 105
)
v -= scroll_height v -= scroll_height
self._scrollwidget = scrollwidget = bui.scrollwidget( self._scrollwidget = scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,

View File

@ -35,10 +35,12 @@ class SoundtrackEditWindow(bui.MainWindow):
self._width = 900 if uiscale is bui.UIScale.SMALL else 648 self._width = 900 if uiscale is bui.UIScale.SMALL else 648
x_inset = 100 if uiscale is bui.UIScale.SMALL else 0 x_inset = 100 if uiscale is bui.UIScale.SMALL else 0
self._height = ( self._height = (
395 450
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 450 if uiscale is bui.UIScale.MEDIUM else 560 else 450 if uiscale is bui.UIScale.MEDIUM else 560
) )
yoffs = -48 if uiscale is bui.UIScale.SMALL else 0
super().__init__( super().__init__(
root_widget=bui.containerwidget( root_widget=bui.containerwidget(
size=(self._width, self._height), size=(self._width, self._height),
@ -48,7 +50,7 @@ class SoundtrackEditWindow(bui.MainWindow):
else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0 else 1.5 if uiscale is bui.UIScale.MEDIUM else 1.0
), ),
stack_offset=( stack_offset=(
(0, -37) (0, 0)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0) else (0, 15) if uiscale is bui.UIScale.MEDIUM else (0, 0)
), ),
@ -58,7 +60,7 @@ class SoundtrackEditWindow(bui.MainWindow):
) )
cancel_button = bui.buttonwidget( cancel_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(38 + x_inset, self._height - 60), position=(38 + x_inset, self._height - 60 + yoffs),
size=(160, 60), size=(160, 60),
autoselect=True, autoselect=True,
label=bui.Lstr(resource='cancelText'), label=bui.Lstr(resource='cancelText'),
@ -66,7 +68,7 @@ class SoundtrackEditWindow(bui.MainWindow):
) )
save_button = bui.buttonwidget( save_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
position=(self._width - (168 + x_inset), self._height - 60), position=(self._width - (168 + x_inset), self._height - 60 + yoffs),
autoselect=True, autoselect=True,
size=(160, 60), size=(160, 60),
label=bui.Lstr(resource='saveText'), label=bui.Lstr(resource='saveText'),
@ -76,7 +78,7 @@ class SoundtrackEditWindow(bui.MainWindow):
bui.widget(edit=cancel_button, right_widget=save_button) bui.widget(edit=cancel_button, right_widget=save_button)
bui.textwidget( bui.textwidget(
parent=self._root_widget, parent=self._root_widget,
position=(0, self._height - 50), position=(0, self._height - 50 + yoffs),
size=(self._width, 25), size=(self._width, 25),
text=bui.Lstr( text=bui.Lstr(
resource=self._r resource=self._r
@ -91,7 +93,7 @@ class SoundtrackEditWindow(bui.MainWindow):
v_align='center', v_align='center',
maxwidth=280, maxwidth=280,
) )
v = self._height - 110 v = self._height - 110 + yoffs
if 'Soundtracks' not in appconfig: if 'Soundtracks' not in appconfig:
appconfig['Soundtracks'] = {} appconfig['Soundtracks'] = {}
@ -165,7 +167,9 @@ class SoundtrackEditWindow(bui.MainWindow):
on_return_press_call=self._do_it_with_sound, on_return_press_call=self._do_it_with_sound,
) )
scroll_height = self._height - 180 scroll_height = self._height - (
230 if uiscale is bui.UIScale.SMALL else 180
)
self._scrollwidget = scrollwidget = bui.scrollwidget( self._scrollwidget = scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
highlight=False, highlight=False,

View File

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

View File

@ -54,6 +54,7 @@ struct RootWidget::ButtonDef {
float h_align{}; float h_align{};
float x{}; float x{};
float y{}; float y{};
float y_offs_small{};
float width{100.0f}; float width{100.0f};
float height{30.0f}; float height{30.0f};
float scale{1.0f}; float scale{1.0f};
@ -74,12 +75,13 @@ struct RootWidget::Button {
Object::Ref<ButtonWidget> widget; Object::Ref<ButtonWidget> widget;
float h_align{}; float h_align{};
VAlign v_align{VAlign::kTop}; VAlign v_align{VAlign::kTop};
float x{}; // user provided x float x{}; // user provided x
float y{}; // user provided y float y{}; // user provided y
float x_target{}; // final target x (accounting for visibility, etc) float y_offs_small{}; // user provided y offset for small uiscale
float y_target{}; // final target y (accounting for visibility, etc) float x_target{}; // final target x (accounting for visibility, etc)
float x_smoothed{}; // current x (on way to target) float y_target{}; // final target y (accounting for visibility, etc)
float y_smoothed{}; // current y (on way to target) float x_smoothed{}; // current x (on way to target)
float y_smoothed{}; // current y (on way to target)
float width{100.0f}; float width{100.0f};
float height{30.0f}; float height{30.0f};
float scale{1.0f}; float scale{1.0f};
@ -178,10 +180,10 @@ auto RootWidget::AddCover_(float h_align, VAlign v_align, float x, float y,
// phone-size; for other sizes we always draw a backing. // phone-size; for other sizes we always draw a backing.
// //
// UPDATE: We no longer do backings, so ignore that. // UPDATE: We no longer do backings, so ignore that.
if (g_base->ui->scale() != UIScale::kSmall) { // if (g_base->ui->scale() != UIScale::kSmall) {
bd.visibility_mask |= // bd.visibility_mask |=
static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull); // static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull);
} // }
Button* b = AddButton_(bd); Button* b = AddButton_(bd);
return b; return b;
@ -189,7 +191,9 @@ auto RootWidget::AddCover_(float h_align, VAlign v_align, float x, float y,
void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g, void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g,
float b, bool plus, const std::string& s) { float b, bool plus, const std::string& s) {
float yoffs = (g_base->ui->scale() == UIScale::kSmall) ? 0.0f : -7.0f; // float yoffs = (g_base->ui->scale() == UIScale::kSmall) ? 0.0f : -7.0f;
float y_offs_small{7.0f};
float width = (type == MeterType::kTrophy) ? 80.0f : 110.0f; float width = (type == MeterType::kTrophy) ? 80.0f : 110.0f;
width = 110.0f; width = 110.0f;
@ -202,7 +206,8 @@ void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g,
bd.width = width; bd.width = width;
bd.height = 36.0f; bd.height = 36.0f;
// bd.x = x; // bd.x = x;
bd.y = -36.0f + 10.0f + yoffs; bd.y = -36.0f + 10.0f - y_offs_small;
bd.y_offs_small = y_offs_small;
bd.img = "uiAtlas2"; bd.img = "uiAtlas2";
bd.mesh_transparent = "currencyMeter"; bd.mesh_transparent = "currencyMeter";
bd.selectable = true; bd.selectable = true;
@ -466,17 +471,18 @@ void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g,
bd.v_align = VAlign::kTop; bd.v_align = VAlign::kTop;
bd.width = bd.height = 45.0f; bd.width = bd.height = 45.0f;
// bd.x = x - 68; // bd.x = x - 68;
bd.y = -36.0f + 11.0f + yoffs; bd.y = -36.0f + 11.0f - y_offs_small;
bd.y_offs_small = y_offs_small;
bd.img = "uiAtlas2"; bd.img = "uiAtlas2";
bd.mesh_transparent = "currencyPlusButton"; bd.mesh_transparent = "currencyPlusButton";
bd.color_r = 0.35f; bd.color_r = 0.35f;
bd.color_g = 0.35f; bd.color_g = 0.35f;
bd.color_b = 0.55f; bd.color_b = 0.55f;
if (g_base->ui->scale() != UIScale::kSmall) { // if (g_base->ui->scale() != UIScale::kSmall) {
// bd.color_r *= TOOLBAR_COLOR_R; // bd.color_r *= TOOLBAR_COLOR_R;
// bd.color_g *= TOOLBAR_COLOR_G; // bd.color_g *= TOOLBAR_COLOR_G;
// bd.color_b *= TOOLBAR_COLOR_B; // bd.color_b *= TOOLBAR_COLOR_B;
} // }
bd.depth_min = 0.3f; bd.depth_min = 0.3f;
switch (type) { switch (type) {
case MeterType::kTokens: case MeterType::kTokens:
@ -615,9 +621,9 @@ void RootWidget::Setup() {
bd.h_align = 0.5f; bd.h_align = 0.5f;
bd.v_align = VAlign::kTop; bd.v_align = VAlign::kTop;
bd.width = 850.0f; bd.width = 850.0f;
if (g_base->ui->scale() != UIScale::kSmall) { // if (g_base->ui->scale() != UIScale::kSmall) {
bd.width = 850.0f; // bd.width = 850.0f;
} // }
bd.height = 90.0f; bd.height = 90.0f;
bd.x = 0.0f; bd.x = 0.0f;
bd.y = -20.0f; bd.y = -20.0f;
@ -628,14 +634,14 @@ void RootWidget::Setup() {
bd.color_g = 0.41f; bd.color_g = 0.41f;
bd.color_b = 0.56f; bd.color_b = 0.56f;
bd.opacity = 1.0f; bd.opacity = 1.0f;
if (g_base->ui->scale() != UIScale::kSmall) { // if (g_base->ui->scale() != UIScale::kSmall) {
bd.color_r *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R; // bd.color_r *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R;
bd.color_g *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G; // bd.color_g *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G;
bd.color_b *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B; // bd.color_b *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B;
bd.opacity *= TOOLBAR_OPACITY; // bd.opacity *= TOOLBAR_OPACITY;
} else { // } else {
bd.opacity *= TOOLBAR_OPACITY_2; // bd.opacity *= TOOLBAR_OPACITY_2;
} // }
bd.depth_min = 0.2f; bd.depth_min = 0.2f;
// bd.call = ""; // bd.call = "";
bd.call = UIV1Python::ObjID::kEmptyCall; bd.call = UIV1Python::ObjID::kEmptyCall;
@ -649,7 +655,7 @@ void RootWidget::Setup() {
} }
// float xoffs = (g_base->ui->scale() == UIScale::kSmall) ? 90.0f : 0.0f; // float xoffs = (g_base->ui->scale() == UIScale::kSmall) ? 90.0f : 0.0f;
float yoffs = (g_base->ui->scale() == UIScale::kSmall) ? 0.0f : -10.0f; // float yoffs = (g_base->ui->scale() == UIScale::kSmall) ? 0.0f : -10.0f;
// Account Button // Account Button
{ {
@ -660,16 +666,18 @@ void RootWidget::Setup() {
bd.height = 60.0f; bd.height = 60.0f;
bd.depth_min = 0.3f; bd.depth_min = 0.3f;
// bd.x = 110.0f + xoffs; // bd.x = 110.0f + xoffs;
bd.y = -24.0f + yoffs; // bd.y = -24.0f + yoffs;
bd.y = -34.0f;
bd.y_offs_small = 10.0f;
bd.color_r = 0.56f; bd.color_r = 0.56f;
bd.color_g = 0.5f; bd.color_g = 0.5f;
bd.color_b = 0.73f; bd.color_b = 0.73f;
bd.call = UIV1Python::ObjID::kRootUIAccountButtonPressCall; bd.call = UIV1Python::ObjID::kRootUIAccountButtonPressCall;
if (g_base->ui->scale() != UIScale::kSmall) { // if (g_base->ui->scale() != UIScale::kSmall) {
// bd.color_r *= TOOLBAR_COLOR_R; // bd.color_r *= TOOLBAR_COLOR_R;
// bd.color_g *= TOOLBAR_COLOR_G; // bd.color_g *= TOOLBAR_COLOR_G;
// bd.color_b *= TOOLBAR_COLOR_B; // bd.color_b *= TOOLBAR_COLOR_B;
} // }
bd.pre_buffer = 10.0f; bd.pre_buffer = 10.0f;
bd.visibility_mask = bd.visibility_mask =
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull) (static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
@ -752,7 +760,7 @@ void RootWidget::Setup() {
top_right_buttons_.push_back(menu_button_); top_right_buttons_.push_back(menu_button_);
} }
// Party button. // Squad button.
{ {
ButtonDef b; ButtonDef b;
b.h_align = 1.0f; b.h_align = 1.0f;
@ -786,16 +794,16 @@ void RootWidget::Setup() {
// Bot-left cover // Bot-left cover
// AddCover(0.0f, VAlign::kBottom, 0.0f, -210.0f, 600.0f, 600.0f, 0.25f); // AddCover(0.0f, VAlign::kBottom, 0.0f, -210.0f, 600.0f, 600.0f, 0.25f);
float bx = 55.0f; // float bx = 55.0f;
// Inbox button. // Inbox button.
{ {
ButtonDef b; ButtonDef b;
b.h_align = 0.0f; b.h_align = 0.0f;
b.v_align = VAlign::kBottom; b.v_align = VAlign::kBottom;
b.width = b.height = 55.0f; b.width = b.height = 60.0f;
// b.x = bx; // b.x = bx;
b.y = b.height * 0.5f + 5; b.y = b.height * 0.5f + 2.0f;
b.color_r = BOT_LEFT_COLOR_R; b.color_r = BOT_LEFT_COLOR_R;
b.color_g = BOT_LEFT_COLOR_G; b.color_g = BOT_LEFT_COLOR_G;
b.color_b = BOT_LEFT_COLOR_B; b.color_b = BOT_LEFT_COLOR_B;
@ -805,22 +813,22 @@ void RootWidget::Setup() {
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull) (static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack) | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot)); | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
b.pre_buffer = 20.0f; b.pre_buffer = 25.0f;
b.allow_in_game = false; b.allow_in_game = false;
inbox_button_ = AddButton_(b); inbox_button_ = AddButton_(b);
bottom_left_buttons_.push_back(inbox_button_); bottom_left_buttons_.push_back(inbox_button_);
} }
bx += 80.0f; // bx += 80.0f;
// Achievements button. // Achievements button.
if (explicit_bool(true)) { if (explicit_bool(true)) {
ButtonDef b; ButtonDef b;
b.h_align = 0.0f; b.h_align = 0.0f;
b.v_align = VAlign::kBottom; b.v_align = VAlign::kBottom;
b.width = b.height = 55.0f; b.width = b.height = 60.0f;
// b.x = bx; // b.x = bx;
b.y = b.height * 0.5f + 5; b.y = b.height * 0.5f + 2.0f;
b.color_r = BOT_LEFT_COLOR_R; b.color_r = BOT_LEFT_COLOR_R;
b.color_g = BOT_LEFT_COLOR_G; b.color_g = BOT_LEFT_COLOR_G;
b.color_b = BOT_LEFT_COLOR_B; b.color_b = BOT_LEFT_COLOR_B;
@ -830,11 +838,11 @@ void RootWidget::Setup() {
(static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull) (static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFull)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack) | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot)); | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
b.pre_buffer = 20.0f; b.pre_buffer = 25.0f;
b.allow_in_game = false; b.allow_in_game = false;
achievements_button_ = AddButton_(b); achievements_button_ = AddButton_(b);
bottom_left_buttons_.push_back(achievements_button_); bottom_left_buttons_.push_back(achievements_button_);
bx += 80.0f; // bx += 80.0f;
// Achievement count. // Achievement count.
// { // {
@ -928,9 +936,9 @@ void RootWidget::Setup() {
ButtonDef b; ButtonDef b;
b.h_align = 0.0f; b.h_align = 0.0f;
b.v_align = VAlign::kBottom; b.v_align = VAlign::kBottom;
b.width = b.height = 50.0f; b.width = b.height = 60.0f;
// b.x = bx; // b.x = bx;
b.y = b.height * 0.5f + 5; b.y = b.height * 0.5f + 2.0f;
b.color_r = BOT_LEFT_COLOR_R; b.color_r = BOT_LEFT_COLOR_R;
b.color_g = BOT_LEFT_COLOR_G; b.color_g = BOT_LEFT_COLOR_G;
b.color_b = BOT_LEFT_COLOR_B; b.color_b = BOT_LEFT_COLOR_B;
@ -940,7 +948,7 @@ void RootWidget::Setup() {
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack) | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot)); | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot));
AddButton_(b); AddButton_(b);
bx += 70.0f; // bx += 70.0f;
} }
// Settings button. // Settings button.
@ -948,9 +956,9 @@ void RootWidget::Setup() {
ButtonDef b; ButtonDef b;
b.h_align = 0.0f; b.h_align = 0.0f;
b.v_align = VAlign::kBottom; b.v_align = VAlign::kBottom;
b.width = b.height = 55.0f; b.width = b.height = 60.0f;
// b.x = bx; // b.x = bx;
b.y = b.height * 0.58f; b.y = b.height * 0.58f - 2.0f;
b.color_r = BOT_LEFT_COLOR_R; b.color_r = BOT_LEFT_COLOR_R;
b.color_g = BOT_LEFT_COLOR_G; b.color_g = BOT_LEFT_COLOR_G;
b.color_b = BOT_LEFT_COLOR_B; b.color_b = BOT_LEFT_COLOR_B;
@ -961,7 +969,7 @@ void RootWidget::Setup() {
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack) | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullNoBack)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot) | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuFullRoot)
| static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuInGame)); | static_cast<uint32_t>(Widget::ToolbarVisibility::kMenuInGame));
b.pre_buffer = 20.0f; b.pre_buffer = 25.0f;
settings_button_ = AddButton_(b); settings_button_ = AddButton_(b);
bottom_left_buttons_.push_back(settings_button_); bottom_left_buttons_.push_back(settings_button_);
} }
@ -981,23 +989,23 @@ void RootWidget::Setup() {
float backing_cover_g = backing_g; float backing_cover_g = backing_g;
float backing_cover_b = backing_b; float backing_cover_b = backing_b;
float backingA = 1.0f; float backingA = 1.0f;
if (g_base->ui->scale() != UIScale::kSmall) { // if (g_base->ui->scale() != UIScale::kSmall) {
backing_r *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R; // backing_r *= TOOLBAR_COLOR_R * TOOLBAR_BACK_COLOR_R;
backing_g *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G; // backing_g *= TOOLBAR_COLOR_G * TOOLBAR_BACK_COLOR_G;
backing_b *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B; // backing_b *= TOOLBAR_COLOR_B * TOOLBAR_BACK_COLOR_B;
backing_cover_r *= TOOLBAR_COLOR_R; // backing_cover_r *= TOOLBAR_COLOR_R;
backing_cover_g *= TOOLBAR_COLOR_G; // backing_cover_g *= TOOLBAR_COLOR_G;
backing_cover_b *= TOOLBAR_COLOR_B; // backing_cover_b *= TOOLBAR_COLOR_B;
backingA *= TOOLBAR_OPACITY; // backingA *= TOOLBAR_OPACITY;
} else { // } else {
backing_r *= 1.1f; backing_r *= 1.1f;
backing_g *= 1.1f; backing_g *= 1.1f;
backing_b *= 1.1f; backing_b *= 1.1f;
backing_cover_r *= 1.1f; backing_cover_r *= 1.1f;
backing_cover_g *= 1.1f; backing_cover_g *= 1.1f;
backing_cover_b *= 1.1f; backing_cover_b *= 1.1f;
backingA *= TOOLBAR_OPACITY_2; backingA *= TOOLBAR_OPACITY_2;
} // }
// Bar backing. // Bar backing.
{ {
@ -1161,6 +1169,7 @@ auto RootWidget::AddButton_(const ButtonDef& def) -> RootWidget::Button* {
Button& b(buttons_.back()); Button& b(buttons_.back());
b.x = b.x_smoothed = b.x_target = def.x; b.x = b.x_smoothed = b.x_target = def.x;
b.y = b.y_smoothed = b.y_target = def.y; b.y = b.y_smoothed = b.y_target = def.y;
b.y_offs_small = def.y_offs_small;
b.visibility_mask = def.visibility_mask; b.visibility_mask = def.visibility_mask;
b.disable_offset_scale = def.disable_offset_scale; b.disable_offset_scale = def.disable_offset_scale;
b.pre_buffer = def.pre_buffer; b.pre_buffer = def.pre_buffer;
@ -1293,6 +1302,8 @@ void RootWidget::StepPositions_(float dt) {
return; return;
} }
bool is_small{g_base->ui->scale() == UIScale::kSmall};
// Update enabled-state for all buttons. // Update enabled-state for all buttons.
for (Button& b : buttons_) { for (Button& b : buttons_) {
bool enable_button = bool enable_button =
@ -1319,11 +1330,9 @@ void RootWidget::StepPositions_(float dt) {
// enable_button = false; // enable_button = false;
// } // }
} }
if (&b == back_button_) { // Back button is always disabled in medium/large UI.
// Back button is always disabled in medium/large UI. if (&b == back_button_ && !is_small) {
if (g_base->ui->scale() != UIScale::kSmall) { enable_button = false;
enable_button = false;
}
} }
b.enabled = enable_button; b.enabled = enable_button;
} }
@ -1385,7 +1394,7 @@ void RootWidget::StepPositions_(float dt) {
for (Button& b : buttons_) { for (Button& b : buttons_) {
// Update our target position. // Update our target position.
b.x_target = b.x; b.x_target = b.x;
b.y_target = b.y; b.y_target = b.y + (is_small ? b.y_offs_small : 0.0f);
float disable_offset = b.disable_offset_scale * 110.0f float disable_offset = b.disable_offset_scale * 110.0f
* ((b.v_align == VAlign::kTop) ? 1.0f : -1.0f); * ((b.v_align == VAlign::kTop) ? 1.0f : -1.0f);
// float top_right_offset = 100.0f; // float top_right_offset = 100.0f;