wiring up more ui to live db values

This commit is contained in:
Eric Froemling 2024-11-27 10:34:36 -08:00
parent a78dc70bd7
commit 744f4d1c57
No known key found for this signature in database
10 changed files with 153 additions and 49 deletions

72
.efrocachemap generated
View File

@ -4099,42 +4099,42 @@
"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": "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",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "55cd9cb73acf7a0005a091ebf362cba2",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "e3bd2d824b6bcf4cf820d87ebf1f969a",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "5fe38e71bdbd7daf2554965233677d41",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "e3bd2d824b6bcf4cf820d87ebf1f969a",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "5fe38e71bdbd7daf2554965233677d41",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "5f7c9ed9bdfcbf1806f613d8b1b479ef",
"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": "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",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "24c6537904ce985dd7216ba6dfef8f6e",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "c15b16a984a3a8af8c116fb63444135e",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "e3811f382e8f8a22f26d298efb21fc06",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "b14eb7c44742718cd7f855e8b9688e75",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "525ae7fc03d49ba824bd4258d6790f67",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "229caf35b4055b42b1e76e022675e4eb",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "7476b2f3d1ab857822b7282ae4cebeb4",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "414330fe9e8ecb7b31965b819e6ebd4a",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "de5805b6595031a41dafed9253be801f",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "cbd5f88aea758ae25f605cf54fc5ad33",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "7bde0df040677f9c626b7a49bd659179",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "92ef148d99a09f82890ee4727f4225f0",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "8dcf15764f48f9cd172615532299f6da",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "f25a3f45bd83b54c3ee615a3da6f3745",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "f4baf3991bd4d57443bee54c6d36a44c",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "24ffd9de8672af2e614fe739eb96b605",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "6b5ba102e7c13652db95c30096f6bc25",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "cb8ab89546a0b0f1753de762055f64af",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "6b5ba102e7c13652db95c30096f6bc25",
"build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "cb8ab89546a0b0f1753de762055f64af",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "1ac46b8c7845b7e85658bd56d2da5421",
"build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "8e1b3728dc4733ca391534c178e34e38",
"build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "1ac46b8c7845b7e85658bd56d2da5421",
"build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "8e1b3728dc4733ca391534c178e34e38",
"build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "0debb2bc242b680db4410353ef234659",
"build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "35edf150514277863503c69a3a04c3c6",
"build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "0debb2bc242b680db4410353ef234659",
"build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "35edf150514277863503c69a3a04c3c6",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "e09835f55a587ae804925d97b6dcf72e",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "397e876e2e6e5d7ac4c997d3e3cbdc16",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "c4b2d10992e0d8e53b38b8b79cd4fd88",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "bbfec9d1f2e1d4063748e2a7fef41e72",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "a21eb53994c0365ad2b0be35cf6a2913",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "4f735a72e3b1c44b7d77975bb5372ea7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "03543c396c2f5df8dad7b8f719c81c40",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "188f6eb9269cbc9adb4ce5f5620a8fdb",
"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",

View File

@ -1,4 +1,4 @@
### 1.7.37 (build 22114, api 9, 2024-11-26)
### 1.7.37 (build 22115, api 9, 2024-11-27)
- 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.

View File

@ -183,6 +183,9 @@ class ClassicAppMode(babase.AppMode):
tickets_text='-',
tokens_text='-',
league_rank_text='-',
achievements_percent_text='-',
level_text='-',
xp_text='-',
)
else:
@ -199,14 +202,16 @@ class ClassicAppMode(babase.AppMode):
def _on_classic_account_data_change(
self, val: bacommon.cloud.ClassicAccountLiveData
) -> None:
# pass
# print(f'GOT CLASSIC ACCOUNT DATA: {val}')
achp = round(val.achievements / max(val.achievements_total, 1) * 100.0)
_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}'
),
achievements_percent_text=f'{achp}%',
level_text=str(val.level),
xp_text=f'{val.xp}/{val.xpmax}',
)
def _root_ui_menu_press(self) -> None:

View File

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

View File

@ -299,11 +299,21 @@ static auto PySetRootUIValues(PyObject* self, PyObject* args, PyObject* keywds)
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<char**>(kwlist), &tickets_text,
&tokens_text, &league_rank_text)) {
const char* achievements_percent_text;
const char* level_text;
const char* xp_text;
static const char* kwlist[] = {"tickets_text",
"tokens_text",
"league_rank_text",
"achievements_percent_text",
"level_text",
"xp_text",
nullptr};
if (!PyArg_ParseTupleAndKeywords(
args, keywds, "ssssss", const_cast<char**>(kwlist), &tickets_text,
&tokens_text, &league_rank_text, &achievements_percent_text,
&level_text, &xp_text)) {
return nullptr;
}
BA_PRECONDITION(g_base->InLogicThread());
@ -313,6 +323,9 @@ static auto PySetRootUIValues(PyObject* self, PyObject* args, PyObject* keywds)
appmode->SetRootUITicketsMeterText(tickets_text);
appmode->SetRootUITokensMeterText(tokens_text);
appmode->SetRootUILeagueRankText(league_rank_text);
appmode->SetRootUIAchievementsPercentText(achievements_percent_text);
appmode->SetRootUILevelText(level_text);
appmode->SetRootUIXPText(xp_text);
Py_RETURN_NONE;
BA_PYTHON_CATCH;
@ -326,6 +339,9 @@ static PyMethodDef PySetRootUIValuesDef = {
"set_root_ui_values(tickets_text: str,\n"
" tokens_text: str,\n"
" league_rank_text: str,\n"
" achievements_percent_text: str,\n"
" level_text: str,\n"
" xp_text: str,\n"
") -> None\n"
"\n"
"(internal)",

View File

@ -151,6 +151,9 @@ void ClassicAppMode::Reset_() {
root_widget->SetTicketsMeterText(root_ui_tickets_meter_text_);
root_widget->SetTokensMeterText(root_ui_tokens_meter_text_);
root_widget->SetLeagueRankText(root_ui_league_rank_text_);
root_widget->SetAchievementPercentText(root_ui_achievement_percent_text_);
root_widget->SetLevelText(root_ui_level_text_);
root_widget->SetXPText(root_ui_xp_text_);
}
}
@ -1587,4 +1590,54 @@ void ClassicAppMode::SetRootUILeagueRankText(const std::string text) {
}
}
void ClassicAppMode::SetRootUIAchievementsPercentText(const std::string text) {
BA_PRECONDITION(g_base->InLogicThread());
if (text == root_ui_achievement_percent_text_) {
return;
}
// Store the value.
root_ui_achievement_percent_text_ = text;
// Apply it to any existing UI.
if (uiv1_) {
if (auto* root_widget = uiv1_->root_widget()) {
root_widget->SetAchievementPercentText(root_ui_achievement_percent_text_);
}
}
}
void ClassicAppMode::SetRootUILevelText(const std::string text) {
BA_PRECONDITION(g_base->InLogicThread());
if (text == root_ui_level_text_) {
return;
}
// Store the value.
root_ui_level_text_ = text;
// Apply it to any existing UI.
if (uiv1_) {
if (auto* root_widget = uiv1_->root_widget()) {
root_widget->SetLevelText(root_ui_level_text_);
}
}
}
void ClassicAppMode::SetRootUIXPText(const std::string text) {
BA_PRECONDITION(g_base->InLogicThread());
if (text == root_ui_xp_text_) {
return;
}
// Store the value.
root_ui_xp_text_ = text;
// Apply it to any existing UI.
if (uiv1_) {
if (auto* root_widget = uiv1_->root_widget()) {
root_widget->SetXPText(root_ui_xp_text_);
}
}
}
} // namespace ballistica::classic

View File

@ -216,6 +216,9 @@ class ClassicAppMode : public base::AppMode {
void SetRootUITicketsMeterText(const std::string text);
void SetRootUITokensMeterText(const std::string text);
void SetRootUILeagueRankText(const std::string text);
void SetRootUIAchievementsPercentText(const std::string text);
void SetRootUILevelText(const std::string text);
void SetRootUIXPText(const std::string text);
private:
ClassicAppMode();
@ -292,6 +295,9 @@ class ClassicAppMode : public base::AppMode {
std::string root_ui_tickets_meter_text_;
std::string root_ui_tokens_meter_text_;
std::string root_ui_league_rank_text_;
std::string root_ui_achievement_percent_text_;
std::string root_ui_level_text_;
std::string root_ui_xp_text_;
std::list<std::pair<millisecs_t, scene_v1::PlayerSpec> > banned_players_;
std::optional<float> idle_exit_minutes_{};
std::optional<uint32_t> internal_music_play_id_{};

View File

@ -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 = 22114;
const int kEngineBuildNumber = 22115;
const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9;

View File

@ -279,6 +279,9 @@ void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g,
case MeterType::kTrophy:
league_rank_text_ = text;
break;
case MeterType::kLevel:
xp_text_ = text;
break;
default:
break;
}
@ -330,7 +333,7 @@ void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g,
td.color_r = 1.0f;
td.color_g = 1.0f;
td.color_b = 1.0f;
AddText_(td);
level_text_ = AddText_(td);
}
}
}
@ -513,7 +516,7 @@ void RootWidget::Setup() {
account_name_text_ = AddText_(td);
}
}
AddMeter_(MeterType::kLevel, 0.0f, 1.0f, 1.0f, 1.0f, false, "456/1000");
AddMeter_(MeterType::kLevel, 0.0f, 1.0f, 1.0f, 1.0f, false, "");
AddMeter_(MeterType::kTrophy, 0.0f, 1.0f, 1.0f, 1.0f, false, "");
// Menu button (only shows up when we're not in a menu)
@ -655,7 +658,7 @@ void RootWidget::Setup() {
td.color_r = 0.8f;
td.color_g = 0.75f;
td.color_b = 0.9f;
AddText_(td);
achievement_percent_text_ = AddText_(td);
}
}
@ -1322,4 +1325,19 @@ void RootWidget::SetLeagueRankText(const std::string& val) {
league_rank_text_->widget->SetText(val);
}
void RootWidget::SetAchievementPercentText(const std::string& val) {
assert(achievement_percent_text_);
achievement_percent_text_->widget->SetText(val);
}
void RootWidget::SetLevelText(const std::string& val) {
assert(level_text_);
level_text_->widget->SetText(val);
}
void RootWidget::SetXPText(const std::string& val) {
assert(xp_text_);
xp_text_->widget->SetText(val);
}
} // namespace ballistica::ui_v1

View File

@ -42,6 +42,9 @@ class RootWidget : public ContainerWidget {
void SetTicketsMeterText(const std::string& val);
void SetTokensMeterText(const std::string& val);
void SetLeagueRankText(const std::string& val);
void SetAchievementPercentText(const std::string& val);
void SetLevelText(const std::string& val);
void SetXPText(const std::string& val);
private:
struct ButtonDef;
@ -94,6 +97,9 @@ class RootWidget : public ContainerWidget {
Text* tickets_meter_text_{};
Text* tokens_meter_text_{};
Text* league_rank_text_{};
Text* achievement_percent_text_{};
Text* level_text_{};
Text* xp_text_{};
};
} // namespace ballistica::ui_v1