diff options
m--------- | extension/deps/openvic-simulation | 0 | ||||
-rw-r--r-- | extension/src/openvic-extension/singletons/MenuSingleton.cpp | 56 | ||||
-rw-r--r-- | extension/src/openvic-extension/singletons/MenuSingleton.hpp | 2 | ||||
-rw-r--r-- | game/src/Game/GameSession/Topbar.gd | 17 |
4 files changed, 72 insertions, 3 deletions
diff --git a/extension/deps/openvic-simulation b/extension/deps/openvic-simulation -Subproject 00a3121dd43a3b6e8f5a6efa2d3b6560ef78c37 +Subproject eac76ba7c8dc714535c67b8febef3168b1670ca diff --git a/extension/src/openvic-extension/singletons/MenuSingleton.cpp b/extension/src/openvic-extension/singletons/MenuSingleton.cpp index c4b704d..6e3af5f 100644 --- a/extension/src/openvic-extension/singletons/MenuSingleton.cpp +++ b/extension/src/openvic-extension/singletons/MenuSingleton.cpp @@ -193,7 +193,63 @@ String MenuSingleton::make_rules_tooltip(RuleSet const& rules) const { return result; } +String MenuSingleton::get_test_tooltip(int32_t line) const { + String ret = "Test Tooltip " + String::num_int64(line); + + const RuleSet test_rules = [&line]() { + RuleSet ret; + + GameSingleton const* game_singleton = GameSingleton::get_singleton(); + ERR_FAIL_NULL_V(game_singleton, ret); + + bool value = true; + + for (auto const& rule : game_singleton->get_definition_manager().get_politics_manager().get_rule_manager().get_rules()) { + if (line > 0) { + line--; + } else { + ret.set_rule(&rule, value); + } + value = !value; + } + + return ret; + }(); + + if (test_rules.get_rule_count() > 0) { + ret += get_tooltip_separator() + make_rules_tooltip(test_rules); + } + + const ModifierValue test_modifier = [&line]() { + ModifierValue ret; + + GameSingleton const* game_singleton = GameSingleton::get_singleton(); + ERR_FAIL_NULL_V(game_singleton, ret); + + fixed_point_t value = 0; + + for (auto const& effect : game_singleton->get_definition_manager().get_modifier_manager().get_modifier_effects()) { + if (line > 0) { + line--; + } else { + ret[&effect] = value; + } + value++; + } + + return ret; + }(); + + if (test_modifier.get_effect_count() > 0) { + ret += get_tooltip_separator() + make_modifier_effects_tooltip(test_modifier); + } + + return ret; +} + void MenuSingleton::_bind_methods() { + OV_BIND_METHOD(MenuSingleton::get_test_tooltip, { "line" }); + OV_BIND_SMETHOD(get_tooltip_separator); OV_BIND_METHOD(MenuSingleton::get_country_name_from_identifier, { "country_identifier" }); OV_BIND_METHOD(MenuSingleton::get_country_adjective_from_identifier, { "country_identifier" }); diff --git a/extension/src/openvic-extension/singletons/MenuSingleton.hpp b/extension/src/openvic-extension/singletons/MenuSingleton.hpp index 0dcc8ff..713026c 100644 --- a/extension/src/openvic-extension/singletons/MenuSingleton.hpp +++ b/extension/src/openvic-extension/singletons/MenuSingleton.hpp @@ -119,6 +119,8 @@ namespace OpenVic { static void _bind_methods(); public: + godot::String get_test_tooltip(int32_t line) const; + static MenuSingleton* get_singleton(); /* This should only be called AFTER GameSingleton has been initialised! */ diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd index 2f1fdbf..737ed9d 100644 --- a/game/src/Game/GameSession/Topbar.gd +++ b/game/src/Game/GameSession/Topbar.gd @@ -295,6 +295,16 @@ enum CountryStatus { PRIMITIVE } +var test_scroll : int = 0 + +func _input(event) -> void: + if event is InputEventKey and event.pressed: + if event.keycode == KEY_O: + test_scroll -= 1 + elif event.keycode == KEY_P: + test_scroll += 1 + _update_info() + func _update_info() -> void: var topbar_info : Dictionary = MenuSingleton.get_topbar_info() @@ -392,9 +402,10 @@ func _update_info() -> void: _country_colonial_power_label.set_text( "§%s%s§!/%s" % ["W" if available_colonial_power > 0 else "R", available_colonial_power, max_colonial_power] ) - _country_colonial_power_label.set_tooltip_string(tr("COLONIAL_POINTS") + MenuSingleton.get_tooltip_separator() + ( - topbar_info.get(colonial_power_tooltip_key, "") if country_status <= CountryStatus.SECONDARY_POWER else tr("NON_COLONIAL_POWER") - )) + #_country_colonial_power_label.set_tooltip_string(tr("COLONIAL_POINTS") + MenuSingleton.get_tooltip_separator() + ( + #topbar_info.get(colonial_power_tooltip_key, "") if country_status <= CountryStatus.SECONDARY_POWER else tr("NON_COLONIAL_POWER") + #)) + _country_colonial_power_label.set_tooltip_string("(Use O and P to scroll) " + MenuSingleton.get_test_tooltip(test_scroll)) ## Time control if _date_label: |