updated sendinfo for v2 master-server

This commit is contained in:
Eric 2024-01-17 09:06:23 -08:00
parent ba60c69a95
commit e2128b7ee4
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
6 changed files with 118 additions and 60 deletions

88
.efrocachemap generated
View File

@ -4060,50 +4060,50 @@
"build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "17021648748aac4145a79a9ad2874806",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "3b9736b07e5a81e09d32d29b9f054b7c",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "24629b411382ddfdc80e6b634af8f3f6",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "6bd8e6f4545bf224c6141326fc68c80b",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "e70899ffcd793fcae1342d41670d18ba",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "9be993909a0dd46ac9b50d88f59de5f6",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "028ab436f8631ec3e82b07f51ab845f0",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "54603d34c3cccdd331c3288caf7c3b8d",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "b0768168b9573ff8b671395ceca879da",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "1f5d24c9b683da8b6157df85355710ea",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "497748396d5d71a475d95bfa6130bf1f",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "39cc184e4dd9117d9d6ff6d5767ca05b",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "e3d0c4e375306a0a4e62059d096c7d95",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "ded06d43470afd7f2638ccc797de0912",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "50193a899f076eef856ad256c58419c7",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "1ec4be2102a46ac1a4412d8797288d56",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "04d51a7df2a3976afacf49d56159544f",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "d408589fd7d143f06ade596bf3c6c7c8",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "ddbbfc7325cc0bf3e8439df2072ccc22",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "86623c711eee712df279e49302acb10e",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "7637fa3020d4da5ee313cb8c22e0399b",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "c2c95b1ca36504784c20abdb42fae8db",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "7637fa3020d4da5ee313cb8c22e0399b",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "c2c95b1ca36504784c20abdb42fae8db",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "68a8a98018e4c460744ff9bc2fb0b73c",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "ef801cfa392f59c790200380227b072c",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "68a8a98018e4c460744ff9bc2fb0b73c",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "ef801cfa392f59c790200380227b072c",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "c6d59b3595cea948fda12f9346d5e753",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "2a0b3096b5036abc7c5bcd33bf37ce9f",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "c6d59b3595cea948fda12f9346d5e753",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "2a0b3096b5036abc7c5bcd33bf37ce9f",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "223989b257f0f4896d5b735cef7d35f6",
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "97db7ec9f3232827279df483227293e5",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "61a149df0a13696ebdcd7e95a6106604",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "97db7ec9f3232827279df483227293e5",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "9a2ee7823e832e274ed891779b723a9e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "a23bf4fd8abd100afae92ceaacddb222",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "070f7105134f16fdf507d243c5b149b3",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "e87d4ad432185815cfe9b5e0e3d14192",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "0fb5ebecdf7d3f43948967a7141a576f",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "3a7717589e3c989d744f9a1414c4ad73",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "89717c9d08ac5ed3d7572184278ef60e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "7562cde17f374b229668f8ddd0cd982e",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "c10468f9057fb8cd2e709c6e80def6e9",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "5516b57aae8220a2fd70eba1c16f8870",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "d9ce7ddd24986629636900f96f4222bb",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "e8e0be656ae7be7d6e1d17e748698dc9",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "a92a7cfb211f5b3a2fe0f4d654e08e36",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "3caf8d545a035d61a1243003ca393747",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "3ad3619c09d56d2ef16674ed491be57c",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "edadf7dd4af5e0ceae006b940ea5dbc9",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "d3b5181d79b39f065e5606bb4aecaabc",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "8bfcdf2824cffd9fd3c687d8124577bd",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "04ebddddcb75119559140d7fa90ebd0d",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "3adc502be34f331121181bde43068c56",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "b8c93d439493340f0b073e1feb82c19e",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "32932c39b3411787d4774774c8c89065",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "624bbcfa0cd5722118cdd95951331b52",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "13434d81c0b527b4650f7f6ff0f2504f",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "6821b110792a519a4dd0df261b98a27c",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "0e4e320e63c13e2fc9dfdd6875cd15e9",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "0f4de05d8c4679612ac176e75e739f52",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "eca2fc0326e16691eb32e153a23d6b00",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "5fe258b43fa5226cc36c7d5ec01ae634",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "58c567a5574207cc12d9a79baa8a1dd6",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "5fe258b43fa5226cc36c7d5ec01ae634",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "58c567a5574207cc12d9a79baa8a1dd6",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "61dc6683f4cfae0d47374e2f9cf20714",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "96cb1662024c0b5c25a8f7d12514c5a7",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "61dc6683f4cfae0d47374e2f9cf20714",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "96cb1662024c0b5c25a8f7d12514c5a7",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "f4126afb38befff916e6b14c583a8fed",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "23479d054cfdb20a19e9dd73a980b05e",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "f4126afb38befff916e6b14c583a8fed",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "23479d054cfdb20a19e9dd73a980b05e",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "661a5a67cef33ff7cf3bd3a2dbaef3a4",
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "86368a7a20ba8c687f59a6f248e2dbfc",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "776f5085781a71f7522717cce5332b8e",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "86368a7a20ba8c687f59a6f248e2dbfc",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "15bfb7b83525e22b559d70482723515d",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "706088e9adc5392e83e0500720c48a4d",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "c97d4236e6ad7abd5469ae609b092cf2",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "0b9ae67ea21931d8279fae89fbc15e61",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "3f684648bb831c598850b74fda6485d1",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "188a678495c6f32d6b547648b1d050cd",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "54c208d519ea3a31d5a9ad60c55ff270",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "2399dc39ce72d88f6660c0d78f4f2442",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "b611c090513a21e2fe90e56582724e9d",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "72bfed2cce8ff19741989dec28302f3f",

View File

@ -40,16 +40,16 @@ class AppSubsystem:
"""Called when the app reaches the running state."""
def on_app_suspend(self) -> None:
"""Called when the app enters the paused state."""
"""Called when the app enters the suspended state."""
def on_app_unsuspend(self) -> None:
"""Called when the app exits the paused state."""
"""Called when the app exits the suspended state."""
def on_app_shutdown(self) -> None:
"""Called when the app is shutting down."""
"""Called when the app begins shutting down."""
def on_app_shutdown_complete(self) -> None:
"""Called when the app is done shutting down."""
"""Called when the app completes shutting down."""
def do_apply_app_config(self) -> None:
"""Called when the app config should be applied."""

View File

@ -26,7 +26,7 @@ EXPORT_CLASS_NAME_SHORTCUTS: dict[str, str] = {
'plugin': 'babase.Plugin',
# DEPRECATED as of 12/2023. Currently am warning if finding these
# but should take this out eventually.
'keyboard': 'babase.Keyboard',
'keyboard': 'bauiv1.Keyboard',
}
T = TypeVar('T')

View File

@ -151,6 +151,25 @@ class CloudSubsystem(babase.AppSubsystem):
"""
raise RuntimeError('Cloud functionality is not available.')
@overload
async def send_message_async(
self, msg: bacommon.cloud.PromoCodeMessage
) -> bacommon.cloud.PromoCodeResponse:
...
@overload
async def send_message_async(
self, msg: bacommon.cloud.TestMessage
) -> bacommon.cloud.TestResponse:
...
async def send_message_async(self, msg: Message) -> Response | None:
"""Synchronously send a message to the cloud.
Must be called from the logic thread.
"""
raise RuntimeError('Cloud functionality is not available.')
def cloud_console_exec(code: str) -> None:
"""Called by the cloud console to run code in the logic thread."""

View File

@ -5,6 +5,7 @@
from __future__ import annotations
import time
import logging
from typing import TYPE_CHECKING
import bauiv1 as bui
@ -188,18 +189,35 @@ class PromoCodeWindow(bui.Window):
async def _run_code(code: str) -> None:
from bacommon.cloud import PromoCodeMessage
plus = bui.app.plus
assert plus is not None
# If we're signed in with a V2 account, ship this to V2 server.
# if plus.accounts.primary is not None:
# plus.cloud.send_message
try:
# If we're signed in with a V2 account, ship this to V2 server.
if plus.accounts.primary is not None:
with plus.accounts.primary:
response = await plus.cloud.send_message_async(
PromoCodeMessage(code)
)
# If V2 handled it, we're done.
if response.valid:
# Support simple message printing from v2 server.
if response.message is not None:
bui.screenmessage(response.message, color=(0, 1, 0))
return
plus.add_v1_account_transaction(
{
'type': 'PROMO_CODE',
'expire_time': time.time() + 5,
'code': code,
}
)
plus.run_v1_account_transactions()
# If V2 didn't accept it (or isn't signed in) kick it over to V1.
plus.add_v1_account_transaction(
{
'type': 'PROMO_CODE',
'expire_time': time.time() + 5,
'code': code,
}
)
plus.run_v1_account_transactions()
except Exception:
logging.exception('Error sending promo code.')
bui.screenmessage('Error sending code (see log).', color=(1, 0, 0))
bui.getsound('error').play()

View File

@ -116,6 +116,27 @@ class TestResponse(Response):
testfoo: Annotated[int, IOAttrs('f')]
@ioprepped
@dataclass
class PromoCodeMessage(Message):
"""User is entering a promo code"""
code: Annotated[str, IOAttrs('c')]
@classmethod
def get_response_types(cls) -> list[type[Response] | None]:
return [PromoCodeResponse]
@ioprepped
@dataclass
class PromoCodeResponse(Response):
"""Applied that promo code for ya, boss."""
valid: Annotated[bool, IOAttrs('v')]
message: Annotated[str | None, IOAttrs('m', store_default=False)] = None
@ioprepped
@dataclass
class WorkspaceFetchState: