mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 21:37:57 +08:00
updated get-tokens window to be screen-size-responsive
This commit is contained in:
parent
c8e345b006
commit
6a2eedced7
48
.efrocachemap
generated
48
.efrocachemap
generated
@ -4171,22 +4171,22 @@
|
||||
"build/assets/windows/Win32/pythonw.exe": "60f972a154dd6af1b4a67a23bcd89a92",
|
||||
"build/assets/windows/Win32/pythonw_d.exe": "440ba78327698a2706fe7a0eb358dfe8",
|
||||
"build/assets/windows/Win32/vc_redist.x86.exe": "91f13ae4b9f4dee9430a9d9b0c8b2afa",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "e55be6b7dbdb47cecdf7d7ad975afb4c",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "516cee4dad091526cd8958cebd56e01d",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "4ad513ab58dbeb47f5a1f5d7be9c7653",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "5f5fa3b4b95c0ee18318b3460afa0da8",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "c7bb759e546d2d074f9c7eecc92ad682",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "9f65c6d211c7ad6ca28f6f3544233a09",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "933d66de7813a923d34ee1ad8e0ca83f",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "8ecef6678c1a9c37741e821f234d1e86",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "315a7f0a6fa55950b3d819530f69f281",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "9a5b2e4469381395f300a762ebddc76a",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "3fa80b810f329766ed598135a6b67ede",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "272761b36230978bfad9c7c6c8068f4e",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "44e4f2948a413c94d78a110d76e93fc8",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "5da210877ab03acf76b30e2bad60c964",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "e73664d139fc60b6e58d1dc99d316ae8",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "79546734a9d1a4617236de583e097fbd",
|
||||
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "2c6cb9b1a60721c6e3bc49d51324b264",
|
||||
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "3f40c4809c3eed59cf398f75552f93f2",
|
||||
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "e3dbbf5683e49a5829c5ed97589a441c",
|
||||
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "512c51c4e2d87d18cfbef728c513b599",
|
||||
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "9e3431cd1f17a29cee173035b924c91a",
|
||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "79487768b9e12f4399e389204c816035",
|
||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "7a9b37a71f7e6e16ff86ca0ccfb70006",
|
||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "15aca3bfda739d6b59e439bb8b5abd49",
|
||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "f591aa149a7641efaf13f31ca5c13a3f",
|
||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "5ee15c691e032e9b9515436b1a8a3381",
|
||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "08d9cc8785012a56d6998f5e1bedb395",
|
||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "6eae82a42b6380321af37b6ad56dbd58",
|
||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "8a4e8dedfd25672c8edd8d1b3fa95983",
|
||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "e473df2b31df114791c5354d036874fb",
|
||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "cd9c8f057578e77633cd1bb005101ed6",
|
||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "f8ae613ced94412159b569c41a0b04c2",
|
||||
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "5c7b118a1780cbf24c8b4bf6fd30ddb0",
|
||||
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "69a28ff5f0d1fb79a012449c90e3c0d0",
|
||||
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "5c7b118a1780cbf24c8b4bf6fd30ddb0",
|
||||
@ -4199,14 +4199,14 @@
|
||||
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "593606fabbdd503bab555d49b7963ad1",
|
||||
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "07143cfbe795a2cbaa47a09daf1261b3",
|
||||
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "593606fabbdd503bab555d49b7963ad1",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "8f49dc4a477954ac1592eff78604bb76",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "c08c749c55fca2b7cf90f0bce4370770",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "8c04cc059fb54eb24e485c0d1e9bed78",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "6b37775267cd1c1a84f838fb4881ad44",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "def65f8742ace0c5e516b3b300f6b25c",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "66a046bce7679b4e58f13d7aed895156",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "fc82fe80fec6e3587acd492ca31d53eb",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "9683cbdebc677ed37f3e434082b547f5",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "acac11988d2398cf81dfff6f71b996b8",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "6064f56716c207ccfb92e1f1373ae27f",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "e5aae9b24f08f986addfbf3abab00753",
|
||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "d739db63385da53768343959c6c358aa",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "c30bd265c24d338a76a834b3eaf5dcda",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "739279114a1e77ca06990939bf6ad09e",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "ece94e57b0ddd1722c543ede09ed3973",
|
||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "1109fef5c7a8f3c30847a002f5447f51",
|
||||
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
|
||||
"src/assets/ba_data/python/babase/_mgen/enums.py": "794d258d59fd17a61752843a9a0551ad",
|
||||
"src/ballistica/base/mgen/pyembed/binding_base.inc": "06042d31df0ff9af96b99477162e2a91",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
### 1.7.37 (build 22260, api 9, 2025-01-28)
|
||||
### 1.7.37 (build 22261, api 9, 2025-01-31)
|
||||
- Bumping api version to 9. As you'll see below, there's some UI changes that
|
||||
will require a bit of work for any UI mods to adapt to. If your mods don't
|
||||
touch UI stuff at all you can simply bump your api version and call it a day.
|
||||
|
||||
@ -53,7 +53,7 @@ if TYPE_CHECKING:
|
||||
|
||||
# Build number and version of the ballistica binary we expect to be
|
||||
# using.
|
||||
TARGET_BALLISTICA_BUILD = 22260
|
||||
TARGET_BALLISTICA_BUILD = 22261
|
||||
TARGET_BALLISTICA_VERSION = '1.7.37'
|
||||
|
||||
|
||||
|
||||
@ -70,6 +70,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
transition: str | None = 'in_right',
|
||||
origin_widget: bui.Widget | None = None,
|
||||
):
|
||||
# pylint: disable=too-many-locals
|
||||
bwidthstd = 170
|
||||
bwidthwide = 300
|
||||
ycolor = (0, 0, 0.3)
|
||||
@ -310,25 +311,36 @@ class GetTokensWindow(bui.MainWindow):
|
||||
)
|
||||
|
||||
uiscale = bui.app.ui_v1.uiscale
|
||||
self._width = 1000.0 if uiscale is bui.UIScale.SMALL else 1070.0
|
||||
self._x_inset = 25.0 if uiscale is bui.UIScale.SMALL else 0.0
|
||||
self._height = 550 if uiscale is bui.UIScale.SMALL else 520.0
|
||||
self._y_offset = -60 if uiscale is bui.UIScale.SMALL else -30
|
||||
self._width = 1200.0 if uiscale is bui.UIScale.SMALL else 1070.0
|
||||
self._height = 800 if uiscale is bui.UIScale.SMALL else 520.0
|
||||
|
||||
self._r = 'getTokensWindow'
|
||||
|
||||
# Do some fancy math to fill all available screen area up to the
|
||||
# size of our backing container. This lets us fit to the exact
|
||||
# screen shape at small ui scale.
|
||||
screensize = bui.get_virtual_screen_size()
|
||||
scale = (
|
||||
1.5
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 1.1 if uiscale is bui.UIScale.MEDIUM else 0.95
|
||||
)
|
||||
# Calc screen size in our local container space and clamp to a
|
||||
# bit smaller than our container size.
|
||||
target_width = min(self._width - 60, screensize[0] / scale)
|
||||
target_height = min(self._height - 70, screensize[1] / scale)
|
||||
|
||||
# To get top/left coords, go to the center of our window and
|
||||
# offset by half the width/height of our target area.
|
||||
self._yoffs = 0.5 * self._height + 0.5 * target_height + 20.0
|
||||
|
||||
self._scroll_width = target_width
|
||||
|
||||
super().__init__(
|
||||
root_widget=bui.containerwidget(
|
||||
size=(self._width, self._height),
|
||||
color=(0.3, 0.23, 0.36),
|
||||
scale=(
|
||||
1.5
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
else 1.1 if uiscale is bui.UIScale.MEDIUM else 0.95
|
||||
),
|
||||
stack_offset=(
|
||||
(0, -3) if uiscale is bui.UIScale.SMALL else (0, 0)
|
||||
),
|
||||
scale=scale,
|
||||
toolbar_visibility=(
|
||||
'get_tokens'
|
||||
if uiscale is bui.UIScale.SMALL
|
||||
@ -337,6 +349,8 @@ class GetTokensWindow(bui.MainWindow):
|
||||
),
|
||||
transition=transition,
|
||||
origin_widget=origin_widget,
|
||||
# We're affected by screen size only at small ui-scale.
|
||||
refresh_on_screen_size_changes=uiscale is bui.UIScale.SMALL,
|
||||
)
|
||||
|
||||
if uiscale is bui.UIScale.SMALL:
|
||||
@ -347,10 +361,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
else:
|
||||
self._back_button = bui.buttonwidget(
|
||||
parent=self._root_widget,
|
||||
position=(
|
||||
55 + self._x_inset,
|
||||
self._height - 80 + self._y_offset,
|
||||
),
|
||||
position=(60, self._yoffs - 90),
|
||||
size=((60, 60)),
|
||||
scale=1.0,
|
||||
autoselect=True,
|
||||
@ -364,7 +375,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
|
||||
self._title_text = bui.textwidget(
|
||||
parent=self._root_widget,
|
||||
position=(self._width * 0.5, self._height - 42 + self._y_offset),
|
||||
position=(self._width * 0.5, self._yoffs - 42),
|
||||
size=(0, 0),
|
||||
color=self._textcolor,
|
||||
flatness=0.0,
|
||||
@ -520,35 +531,39 @@ class GetTokensWindow(bui.MainWindow):
|
||||
|
||||
bui.textwidget(edit=self._status_text, text='')
|
||||
|
||||
xinset = 40
|
||||
|
||||
scrollwidth = self._width - 2 * (self._x_inset + xinset)
|
||||
scrollheight = 280
|
||||
buttonpadding = -5
|
||||
|
||||
yoffs = 5
|
||||
|
||||
available_purchases = {
|
||||
p.purchaseid for p in response.available_purchases
|
||||
}
|
||||
buttondefs_shown = [
|
||||
b for b in self._buttondefs if b.itemid in available_purchases
|
||||
]
|
||||
|
||||
# We currently don't handle the zero-button case.
|
||||
assert self._buttondefs
|
||||
assert buttondefs_shown
|
||||
|
||||
sidepad = 10.0
|
||||
xfudge = 6.0
|
||||
total_button_width = (
|
||||
sum(b.width + b.prepad for b in self._buttondefs)
|
||||
+ buttonpadding * (len(self._buttondefs) - 1)
|
||||
sum(b.width + b.prepad for b in buttondefs_shown)
|
||||
+ buttonpadding * (len(buttondefs_shown) - 1)
|
||||
+ 2 * sidepad
|
||||
)
|
||||
|
||||
h_scroll = bui.hscrollwidget(
|
||||
parent=self._root_widget,
|
||||
size=(scrollwidth, scrollheight),
|
||||
size=(self._scroll_width, scrollheight),
|
||||
position=(
|
||||
self._x_inset + xinset,
|
||||
self._height - 415 + self._y_offset,
|
||||
self._width * 0.5 - 0.5 * self._scroll_width,
|
||||
self._height * 0.5 - 0.5 * scrollheight - 40,
|
||||
),
|
||||
claims_left_right=True,
|
||||
highlight=False,
|
||||
border_opacity=0.4,
|
||||
border_opacity=0.15,
|
||||
center_small_content=True,
|
||||
)
|
||||
subcontainer = bui.containerwidget(
|
||||
@ -563,7 +578,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
text_scale=0.7,
|
||||
position=(
|
||||
self._width * 0.5 - 75,
|
||||
self._height - 100 + self._y_offset,
|
||||
self._yoffs - 100,
|
||||
),
|
||||
size=(180, 40),
|
||||
scale=0.8,
|
||||
@ -587,12 +602,12 @@ class GetTokensWindow(bui.MainWindow):
|
||||
|
||||
x = sidepad + xfudge
|
||||
bwidgets: list[bui.Widget] = []
|
||||
for i, buttondef in enumerate(self._buttondefs):
|
||||
for i, buttondef in enumerate(buttondefs_shown):
|
||||
|
||||
price = None if plus is None else plus.get_price(buttondef.itemid)
|
||||
|
||||
x += buttondef.prepad
|
||||
tdelay = 0.3 - i / len(self._buttondefs) * 0.25
|
||||
tdelay = 0.3 - i / len(buttondefs_shown) * 0.25
|
||||
btn = bui.buttonwidget(
|
||||
autoselect=True,
|
||||
label='',
|
||||
@ -666,7 +681,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
parent=self._root_widget,
|
||||
position=(
|
||||
self._width * 0.5,
|
||||
self._height - 70 + self._y_offset,
|
||||
self._yoffs - 70,
|
||||
),
|
||||
color=self._textcolor,
|
||||
shadow=1.0,
|
||||
@ -687,7 +702,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
parent=self._root_widget,
|
||||
position=(
|
||||
self._width * 0.5,
|
||||
self._height - 120 + self._y_offset,
|
||||
self._yoffs - 120,
|
||||
),
|
||||
color=(0.4, 1.0, 0.4),
|
||||
shadow=1.0,
|
||||
@ -695,7 +710,7 @@ class GetTokensWindow(bui.MainWindow):
|
||||
size=(0, 0),
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
maxwidth=scrollwidth * 0.9,
|
||||
maxwidth=self._scroll_width * 0.9,
|
||||
text=bui.Lstr(resource='removeInGameAdsTokenPurchaseText'),
|
||||
)
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
|
||||
namespace ballistica {
|
||||
|
||||
// These are set automatically via script; don't modify them here.
|
||||
const int kEngineBuildNumber = 22260;
|
||||
const int kEngineBuildNumber = 22261;
|
||||
const char* kEngineVersion = "1.7.37";
|
||||
const int kEngineApiVersion = 9;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user