wired up league icon color

This commit is contained in:
Eric Froemling 2024-11-27 11:49:50 -08:00
parent 399c0d640a
commit fc301d8cc8
No known key found for this signature in database
10 changed files with 88 additions and 34 deletions

48
.efrocachemap generated
View File

@ -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": "33aa8f0257f8889ddaf3e082597abf9e",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "d41861dbe631c3f26e7075cd4c64f94c",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "4c06226db6899ac580ab369328a8312d",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "c79fab4551849cce7f36d26b0fd3e79f",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "06537caa93a48aa799921815bd980b27",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "8602d264e0846fe45f1e2b3970d7894b",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "3f9d9133fdd508fda51606bc846c0226",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "5b7c17316266f2aee39783b22dd75dd4",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "6b3a18163e8cdd2eadf8e580f42b7b29",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "da0c31b8ca95cec2bcefcb866546875f",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "b418934d9075bd052538d91559c464f7",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "26e6d71fba6634c28d038a1249145bf5",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "5831ebc77ad9e14053697f4f7a16840a",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "7b298ce406161ecf3b0131e4bd94f6b9",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "3e40c128a7d0e33e09ee58b702e058e7",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "b24a2641600eb431260db6d10fdc6a41",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "c2446e076e18a75c450775acfb679280",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "2113acf8d81d86c4648fab14fb7bf9a4",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "bf1b670a523db1a92e8634b9b9b417f5",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "b28a8710bc1165384539f35c60d71fdc",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "559ffe135fde3d5cbb108f5cdb018a65",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "b18af899f179860f2859706d93ad174d",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "44b814f41a3a4702f6841683fc2f3fa9",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "83c3293674eeb6fecbf2f42dca722c0c",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "db7abf0ed3cbb183acd244d615b9f05c",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "736919fc06b0ddab87bdad8950acb8e9",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "a4ef178eba2b7b3661a58e3f72602881",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "c53456084d1519e993b2739ac5649232",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "20d8f4fe2b87796a08e965b24d911046",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "569e9b9f76707d0d085f105e94db0fd0",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "75a05f54a4c87fef99ed800bf4b9c351",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "768b018384d457b292acdd03301308f6",
"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",
@ -4127,14 +4127,14 @@
"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": "077b325b45832b61d88914831adef2b7",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "fd723434e5e0a18095dbe9220da8f83b",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "0e4f2710390f619ac23273c8bd91a825",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "a71ca1a123d96cd92d6f2b082dc0bde3",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "b2601eba3d0c9f97cae57d7713d26b48",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "00f22b71103a1d3927062d05e9915734",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "b4fdfe95bec8df6457ffed4195236e75",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "a7dd16e737ceb208d2a8c04296d6d3dc",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "9c85a3fcc9c32f8be5b78b7a3f088701",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "de95b4dcff01de30664def6e4e05a431",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "bbb6526c21891550feff27a3af5bf276",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "7e2ce2b7e400745f47a7b4dea84dcc52",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "1000cf4bc6726fb6b48ca9281f505947",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "fc1273e22286c290b6707636ca749e5d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "dcfaec1f368e68da735ed7b4ef513314",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "84abf56bc4fd7fb13b5389937340a037",
"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 22116, api 9, 2024-11-27)
### 1.7.37 (build 22117, 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,7 @@ class ClassicAppMode(babase.AppMode):
tickets_text='-',
tokens_text='-',
league_rank_text='-',
league_type='',
achievements_percent_text='-',
level_text='-',
xp_text='-',
@ -209,6 +210,9 @@ class ClassicAppMode(babase.AppMode):
league_rank_text=(
'-' if val.league_rank is None else f'#{val.league_rank}'
),
league_type=(
'' if val.league_type is None else val.league_type.value
),
achievements_percent_text=f'{achp}%',
level_text=str(val.level),
xp_text=f'{val.xp}/{val.xpmax}',

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 = 22116
TARGET_BALLISTICA_BUILD = 22117
TARGET_BALLISTICA_VERSION = '1.7.37'

View File

@ -16,7 +16,6 @@
#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 {
@ -299,6 +298,7 @@ static auto PySetRootUIValues(PyObject* self, PyObject* args, PyObject* keywds)
const char* tickets_text;
const char* tokens_text;
const char* league_rank_text;
const char* league_type;
const char* achievements_percent_text;
const char* level_text;
const char* xp_text;
@ -306,14 +306,15 @@ static auto PySetRootUIValues(PyObject* self, PyObject* args, PyObject* keywds)
static const char* kwlist[] = {"tickets_text",
"tokens_text",
"league_rank_text",
"league_type",
"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)) {
args, keywds, "sssssss", const_cast<char**>(kwlist), &tickets_text,
&tokens_text, &league_rank_text, &league_type,
&achievements_percent_text, &level_text, &xp_text)) {
return nullptr;
}
BA_PRECONDITION(g_base->InLogicThread());
@ -323,6 +324,7 @@ static auto PySetRootUIValues(PyObject* self, PyObject* args, PyObject* keywds)
appmode->SetRootUITicketsMeterText(tickets_text);
appmode->SetRootUITokensMeterText(tokens_text);
appmode->SetRootUILeagueRankText(league_rank_text);
appmode->SetRootUILeagueType(league_type);
appmode->SetRootUIAchievementsPercentText(achievements_percent_text);
appmode->SetRootUILevelText(level_text);
appmode->SetRootUIXPText(xp_text);
@ -339,6 +341,7 @@ static PyMethodDef PySetRootUIValuesDef = {
"set_root_ui_values(tickets_text: str,\n"
" tokens_text: str,\n"
" league_rank_text: str,\n"
" league_type: str,\n"
" achievements_percent_text: str,\n"
" level_text: str,\n"
" xp_text: str,\n"

View File

@ -151,6 +151,7 @@ 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->SetLeagueType(root_ui_league_type_);
root_widget->SetAchievementPercentText(root_ui_achievement_percent_text_);
root_widget->SetLevelText(root_ui_level_text_);
root_widget->SetXPText(root_ui_xp_text_);
@ -1590,6 +1591,22 @@ void ClassicAppMode::SetRootUILeagueRankText(const std::string text) {
}
}
void ClassicAppMode::SetRootUILeagueType(const std::string text) {
BA_PRECONDITION(g_base->InLogicThread());
if (text == root_ui_league_type_) {
return;
}
// Store the value.
root_ui_league_type_ = text;
// Apply it to any existing UI.
if (uiv1_) {
if (auto* root_widget = uiv1_->root_widget()) {
root_widget->SetLeagueType(root_ui_league_type_);
}
}
}
void ClassicAppMode::SetRootUIAchievementsPercentText(const std::string text) {
BA_PRECONDITION(g_base->InLogicThread());
if (text == root_ui_achievement_percent_text_) {

View File

@ -216,6 +216,7 @@ class ClassicAppMode : public base::AppMode {
void SetRootUITicketsMeterText(const std::string text);
void SetRootUITokensMeterText(const std::string text);
void SetRootUILeagueRankText(const std::string text);
void SetRootUILeagueType(const std::string text);
void SetRootUIAchievementsPercentText(const std::string text);
void SetRootUILevelText(const std::string text);
void SetRootUIXPText(const std::string text);
@ -295,6 +296,7 @@ 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_league_type_;
std::string root_ui_achievement_percent_text_;
std::string root_ui_level_text_;
std::string root_ui_xp_text_;

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

View File

@ -3,6 +3,7 @@
#include "ballistica/ui_v1/widget/root_widget.h"
#include <algorithm>
#include <cstdio>
#include <string>
#include "ballistica/base/app_mode/app_mode.h"
@ -316,7 +317,13 @@ void RootWidget::AddMeter_(MeterType type, float h_align, float r, float g,
break;
}
imgd.depth_min = 0.3f;
AddImage_(imgd);
auto* img = AddImage_(imgd);
switch (type) {
case MeterType::kTrophy:
trophy_icon_ = img;
default:
break;
}
// Level num.
if (type == MeterType::kLevel) {
@ -1325,6 +1332,27 @@ void RootWidget::SetLeagueRankText(const std::string& val) {
league_rank_text_->widget->SetText(val);
}
void RootWidget::SetLeagueType(const std::string& val) {
Vector3f color{};
if (val == "") {
color = {0.5f, 0.5f, 0.5f};
} else if (val == "b") {
color = {1.0f, 0.7f, 0.5f};
} else if (val == "s") {
color = {1.0f, 1.0f, 1.0f};
} else if (val == "g") {
color = {1.4f, 0.8f, 0.2f};
} else if (val == "d") {
color = {1.2f, 0.8f, 1.5f};
} else {
g_core->Log(LogName::kBa, LogLevel::kError,
"RootWidget: Invalid league type '" + val + "'.");
}
assert(trophy_icon_);
trophy_icon_->widget->set_color(color.x, color.y, color.z);
}
void RootWidget::SetAchievementPercentText(const std::string& val) {
assert(achievement_percent_text_);
achievement_percent_text_->widget->SetText(val);

View File

@ -42,6 +42,7 @@ class RootWidget : public ContainerWidget {
void SetTicketsMeterText(const std::string& val);
void SetTokensMeterText(const std::string& val);
void SetLeagueRankText(const std::string& val);
void SetLeagueType(const std::string& val);
void SetAchievementPercentText(const std::string& val);
void SetLevelText(const std::string& val);
void SetXPText(const std::string& val);
@ -89,9 +90,8 @@ class RootWidget : public ContainerWidget {
Button* inventory_button_{};
Button* menu_button_{};
Button* squad_button_{};
Button* level_icon_{};
Button* level_meter_button_{};
Button* trophy_icon_{};
Image* trophy_icon_{};
Text* squad_size_text_{};
Text* account_name_text_{};
Text* tickets_meter_text_{};