mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 08:03:30 +08:00
converted achievements and inbox to MainWindows and other ui polishing
This commit is contained in:
parent
4dc322f956
commit
3f419c3233
56
.efrocachemap
generated
56
.efrocachemap
generated
@ -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": "4c5719f4c7ab007be49e25f7d1c2ebc3",
|
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "009e9834589fdca68dad7af91b56a9ae",
|
||||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "f94530fb06665cc65da84a0998a8c34f",
|
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "5f307993914ffd163b31824495103533",
|
||||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "4565fe7bf5497a1e6f26791d370cbf36",
|
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "eb06b4b7905a67fb2b7e65d543872b8d",
|
||||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "861bb4628d6e98833f34cd7fe188ccb4",
|
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "4fce2d86cf75558f089f8bc67476cd8e",
|
||||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "ef45f0ea1f16016366069670869a105b",
|
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "954288b391c83f0c124d0ab9b2f3ef5b",
|
||||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "ecb70cb07e1f2a971faa6932278e623e",
|
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1883286f80c4f53723f3d0338a3c3c31",
|
||||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "80cad1c9c9d7e95bba8fca46a7ad71cb",
|
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "ad63b8d21e6ae4fd0274875c4e66f6bf",
|
||||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "a62d9dcfec465b4e8e9e7b516ce20d6c",
|
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "f5c69292fa9b046ac86b9c938b139dbe",
|
||||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "53ea2045ee7324176fc41f2c92e34c83",
|
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "9e53108985b005b5c5403d992a8eb5bd",
|
||||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "a48f988081b53a8cef28978e2779ad53",
|
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "f5e9323ce05bdde512c4a853e0a46d71",
|
||||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "ca6f9f14f49e9578c79d4e192bae2a23",
|
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "1a572a5722992601bfc510499083d980",
|
||||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b3189be75ff31435fbd0deebf4d05d86",
|
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b26537fa8323d1fb159f4f07c035d0d3",
|
||||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "37457582e66d96fd63583e64d3392521",
|
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "a70a22456f7d6d3cc2826f27627f302d",
|
||||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "1505da6f4c3b5a5b5987c485271f567f",
|
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "868d55c194a4834d8a373c8d9300f4a1",
|
||||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "540e2954f30c48148e1c4824f484ba42",
|
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "1a35b2a949f8d900a1fb640592a6d5f9",
|
||||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "bd41f4930a3c1b0dfe1eb992bd1bd2c4",
|
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "f2465aed23f9dc56fe1ba17a8e528563",
|
||||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "d226791f74aa398fd07909ba69eb2a19",
|
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "d32b49718718560b44ef3b4e99a1dd96",
|
||||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "59f65a8cbcdf13fcb30aec30d053fa85",
|
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "6ff6d0b91e51c4d3a8bb134be2bff23b",
|
||||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "cefcdb5c49a4a3f848119a9159d832f7",
|
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "64c03fe1e1bc86b49079bf5dec74d484",
|
||||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "ea787281130d9e3565dd49b7776fb3f0",
|
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "b905501fa611121ae9e34db5fb841921",
|
||||||
"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": "d52d476f324fd3c0c1f99add058aa405",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "e900c88682cb4e25a3f36e798aa167db",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "059bd84629b72597c692b3a6b6cf6aa9",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "d74de72b01b831df93e14a77f8351a75",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "8428089ffce127d5eedf8d9cbafa2ffa",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "44a8676feda50e8b831f707041b6053e",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "0d267d44801387189b44896d4b6027b3",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "c7b6d06e55a914e94cf7ab84dd7ed617",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "114f954bc27541998dce635b25e3ec01",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "cd7aab8432d4ba5eefd1d36261bc1928",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "eb84b5585f44e853604fa059ac57f388",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "1058ad3d671eb62dc52a971cf231f5e3",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "579d3f0ad1d0f79522408d6197413a88",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "96908e3c333c66c2010136c11ac4fde6",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "85b61a46caa9ada867f0c643ff28b6cd",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "d962d4f91a10bfae22e96c9e74466c4a",
|
||||||
"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",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
### 1.7.37 (build 22011, api 9, 2024-09-24)
|
### 1.7.37 (build 22012, api 9, 2024-09-24)
|
||||||
- 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.
|
||||||
|
|||||||
@ -264,17 +264,23 @@ class ClassicAppMode(AppMode):
|
|||||||
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
|
||||||
@ -339,26 +345,16 @@ class ClassicAppMode(AppMode):
|
|||||||
origin_widget=bauiv1.get_special_widget('inventory_button')
|
origin_widget=bauiv1.get_special_widget('inventory_button')
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
# 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, InventoryWindow):
|
|
||||||
# current_main_window.main_window_back()
|
|
||||||
# return
|
|
||||||
|
|
||||||
# self._jump_to_auxiliary_window(
|
|
||||||
# InventoryWindow(
|
|
||||||
# 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:
|
||||||
|
|||||||
@ -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 = 22011
|
TARGET_BALLISTICA_BUILD = 22012
|
||||||
TARGET_BALLISTICA_VERSION = '1.7.37'
|
TARGET_BALLISTICA_VERSION = '1.7.37'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -6,55 +6,69 @@ 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
|
300
|
||||||
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)
|
|
||||||
|
|
||||||
# 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, -10)
|
||||||
|
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),
|
||||||
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 +81,11 @@ 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),
|
||||||
|
),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -79,16 +96,21 @@ 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=(self._width - 60, self._height - 70),
|
||||||
position=(30, 30),
|
position=(30, 30),
|
||||||
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 +246,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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -6,58 +6,107 @@ 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,
|
||||||
|
# position: tuple[float, float],
|
||||||
|
# scale: float | 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:
|
# if scale is None:
|
||||||
scale = (
|
# scale = (
|
||||||
2.3
|
# 2.3
|
||||||
if uiscale is bui.UIScale.SMALL
|
# if uiscale is bui.UIScale.SMALL
|
||||||
else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
|
# else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
|
||||||
)
|
# )
|
||||||
self._transitioning_out = False
|
# self._transitioning_out = False
|
||||||
self._width = 450
|
self._width = 600 if uiscale is bui.UIScale.SMALL else 450
|
||||||
self._height = (
|
self._height = (
|
||||||
300
|
300
|
||||||
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)
|
# bg_color = (0.5, 0.4, 0.6)
|
||||||
|
|
||||||
# creates our _root_widget
|
# creates our _root_widget
|
||||||
|
# super().__init__(
|
||||||
|
# position=position,
|
||||||
|
# size=(self._width, self._height),
|
||||||
|
# scale=scale,
|
||||||
|
# bg_color=bg_color,
|
||||||
|
# edge_buffer_scale=4.0, # Try to keep button unobscured.
|
||||||
|
# )
|
||||||
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, -10)
|
||||||
|
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),
|
||||||
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._cancel_button = bui.buttonwidget(
|
||||||
|
# parent=self.root_widget,
|
||||||
|
# position=(50, self._height - 30),
|
||||||
|
# size=(50, 50),
|
||||||
|
# scale=0.5,
|
||||||
|
# label='',
|
||||||
|
# color=bg_color,
|
||||||
|
# on_activate_call=self._on_cancel_press,
|
||||||
|
# autoselect=True,
|
||||||
|
# icon=bui.gettexture('crossOut'),
|
||||||
|
# iconscale=1.2,
|
||||||
|
# )
|
||||||
|
|
||||||
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),
|
||||||
|
),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
@ -68,16 +117,21 @@ 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=(self._width - 60, self._height - 70),
|
||||||
position=(30, 30),
|
position=(30, 30),
|
||||||
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 +159,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()
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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 = 22011;
|
const int kEngineBuildNumber = 22012;
|
||||||
const char* kEngineVersion = "1.7.37";
|
const char* kEngineVersion = "1.7.37";
|
||||||
const int kEngineApiVersion = 9;
|
const int kEngineApiVersion = 9;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user