diff --git a/.efrocachemap b/.efrocachemap index 44214a7d..c5407509 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4099,22 +4099,22 @@ "build/assets/windows/Win32/ucrtbased.dll": "bfd1180c269d3950b76f35a63655e9e1", "build/assets/windows/Win32/vc_redist.x86.exe": "15a5f1f876503885adbdf5b3989b3718", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "258017f68d714fa993399ba73fe35a47", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "fb7661a6c77d99491e577594dd132262", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "91fef82f37ca46dfaf4d3ebb1cd4c911", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "97361c0f527572ee1e81f372b21c6eea", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "bb14d62cebe5f8889b36ee580db68f67", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "f4b9c6ef2d3252e46f2e9e5987092259", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "ba771845ad99c8274c0a2e390306c1c6", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "62a0abe5d11268e7433b7880066558e3", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "b180ee641e805d1a6eed1bdf194a88ba", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "ec633c984c8be568434bdcc39d3fbf75", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "6ee62f6bec7345ad7863014cd6ab6f91", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "74f3a19a8b11f0a26d3b61c01c5cfb0f", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "93e722f0f0286a20320372a0ed52fb3b", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "56f71c820702382f2c50b6693426a9a4", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "83730297d803f6f7458b8c7ac95f6bbc", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "69c38b343c62dc4f687d9ac937aacc73", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "efd62d0d3ce3a171148efc179784f112", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "2472eb4231f2896e7be04a324ab81a48", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "f2b4b1c335aa1e5b2162e5906664bcb9", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "3ffcff14c6388b8a1ca232c39a1311ec", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "40a2aee1783cf001308069b7e226713f", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "7788628df181a17e7c1aee3428a35498", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "c5e24a7756a9d957f9b5881e88d12e59", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "f9c6586282fbae788d2bd2a976e39e44", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "b4d48200edab9a412bfd3844773dafcc", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "7e3563f63945e5c42e2203145e474e8e", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b99b7cbeef886ca9bfe9e66066ade64d", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "b1952bf79cc2696e9e11b47922abc8a0", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "c3ef14a9641446efe10f8a2323408188", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "13ee409c3d2a246477095534f24c4263", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "f0efd0ab3f3e7d8f669f6f788596cf65", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "dac32f2561a18b69a95847126c05fe37", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "5ef674f19fa3e2bfc061d8ebc2e97624", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "55cd9cb73acf7a0005a091ebf362cba2", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "5ef674f19fa3e2bfc061d8ebc2e97624", @@ -4127,14 +4127,14 @@ "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "fc11b650398c55a0124943939017e9ec", "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "5f7c9ed9bdfcbf1806f613d8b1b479ef", "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "fc11b650398c55a0124943939017e9ec", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "668de5ef2c6c47adea8bf3b13cf29dce", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "27c9d03cf46b9771d6bbbebb18e7c6b2", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "6045009c5fd0f8b3e21429fa5594ed9a", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "3430e09462e8e6954e276c70c9e692be", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "543e53a1521fbf4acd6c47a6d124c5ee", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "8412cac6845eed87cd792a9b6cd7a540", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "4b93778e70a8149dbe91115cae916fe3", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "6bfb80e2784c47f48b11079f240299b5", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "7f27075bbe061e4cf05f730d0ae0573e", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "62522c7e9b566e8a22f0394d59074146", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "9bdef8b00362b0797d28e30ebca35eec", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "1c96f8af1defefb6f407186fb4599311", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "28caa2a41eb7b1e0be25d64c54ec17a3", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "f1886b4343158a02b8f51602cf5d1716", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "8d44da9f3f739fa1ea3c24ebc48777c8", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "86d36e2dd70d5ccc4e0f70aa6de1fbb2", "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": "3a583e7e03bd4907b21adc3bf5729d15", diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b68f044..fda27f52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.37 (build 22113, api 9, 2024-11-26) +### 1.7.37 (build 22114, api 9, 2024-11-26) - 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. diff --git a/src/assets/ba_data/python/baclassic/_appmode.py b/src/assets/ba_data/python/baclassic/_appmode.py index 6b12e3dc..5dd68921 100644 --- a/src/assets/ba_data/python/baclassic/_appmode.py +++ b/src/assets/ba_data/python/baclassic/_appmode.py @@ -10,6 +10,7 @@ from typing import TYPE_CHECKING, override from bacommon.app import AppExperience import babase +import bauiv1 import _baclassic @@ -18,7 +19,6 @@ if TYPE_CHECKING: from efro.call import CallbackRegistration import bacommon.cloud - import bauiv1 # ba_meta export babase.AppMode @@ -179,6 +179,12 @@ class ClassicAppMode(babase.AppMode): if account is None: self._account_data_sub = None + _baclassic.set_root_ui_values( + tickets_text='-', + tokens_text='-', + league_rank_text='-', + ) + else: with account: self._account_data_sub = ( @@ -193,8 +199,15 @@ class ClassicAppMode(babase.AppMode): def _on_classic_account_data_change( self, val: bacommon.cloud.ClassicAccountLiveData ) -> None: - pass + # pass # print(f'GOT CLASSIC ACCOUNT DATA: {val}') + _baclassic.set_root_ui_values( + tickets_text=str(val.tickets), + tokens_text=str(val.tokens), + league_rank_text=( + '-' if val.league_rank is None else f'#{val.league_rank}' + ), + ) def _root_ui_menu_press(self) -> None: from babase import push_back_press @@ -215,7 +228,6 @@ class ClassicAppMode(babase.AppMode): push_back_press() def _root_ui_account_press(self) -> None: - import bauiv1 from bauiv1lib.account.settings import AccountSettingsWindow self._auxiliary_window_nav( @@ -226,8 +238,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_squad_press(self) -> None: - import bauiv1 - btn = bauiv1.get_special_widget('squad_button') center = btn.get_screen_space_center() if bauiv1.app.classic is not None: @@ -236,7 +246,6 @@ class ClassicAppMode(babase.AppMode): logging.warning('party_icon_activate: no classic.') def _root_ui_settings_press(self) -> None: - import bauiv1 from bauiv1lib.settings.allsettings import AllSettingsWindow self._auxiliary_window_nav( @@ -342,7 +351,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_achievements_press(self) -> None: - import bauiv1 from bauiv1lib.achievements import AchievementsWindow self._auxiliary_window_nav( @@ -353,7 +361,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_inbox_press(self) -> None: - import bauiv1 from bauiv1lib.inbox import InboxWindow self._auxiliary_window_nav( @@ -364,7 +371,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_store_press(self) -> None: - import bauiv1 from bauiv1lib.store.browser import StoreBrowserWindow self._auxiliary_window_nav( @@ -375,7 +381,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_tickets_meter_press(self) -> None: - import bauiv1 from bauiv1lib.resourcetypeinfo import ResourceTypeInfoWindow ResourceTypeInfoWindow( @@ -383,7 +388,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_tokens_meter_press(self) -> None: - import bauiv1 from bauiv1lib.resourcetypeinfo import ResourceTypeInfoWindow ResourceTypeInfoWindow( @@ -391,7 +395,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_trophy_meter_press(self) -> None: - import bauiv1 from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.league.rankwindow import LeagueRankWindow @@ -409,7 +412,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_level_meter_press(self) -> None: - import bauiv1 from bauiv1lib.resourcetypeinfo import ResourceTypeInfoWindow ResourceTypeInfoWindow( @@ -417,7 +419,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_inventory_press(self) -> None: - import bauiv1 from bauiv1lib.inventory import InventoryWindow self._auxiliary_window_nav( @@ -428,7 +429,6 @@ class ClassicAppMode(babase.AppMode): ) def _root_ui_get_tokens_press(self) -> None: - import bauiv1 from bauiv1lib.gettokens import GetTokensWindow self._auxiliary_window_nav( diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 8711b6fa..1c09f124 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -53,7 +53,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 22113 +TARGET_BALLISTICA_BUILD = 22114 TARGET_BALLISTICA_VERSION = '1.7.37' diff --git a/src/ballistica/classic/classic.cc b/src/ballistica/classic/classic.cc index 5ede6bff..6d9ec1e4 100644 --- a/src/ballistica/classic/classic.cc +++ b/src/ballistica/classic/classic.cc @@ -12,6 +12,7 @@ #include "ballistica/scene_v1/python/scene_v1_python.h" #include "ballistica/scene_v1/support/player_spec.h" #include "ballistica/shared/generic/utils.h" +#include "ballistica/ui_v1/ui_v1.h" namespace ballistica::classic { @@ -19,6 +20,7 @@ core::CoreFeatureSet* g_core{}; base::BaseFeatureSet* g_base{}; ClassicFeatureSet* g_classic{}; scene_v1::SceneV1FeatureSet* g_scene_v1{}; +ui_v1::UIV1FeatureSet* g_ui_v1{}; void ClassicFeatureSet::OnModuleExec(PyObject* module) { // Ok, our feature-set's Python module is getting imported. @@ -54,6 +56,9 @@ void ClassicFeatureSet::OnModuleExec(PyObject* module) { assert(g_scene_v1 == nullptr); g_scene_v1 = scene_v1::SceneV1FeatureSet::Import(); + assert(g_ui_v1 == nullptr); + g_ui_v1 = ui_v1::UIV1FeatureSet::Import(); + g_core->Log(LogName::kBaLifecycle, LogLevel::kInfo, "_baclassic exec end"); } diff --git a/src/ballistica/classic/classic.h b/src/ballistica/classic/classic.h index 6bd3d56d..2ae85657 100644 --- a/src/ballistica/classic/classic.h +++ b/src/ballistica/classic/classic.h @@ -25,6 +25,9 @@ class BaseFeatureSet; namespace ballistica::scene_v1 { class SceneV1FeatureSet; } +namespace ballistica::ui_v1 { +class UIV1FeatureSet; +} namespace ballistica::classic { @@ -64,6 +67,7 @@ extern core::CoreFeatureSet* g_core; extern base::BaseFeatureSet* g_base; extern ClassicFeatureSet* g_classic; extern scene_v1::SceneV1FeatureSet* g_scene_v1; +extern ui_v1::UIV1FeatureSet* g_ui_v1; /// Our C++ front-end to our feature set. This is what other C++ /// feature-sets can 'Import' from us. diff --git a/src/ballistica/classic/python/methods/python_methods_classic.cc b/src/ballistica/classic/python/methods/python_methods_classic.cc index ec99f2ab..d034aeb6 100644 --- a/src/ballistica/classic/python/methods/python_methods_classic.cc +++ b/src/ballistica/classic/python/methods/python_methods_classic.cc @@ -16,6 +16,7 @@ #include "ballistica/shared/python/python.h" #include "ballistica/shared/python/python_command.h" #include "ballistica/shared/python/python_sys.h" +#include "ballistica/ui_v1/widget/root_widget.h" namespace ballistica::classic { @@ -289,6 +290,47 @@ static PyMethodDef PyClassicAppModeDeactivateDef = { "(internal)\n", }; +// -------------------------- set_root_ui_values ------------------------------- + +static auto PySetRootUIValues(PyObject* self, PyObject* args, PyObject* keywds) + -> PyObject* { + BA_PYTHON_TRY; + + const char* tickets_text; + const char* tokens_text; + const char* league_rank_text; + static const char* kwlist[] = {"tickets_text", "tokens_text", + "league_rank_text", nullptr}; + if (!PyArg_ParseTupleAndKeywords(args, keywds, "sss", + const_cast(kwlist), &tickets_text, + &tokens_text, &league_rank_text)) { + return nullptr; + } + BA_PRECONDITION(g_base->InLogicThread()); + + auto* appmode = ClassicAppMode::GetActiveOrThrow(); + + appmode->SetRootUITicketsMeterText(tickets_text); + appmode->SetRootUITokensMeterText(tokens_text); + appmode->SetRootUILeagueRankText(league_rank_text); + + Py_RETURN_NONE; + BA_PYTHON_CATCH; +} + +static PyMethodDef PySetRootUIValuesDef = { + "set_root_ui_values", // name + (PyCFunction)PySetRootUIValues, // method + METH_VARARGS | METH_KEYWORDS, // flags + + "set_root_ui_values(tickets_text: str,\n" + " tokens_text: str,\n" + " league_rank_text: str,\n" + ") -> None\n" + "\n" + "(internal)", +}; + // ----------------------------------------------------------------------------- auto PythonMethodsClassic::GetMethods() -> std::vector { @@ -299,6 +341,7 @@ auto PythonMethodsClassic::GetMethods() -> std::vector { PyClassicAppModeHandleAppIntentDefaultDef, PyClassicAppModeActivateDef, PyClassicAppModeDeactivateDef, + PySetRootUIValuesDef, }; } diff --git a/src/ballistica/classic/support/classic_app_mode.cc b/src/ballistica/classic/support/classic_app_mode.cc index c2f985e7..5d454d05 100644 --- a/src/ballistica/classic/support/classic_app_mode.cc +++ b/src/ballistica/classic/support/classic_app_mode.cc @@ -27,10 +27,12 @@ #include "ballistica/scene_v1/support/client_session_replay.h" #include "ballistica/scene_v1/support/host_session.h" #include "ballistica/shared/foundation/event_loop.h" +#include "ballistica/shared/foundation/macros.h" #include "ballistica/shared/generic/json.h" #include "ballistica/shared/generic/utils.h" #include "ballistica/shared/networking/sockaddr.h" #include "ballistica/ui_v1/ui_v1.h" +#include "ballistica/ui_v1/widget/root_widget.h" namespace ballistica::classic { @@ -140,7 +142,16 @@ void ClassicAppMode::Reset_() { // Import UIV1 and wire it up for UI duty. if (!g_core->HeadlessMode()) { - g_base->ui->SetUIDelegate(ui_v1::UIV1FeatureSet::Import()); + uiv1_ = ui_v1::UIV1FeatureSet::Import(); + g_base->ui->SetUIDelegate(uiv1_); + + // At this point uiv1 is in a reset-to-default state. Now plug in our + // current values for everything. + if (auto* root_widget = uiv1_->root_widget()) { + root_widget->SetTicketsMeterText(root_ui_tickets_meter_text_); + root_widget->SetTokensMeterText(root_ui_tokens_meter_text_); + root_widget->SetLeagueRankText(root_ui_league_rank_text_); + } } // Fade in if we currently aren't. @@ -1528,4 +1539,52 @@ void ClassicAppMode::RunMainMenu() { } } +void ClassicAppMode::SetRootUITicketsMeterText(const std::string text) { + BA_PRECONDITION(g_base->InLogicThread()); + if (text == root_ui_tickets_meter_text_) { + return; + } + // Store the value. + root_ui_tickets_meter_text_ = text; + + // Apply it to any existing UI. + if (uiv1_) { + if (auto* root_widget = uiv1_->root_widget()) { + root_widget->SetTicketsMeterText(root_ui_tickets_meter_text_); + } + } +} + +void ClassicAppMode::SetRootUITokensMeterText(const std::string text) { + BA_PRECONDITION(g_base->InLogicThread()); + if (text == root_ui_tokens_meter_text_) { + return; + } + // Store the value. + root_ui_tokens_meter_text_ = text; + + // Apply it to any existing UI. + if (uiv1_) { + if (auto* root_widget = uiv1_->root_widget()) { + root_widget->SetTokensMeterText(root_ui_tokens_meter_text_); + } + } +} + +void ClassicAppMode::SetRootUILeagueRankText(const std::string text) { + BA_PRECONDITION(g_base->InLogicThread()); + if (text == root_ui_league_rank_text_) { + return; + } + // Store the value. + root_ui_league_rank_text_ = text; + + // Apply it to any existing UI. + if (uiv1_) { + if (auto* root_widget = uiv1_->root_widget()) { + root_widget->SetLeagueRankText(root_ui_league_rank_text_); + } + } +} + } // namespace ballistica::classic diff --git a/src/ballistica/classic/support/classic_app_mode.h b/src/ballistica/classic/support/classic_app_mode.h index d0711c3f..55940ac7 100644 --- a/src/ballistica/classic/support/classic_app_mode.h +++ b/src/ballistica/classic/support/classic_app_mode.h @@ -17,6 +17,7 @@ #include "ballistica/classic/classic.h" #include "ballistica/scene_v1/scene_v1.h" #include "ballistica/shared/foundation/object.h" +#include "ballistica/ui_v1/ui_v1.h" namespace ballistica::classic { @@ -212,6 +213,10 @@ class ClassicAppMode : public base::AppMode { public_party_public_address_ipv6_ = val; } + void SetRootUITicketsMeterText(const std::string text); + void SetRootUITokensMeterText(const std::string text); + void SetRootUILeagueRankText(const std::string text); + private: ClassicAppMode(); void OnGameRosterChanged_(); @@ -250,6 +255,7 @@ class ClassicAppMode : public base::AppMode { bool kick_voting_enabled_{true}; bool replay_paused_{false}; + ui_v1::UIV1FeatureSet* uiv1_{}; cJSON* game_roster_{}; millisecs_t last_game_roster_send_time_{}; std::unique_ptr connections_; @@ -283,6 +289,9 @@ class ClassicAppMode : public base::AppMode { std::string public_party_name_; std::string public_party_min_league_; std::string public_party_stats_url_; + std::string root_ui_tickets_meter_text_; + std::string root_ui_tokens_meter_text_; + std::string root_ui_league_rank_text_; std::list > banned_players_; std::optional idle_exit_minutes_{}; std::optional internal_music_play_id_{}; diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index a2d88270..d759107c 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -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 = 22113; +const int kEngineBuildNumber = 22114; const char* kEngineVersion = "1.7.37"; const int kEngineApiVersion = 9; diff --git a/src/ballistica/ui_v1/widget/root_widget.cc b/src/ballistica/ui_v1/widget/root_widget.cc index 8d6d00f5..c0b49c65 100644 --- a/src/ballistica/ui_v1/widget/root_widget.cc +++ b/src/ballistica/ui_v1/widget/root_widget.cc @@ -268,7 +268,20 @@ void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g, td.flatness = 1.0f; td.shadow = 1.0f; td.depth_min = 0.3f; - AddText_(td); + auto* text = AddText_(td); + switch (type) { + case MeterType::kTickets: + tickets_meter_text_ = text; + break; + case MeterType::kTokens: + tokens_meter_text_ = text; + break; + case MeterType::kTrophy: + league_rank_text_ = text; + break; + default: + break; + } } // Icon on side. { @@ -501,7 +514,7 @@ void RootWidget::Setup() { } } AddMeter_(MeterType::kLevel, 0.0f, 1.0f, 1.0f, 1.0f, false, "456/1000"); - AddMeter_(MeterType::kTrophy, 0.0f, 1.0f, 1.0f, 1.0f, false, "#123"); + AddMeter_(MeterType::kTrophy, 0.0f, 1.0f, 1.0f, 1.0f, false, ""); // Menu button (only shows up when we're not in a menu) // FIXME - this should never be visible on TV or VR UI modes @@ -579,8 +592,8 @@ void RootWidget::Setup() { } } - AddMeter_(MeterType::kTokens, 1.0f, 1.0f, 1.0f, 1.0f, true, "123"); - AddMeter_(MeterType::kTickets, 1.0f, 1.0f, 1.0f, 1.0f, false, "12345"); + AddMeter_(MeterType::kTokens, 1.0f, 1.0f, 1.0f, 1.0f, true, ""); + AddMeter_(MeterType::kTickets, 1.0f, 1.0f, 1.0f, 1.0f, false, ""); // Inbox button. { @@ -1294,4 +1307,19 @@ void RootWidget::SetSquadSizeLabel(int val) { } } +void RootWidget::SetTicketsMeterText(const std::string& val) { + assert(tickets_meter_text_); + tickets_meter_text_->widget->SetText(val); +} + +void RootWidget::SetTokensMeterText(const std::string& val) { + assert(tokens_meter_text_); + tokens_meter_text_->widget->SetText(val); +} + +void RootWidget::SetLeagueRankText(const std::string& val) { + assert(league_rank_text_); + league_rank_text_->widget->SetText(val); +} + } // namespace ballistica::ui_v1 diff --git a/src/ballistica/ui_v1/widget/root_widget.h b/src/ballistica/ui_v1/widget/root_widget.h index 91defb93..94eebcb1 100644 --- a/src/ballistica/ui_v1/widget/root_widget.h +++ b/src/ballistica/ui_v1/widget/root_widget.h @@ -39,6 +39,10 @@ class RootWidget : public ContainerWidget { void SetSquadSizeLabel(int val); void SetAccountState(bool signed_in, const std::string& name); + void SetTicketsMeterText(const std::string& val); + void SetTokensMeterText(const std::string& val); + void SetLeagueRankText(const std::string& val); + private: struct ButtonDef; struct Button; @@ -87,6 +91,9 @@ class RootWidget : public ContainerWidget { Button* trophy_icon_{}; Text* squad_size_text_{}; Text* account_name_text_{}; + Text* tickets_meter_text_{}; + Text* tokens_meter_text_{}; + Text* league_rank_text_{}; }; } // namespace ballistica::ui_v1