Skip to content

Commit

Permalink
Colorize map icon labels
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer committed Dec 16, 2024
1 parent 03a4e22 commit 12ce1f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion projects/Randomizer/game/map/icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ namespace randomizer::game::map {
core::reactivity::watch_effect()
.effect([&] {
if (il2cpp::unity::is_valid(m_map_icon.get())) {
m_map_icon.get()->fields.m_labelBox->fields.TextBox->fields.color = app::Color(1.0, 1.0, 1.0, 1.0);
m_map_icon.get()->fields.m_labelBox->fields.FormatText = true;
m_map_icon.get()->fields.m_labelBox->fields.MessageProvider = core::api::system::create_message_provider(m_label.get());
MessageBox::RefreshText_1(m_map_icon.get()->fields.m_labelBox);
}
Expand All @@ -141,7 +143,7 @@ namespace randomizer::game::map {
}
})
.effect([&] {
// Needs to be outside the if because we want the before part of the effect to run and initialize the game_object.
// Needs to be outside the 'if' because we want the before part of the effect to run and initialize the game_object.
const auto visible = m_visible.get();
if (il2cpp::unity::is_valid(m_game_object.get())) {
UnityEngine::GameObject::set_active(m_game_object.get(), visible);
Expand Down
2 changes: 1 addition & 1 deletion projects/Randomizer/game/map/map_initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace randomizer::game::map {
namespace {
std::string icon_label(const std::optional<location_data::Location>& location, const core::api::uber_states::UberStateCondition& condition) {
auto name = location.has_value() && !location->name.empty() ? location->name : " ";
return std::format("[no_color([if([state_bool(34543|11226)],[pickup_text({0})],{1})])]", condition.serialize(), name);
return std::format("[if([state_bool(34543|11226)],[pickup_text({0})],{1})]", condition.serialize(), name);
}

MapIcon select_icon(const location_data::Location& location) {
Expand Down

0 comments on commit 12ce1f8

Please sign in to comment.