Project Alice
Loading...
Searching...
No Matches
gui_crisis_window.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace ui {
6
8public:
9 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
10 return state.world.nation_get_identity_from_identity_holder(state.primary_crisis_attacker);
11 }
12};
13
15public:
16 bool show = false;
17
18 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
19 if(state.current_crisis == sys::crisis_type::colonial) {
20 auto colonizers = state.world.state_definition_get_colonization(state.crisis_colony);
21 if(colonizers.begin() != colonizers.end()) {
22 auto attacking_colonizer = (*colonizers.begin()).get_colonizer();
23 return state.world.nation_get_identity_from_identity_holder(attacking_colonizer);
24 }
25 } else if(state.current_crisis == sys::crisis_type::liberation) {
26 return state.crisis_liberation_tag;
27 }
28 return dcon::national_identity_id{};
29 }
30 void on_update(sys::state& state) noexcept override {
32
33 if(state.current_crisis == sys::crisis_type::colonial) {
34 auto colonizers = state.world.state_definition_get_colonization(state.crisis_colony);
35 if(colonizers.begin() != colonizers.end()) {
36 auto attacking_colonizer = (*colonizers.begin()).get_colonizer();
37 show = attacking_colonizer != state.primary_crisis_attacker;
38 } else {
39 show = false;
40 }
41 } else if(state.current_crisis == sys::crisis_type::liberation) {
42 show = state.crisis_liberation_tag != state.world.nation_get_identity_from_identity_holder(state.primary_crisis_attacker);
43 }
44 }
45
46 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
47 if(show)
49 }
52 }
53 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
54 if(!show)
55 return mouse_probe{ nullptr, ui::xy_pair{} };
56 else
58 }
59 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
60 if(!show)
61 return;
62 flag_button::update_tooltip(state, x, y, contents);
63 }
64};
65
67 bool show = true;
68
69 void on_update(sys::state& state) noexcept override {
70 show = nations::is_involved_in_crisis(state, state.local_player_nation) && !nations::is_committed_in_crisis(state, state.local_player_nation);
71 disabled = !command::can_take_sides_in_crisis(state, state.local_player_nation, false);
72 }
73 void button_action(sys::state& state) noexcept override {
74 if(show)
75 command::take_sides_in_crisis(state, state.local_player_nation, false);
76 }
77
78 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
79 if(show)
81 }
82 tooltip_behavior has_tooltip(sys::state& state) noexcept override {
84 }
85 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
86 if(!show)
87 return mouse_probe{ nullptr, ui::xy_pair{} };
88 else
90 }
91 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
92 if(!show)
93 return;
94
95 text::add_line_with_condition(state, contents, "crisis_back_explain_2", state.current_crisis_mode == sys::crisis_mode::heating_up);
96
97 for(auto& i : state.crisis_participants) {
98 if(i.id == state.local_player_nation) {
99 text::add_line_with_condition(state, contents, "crisis_back_explain_1", i.merely_interested == true);
100 return;
101 }
102 if(!i.id) {
103 text::add_line_with_condition(state, contents, "crisis_back_explain_1", false);
104 return;
105 }
106 }
107 }
108};
109
111 bool show = true;
112
113 void on_update(sys::state& state) noexcept override {
114 show = nations::is_involved_in_crisis(state, state.local_player_nation) && !nations::is_committed_in_crisis(state, state.local_player_nation);
115 disabled = !command::can_take_sides_in_crisis(state, state.local_player_nation, true);
116 }
117 void button_action(sys::state& state) noexcept override {
118 if(show)
119 command::take_sides_in_crisis(state, state.local_player_nation, true);
120 }
121
122 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
123 if(show)
125 }
126 tooltip_behavior has_tooltip(sys::state& state) noexcept override {
128 }
129 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
130 if(!show)
131 return mouse_probe{ nullptr, ui::xy_pair{} };
132 else
134 }
135 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
136 if(!show)
137 return;
138
139 text::add_line_with_condition(state, contents, "crisis_back_explain_2", state.current_crisis_mode == sys::crisis_mode::heating_up);
140
141 for(auto& i : state.crisis_participants) {
142 if(i.id == state.local_player_nation) {
143 text::add_line_with_condition(state, contents, "crisis_back_explain_1", i.merely_interested == true);
144 return;
145 }
146 if(!i.id) {
147 text::add_line_with_condition(state, contents, "crisis_back_explain_1", false);
148 return;
149 }
150 }
151 }
152};
153
154
156 bool show = true;
157
158 void on_update(sys::state& state) noexcept override {
159 show = state.local_player_nation == state.primary_crisis_attacker;
160 }
161 void button_action(sys::state& state) noexcept override {
162 if(show)
164 }
165
166 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
167 if(show)
169 }
170 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
171 if(!show)
172 return mouse_probe{ nullptr, ui::xy_pair{} };
173 else
175 }
176};
177
179 bool show = true;
180
181 void on_update(sys::state& state) noexcept override {
182 show = state.local_player_nation == state.primary_crisis_defender;
183 }
184 void button_action(sys::state& state) noexcept override {
185 if(show)
187 }
188
189 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
190 if(show)
192 }
193 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
194 if(!show)
195 return mouse_probe{ nullptr, ui::xy_pair{} };
196 else
198 }
199};
200
202public:
203 void on_update(sys::state& state) noexcept override {
205 }
206};
207
209protected:
210 void populate_flags(sys::state& state) noexcept override {
211 row_contents.clear();
212 for(uint32_t i = 0; i < state.crisis_participants.size(); i++) {
213 if(!state.crisis_participants[i].id)
214 break;
215
216 if(state.crisis_participants[i].supports_attacker && !state.crisis_participants[i].merely_interested && state.crisis_participants[i].id != state.primary_crisis_attacker) {
217 auto content = dcon::fatten(state.world, state.crisis_participants[i].id);
218 row_contents.push_back(content.get_identity_from_identity_holder().id);
219 }
220 }
221 update(state);
222 }
223};
224
225class crisis_attacker_wargoals : public overlapping_listbox_element_base<overlapping_full_wg_icon, military::full_wg> {
226protected:
227 std::string_view get_row_element_name() override {
228 return "wargoal";
229 }
230
231public:
232 void on_update(sys::state& state) noexcept override {
233 row_contents.clear();
234
235 if(state.current_crisis == sys::crisis_type::colonial) {
236 auto colonizers = state.world.state_definition_get_colonization(state.crisis_colony);
237 if(colonizers.end() - colonizers.begin() >= 2) {
238 auto def_colonizer = (*(colonizers.begin() + 1)).get_colonizer();
239 auto attacking_colonizer = (*colonizers.begin()).get_colonizer();
240
242 attacking_colonizer,
243 def_colonizer,
244 dcon::nation_id{},
245 dcon::national_identity_id{},
246 state.crisis_colony,
247 state.military_definitions.crisis_colony
248 });
249 }
250 } else if(state.current_crisis == sys::crisis_type::liberation) {
252 state.primary_crisis_attacker,
253 state.world.state_instance_get_nation_from_state_ownership(state.crisis_state),
254 dcon::nation_id{},
255 state.crisis_liberation_tag,
256 state.world.state_instance_get_definition(state.crisis_state),
257 state.military_definitions.crisis_liberate
258 });
259 }
260
261 for(auto& par : state.crisis_participants) {
262 if(!par.id) {
263 break;
264 }
265 if(par.supports_attacker && par.joined_with_offer.wargoal_type) {
267 par.id,
268 par.joined_with_offer.target,
269 par.joined_with_offer.wargoal_secondary_nation,
270 par.joined_with_offer.wargoal_tag,
271 par.joined_with_offer.wargoal_state,
272 par.joined_with_offer.wargoal_type
273 });
274 }
275 }
276
277 update(state);
278
279 }
280};
281
283public:
284 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
285 if(name == "country_flag") {
286 return make_element_by_type<diplomacy_crisis_attacker_flag>(state, id);
287 } else if(name == "sponsored_flag") {
288 return make_element_by_type<diplomacy_crisis_sponsored_attacker_flag>(state, id);
289 } else if(name == "country_name") {
290 return make_element_by_type<diplomacy_crisis_attacker_name>(state, id);
291 } else if(name == "wargoals") {
292 return make_element_by_type<crisis_attacker_wargoals>(state, id);
293 } else if(name == "backers") {
294 auto ptr = make_element_by_type<diplomacy_crisis_attacker_backers>(state, id);
295 ptr->base_data.position.y -= 6;
296 return ptr;
297 } else if(name == "support_side") {
298 return make_element_by_type<support_attacker_button>(state, id);
299 } else if(name == "back_down") {
300 return make_element_by_type<propose_defender_solution_button>(state, id);
301 } else {
302 return nullptr;
303 }
304 }
305};
306
308public:
309 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
310 return state.world.nation_get_identity_from_identity_holder(state.primary_crisis_defender);
311 }
312};
313
315public:
316 bool show = false;
317
318 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
319 if(state.current_crisis == sys::crisis_type::colonial) {
320 auto colonizers = state.world.state_definition_get_colonization(state.crisis_colony);
321 if(colonizers.end() - colonizers.begin() >= 2) {
322 auto def_colonizer = (*(colonizers.begin() + 1)).get_colonizer();
323 return state.world.nation_get_identity_from_identity_holder(def_colonizer);
324 }
325 } else if(state.current_crisis == sys::crisis_type::liberation) {
326 return state.world.nation_get_identity_from_identity_holder(state.world.state_instance_get_nation_from_state_ownership(state.crisis_state));
327 }
328 return dcon::national_identity_id{};
329 }
330 void on_update(sys::state& state) noexcept override {
332
333 if(state.current_crisis == sys::crisis_type::colonial) {
334 auto colonizers = state.world.state_definition_get_colonization(state.crisis_colony);
335 if(colonizers.end() - colonizers.begin() >= 2) {
336 auto def_colonizer = (*(colonizers.begin() + 1)).get_colonizer();
337 show = def_colonizer != state.primary_crisis_defender;
338 } else {
339 show = false;
340 }
341 } else if(state.current_crisis == sys::crisis_type::liberation) {
342 show = state.world.state_instance_get_nation_from_state_ownership(state.crisis_state) != state.primary_crisis_defender;
343 }
344 }
345
346 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
347 if(show)
349 }
352 }
353 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
354 if(!show)
355 return mouse_probe{ nullptr, ui::xy_pair{} };
356 else
358 }
359 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
360 if(!show)
361 return;
362 flag_button::update_tooltip(state, x, y, contents);
363 }
364};
365
367public:
368 void on_update(sys::state& state) noexcept override {
370 }
371};
372
374protected:
375 void populate_flags(sys::state& state) noexcept override {
376 row_contents.clear();
377 for(uint32_t i = 0; i < state.crisis_participants.size(); i++) {
378 if(!state.crisis_participants[i].id)
379 break;
380
381 if(!state.crisis_participants[i].supports_attacker && !state.crisis_participants[i].merely_interested && state.crisis_participants[i].id != state.primary_crisis_defender) {
382 auto content = dcon::fatten(state.world, state.crisis_participants[i].id);
383 row_contents.push_back(content.get_identity_from_identity_holder().id);
384 }
385 }
386 update(state);
387 }
388};
389
390
391class crisis_defender_wargoals : public overlapping_listbox_element_base<overlapping_full_wg_icon, military::full_wg> {
392protected:
393 std::string_view get_row_element_name() override {
394 return "wargoal";
395 }
396
397public:
398 void on_update(sys::state& state) noexcept override {
399 row_contents.clear();
400
401 if(state.current_crisis == sys::crisis_type::colonial) {
402 auto colonizers = state.world.state_definition_get_colonization(state.crisis_colony);
403 if(colonizers.end() - colonizers.begin() >= 2) {
404 auto def_colonizer = (*(colonizers.begin() + 1)).get_colonizer();
405 auto attacking_colonizer = (*colonizers.begin()).get_colonizer();
406
408 def_colonizer,
409 attacking_colonizer,
410 dcon::nation_id{},
411 dcon::national_identity_id{},
412 state.crisis_colony,
413 state.military_definitions.crisis_colony
414 });
415 }
416 } else if(state.current_crisis == sys::crisis_type::liberation) {
417
418 }
419
420 for(auto& par : state.crisis_participants) {
421 if(!par.id) {
422 break;
423 }
424 if(!par.supports_attacker && par.joined_with_offer.wargoal_type) {
426 par.id,
427 par.joined_with_offer.target,
428 par.joined_with_offer.wargoal_secondary_nation,
429 par.joined_with_offer.wargoal_tag,
430 par.joined_with_offer.wargoal_state,
431 par.joined_with_offer.wargoal_type
432 });
433 }
434 }
435
436 update(state);
437
438 }
439};
440
442public:
443 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
444 if(name == "country_flag") {
445 return make_element_by_type<diplomacy_crisis_defender_flag>(state, id);
446 } else if(name == "sponsored_flag") {
447 return make_element_by_type<diplomacy_crisis_sponsored_defender_flag>(state, id);
448 } else if(name == "country_name") {
449 return make_element_by_type<diplomacy_crisis_defender_name>(state, id);
450 } else if(name == "wargoals") {
451 return make_element_by_type<crisis_defender_wargoals>(state, id);
452 } else if(name == "backers") {
453 auto ptr = make_element_by_type<diplomacy_crisis_defender_backers>(state, id);
454 ptr->base_data.position.y -= 6;
455 return ptr;
456 } else if(name == "support_side") {
457 return make_element_by_type<support_defender_button>(state, id);
458 } else if(name == "back_down") {
459 return make_element_by_type<propose_attacker_solution_button>(state, id);
460 } else {
461 return nullptr;
462 }
463 }
464};
465
467public:
468 void on_update(sys::state& state) noexcept override {
469 if(state.current_crisis == sys::crisis_type::colonial) {
471 } else if(state.current_crisis == sys::crisis_type::liberation) {
472 set_text(state, text::produce_simple_string(state, dcon::fatten(state.world, state.crisis_state).get_definition().get_name()));
473 } else {
474
475 }
476 }
477};
478
480public:
481 void on_update(sys::state& state) noexcept override {
482 switch(state.current_crisis) {
484 break;
486 //set_text(state, text::produce_simple_string(state, "crisis_description_reclaim"));
487 break;
489 {
492 if(state.world.nation_get_owned_province_count(state.world.national_identity_get_nation_from_identity_holder(state.crisis_liberation_tag)) > 0) {
493 set_text(state, text::resolve_string_substitution(state, "crisis_description_reclaim", m));
494 } else {
495 set_text(state, text::resolve_string_substitution(state, "crisis_description_liberation", m));
496 }
497 }
498 break;
500 set_text(state, text::produce_simple_string(state, "crisis_description_colonize"));
501 break;
503 //set_text(state, text::produce_simple_string(state, "crisis_description_influence"));
504 break;
505 default:
506 break;
507 };
508 }
509};
510
512public:
513 void on_update(sys::state& state) noexcept override {
514 progress = state.current_crisis_mode == sys::crisis_mode::heating_up ? state.crisis_temperature / 100.0f : 0.0f;
515 }
516
519 }
520 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
521 if(state.current_crisis_mode != sys::crisis_mode::heating_up)
522 return;
523 text::add_line(state, contents, "crisis_temperature_ex", text::variable_type::value, int64_t(state.crisis_temperature));
524 }
525};
526
528public:
529 void on_update(sys::state& state) noexcept override {
530 switch(state.current_crisis_mode) {
532 set_text(state, text::produce_simple_string(state, "crisis_mode_no_crisis"));
533 break;
535 set_text(state, text::produce_simple_string(state, "crisis_mode_finding_attacker"));
536 break;
538 set_text(state, text::produce_simple_string(state, "crisis_mode_finding_defender"));
539 break;
541 set_text(state, text::produce_simple_string(state, "crisis_mode_heating_up"));
542 break;
543 default:
544 break;
545 }
546 }
547};
548
550public:
551 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
552 auto n = retrieve<dcon::nation_id>(state, parent);
553 return state.world.nation_get_identity_from_identity_holder(n);
554 }
555};
556
558 dcon::nation_id to;
559};
560
562public:
563
564 void on_update(sys::state& state) noexcept override {
565 disabled = state.world.nation_get_diplomatic_points(state.local_player_nation) < 1.0f || (state.local_player_nation != state.primary_crisis_attacker && state.local_player_nation != state.primary_crisis_defender) || (state.current_crisis_mode != sys::crisis_mode::heating_up);
566 }
569 }
570 void button_action(sys::state& state) noexcept override {
571 auto n = retrieve<dcon::nation_id>(state, parent);
572 if(n)
574 }
575 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
576 text::add_line(state, contents, "crisis_offer_button");
578 text::add_line_with_condition(state, contents, "crisis_offer_button_ex_1", state.local_player_nation == state.primary_crisis_attacker || state.local_player_nation == state.primary_crisis_defender);
579 text::add_line_with_condition(state, contents, "crisis_offer_button_ex_2", state.current_crisis_mode == sys::crisis_mode::heating_up);
580 }
581};
582
584public:
585 void button_action(sys::state& state) noexcept override {
587 }
588 void on_update(sys::state& state) noexcept override {
589 disabled = !(state.world.nation_get_is_great_power(state.local_player_nation) && state.current_crisis_mode == sys::crisis_mode::heating_up);
590 }
593 }
594 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
595 text::add_line(state, contents, "crisis_add_interest_button");
597 text::add_line_with_condition(state, contents, "crisis_add_interest_button_ex_1", state.world.nation_get_is_great_power(state.local_player_nation));
598 text::add_line_with_condition(state, contents, "crisis_add_interest_button_ex_2", state.current_crisis_mode == sys::crisis_mode::heating_up);
599 text::add_line_with_condition(state, contents, "crisis_add_interest_button_ex_3", state.world.nation_get_diplomatic_points(state.local_player_nation) >= 1.0f);
600 }
601};
602
604public:
605 bool show = true;
606 int32_t index = 0;
607
608 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
609 if(name == "country_flag") {
610 return make_element_by_type<interested_flag>(state, id);
611 } else if(name == "make_offer") {
612 return make_element_by_type<make_offer_button>(state, id);
613 } else {
614 return nullptr;
615 }
616 }
617
618 message_result get(sys::state& state, Cyto::Any& payload) noexcept override {
619 if(payload.holds_type<dcon::nation_id>()) {
620 dcon::nation_id n;
621 int32_t count = 0;
622 for(auto& par: state.crisis_participants) {
623 if(!par.id)
624 break;
625 if(par.merely_interested) {
626 if(count == index) {
627 n = par.id;
628 break;
629 }
630 ++count;
631 }
632 }
633 payload.emplace<dcon::nation_id>(n);
635 }
637 }
638
639 void on_update(sys::state& state) noexcept override {
640 show = false;
641 int32_t count = 0;
642 for(auto& par : state.crisis_participants) {
643 if(!par.id)
644 break;
645 if(par.merely_interested) {
646 if(count == index) {
647 show = true;
648 break;
649 }
650 ++count;
651 }
652 }
653 }
654 void impl_render(sys::state& state, int32_t x, int32_t y) noexcept override {
655 if(show)
657 }
658 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
659 if(!show)
660 return mouse_probe{ nullptr, ui::xy_pair{} };
661 else
663 }
664};
665
667public:
668 bool show = true;
669
670 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
671 if(name == "join_button") {
672 return make_element_by_type<join_crisis_button>(state, id);
673 } else {
674 return nullptr;
675 }
676 }
677
678 void on_update(sys::state& state) noexcept override {
679 show = false;
680 if(!state.world.nation_get_is_great_power(state.local_player_nation))
681 return;
682 if(nations::is_involved_in_crisis(state, state.local_player_nation)) {
683 return;
684 }
685 show = true;
686 }
687 void impl_render(sys::state& state, int32_t x, int32_t y) noexcept override {
688 if(show)
690 }
691 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
692 if(!show)
693 return mouse_probe{ nullptr, ui::xy_pair{} };
694 else
696 }
697};
698
700public:
701 void on_create(sys::state& state) noexcept override {
703
704 {
705 auto ptr = make_element_by_type<diplomacy_crisis_interested_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("fence_sitter_entry"))->second.definition);
706 ptr->base_data.position.x = int16_t(0);
707 ptr->base_data.position.y = int16_t(0);
708 ptr->index = 0;
709 add_child_to_front(std::move(ptr));
710 }
711 {
712 auto ptr = make_element_by_type<diplomacy_crisis_interested_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("fence_sitter_entry"))->second.definition);
713 ptr->base_data.position.x = int16_t(70 * 1);
714 ptr->base_data.position.y = int16_t(0);
715 ptr->index = 1;
716 add_child_to_front(std::move(ptr));
717 }
718 {
719 auto ptr = make_element_by_type<diplomacy_crisis_interested_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("fence_sitter_entry"))->second.definition);
720 ptr->base_data.position.x = int16_t(70 * 2);
721 ptr->base_data.position.y = int16_t(0);
722 ptr->index = 2;
723 add_child_to_front(std::move(ptr));
724 }
725 {
726 auto ptr = make_element_by_type<diplomacy_crisis_interested_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("fence_sitter_entry"))->second.definition);
727 ptr->base_data.position.x = int16_t(0);
728 ptr->base_data.position.y = int16_t(75);
729 ptr->index = 3;
730 add_child_to_front(std::move(ptr));
731 }
732 {
733 auto ptr = make_element_by_type<diplomacy_crisis_interested_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("fence_sitter_entry"))->second.definition);
734 ptr->base_data.position.x = int16_t(70 * 1);
735 ptr->base_data.position.y = int16_t(75);
736 ptr->index = 4;
737 add_child_to_front(std::move(ptr));
738 }
739 {
740 auto ptr = make_element_by_type<diplomacy_crisis_interested_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("fence_sitter_entry"))->second.definition);
741 ptr->base_data.position.x = int16_t(70 * 2);
742 ptr->base_data.position.y = int16_t(75);
743 ptr->index = 5;
744 add_child_to_front(std::move(ptr));
745 }
746 {
747 auto ptr = make_element_by_type<diplomacy_crisis_join_container>(state, state.ui_state.defs_by_name.find(state.lookup_key("join_fence_sitter_entry"))->second.definition);
748 ptr->base_data.position.x = int16_t(70 * 2 - 3);
749 ptr->base_data.position.y = int16_t(58);
750 add_child_to_front(std::move(ptr));
751 }
752 }
753};
754
756public:
757 std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept override {
758 if(name == "crisis_title") {
759 return make_element_by_type<diplomacy_crisis_title_text>(state, id);
760 } else if(name == "crisis_sub_title") {
761 return make_element_by_type<diplomacy_crisis_subtitle_text>(state, id);
762 } else if(name == "crisis_temperature") {
763 return make_element_by_type<diplomacy_crisis_temperature_bar>(state, id);
764 } else if(name == "crisis_status_label") {
765 return make_element_by_type<diplomacy_crisis_status_text>(state, id);
766 } else if(name == "attacker_win") {
767 return make_element_by_type<diplomacy_crisis_attacker_window>(state, id);
768 } else if(name == "defender_win") {
769 return make_element_by_type<diplomacy_crisis_defender_window>(state, id);
770 } else if(name == "fence_sitters_win") {
771 return make_element_by_type< diplomacy_crisis_interested_window>(state, id);
772 } else {
773 return nullptr;
774 }
775 }
776};
777
778} // namespace ui
dcon::text_key get_name() noexcept
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void populate_flags(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
void populate_flags(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
element_base * parent
virtual void impl_render(sys::state &state, int32_t x, int32_t y) noexcept
virtual mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void button_action(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
bool can_take_sides_in_crisis(sys::state &state, dcon::nation_id source, bool join_attacker)
Definition: commands.cpp:1953
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
bool is_committed_in_crisis(sys::state const &state, dcon::nation_id n)
Definition: nations.cpp:1080
bool is_involved_in_crisis(sys::state const &state, dcon::nation_id n)
Definition: nations.cpp:1066
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
Definition: text.cpp:2113
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
Definition: text.cpp:1899
void add_line_with_condition(sys::state &state, layout_base &dest, std::string_view key, bool condition_met, int32_t indent)
Definition: text.cpp:1955
void add_line_break_to_layout(sys::state &state, columnar_layout &dest)
Definition: text.cpp:1152
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
Definition: text.cpp:1068
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
Definition: text.hpp:794
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
Definition: text.cpp:617
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
Definition: text.cpp:880
tooltip_behavior
void send(sys::state &state, element_base *parent, T value)
@ count
Definition: gui_event.hpp:126
message_result
uint uint32_t
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name