|
Player12
An open source football management simulator
|
Substitutions dialog of the live match. More...
#include <match_subs_panel.h>
Classes | |
| struct | PitchMarker |
Public Member Functions | |
| bool | render (const TouchlineContext &context) |
| Draws the dialog while it is shown. | |
| void | update (const TouchlineContext &context) |
| Makes the confirmed plan once play stops (every frame). | |
| void | resetPopup () |
| Next render() opens the popup again (after it was hidden). | |
| void | requestClose () |
| Closes the dialog on its next frame. | |
| void | resetSelection () |
| Clears the selection and the dialog's own messages. | |
| bool | plan (const TouchlineContext &context, PlayerID out, PlayerID in) |
Plans out -> in; the change is refused (with the reason in the HUD status) when the rules or the plan do not allow it. | |
| bool | substituteNow (const TouchlineContext &context, PlayerID out, PlayerID in) |
| Makes one change right away (play stops for it, as the engine rules); false with the reason in the HUD status when refused. | |
| void | confirm (const TouchlineContext &context) |
| Confirms the plan: made at once when play is stopped, otherwise at the next stoppage. | |
| bool | swapPositions (const TouchlineContext &context, PlayerID first, PlayerID second) |
| Swaps the formation slots of two players on the pitch. | |
| const MatchChanges::SubstitutionPlan & | getPlan () const |
| MatchChanges::SubstitutionPlan & | getPlan () |
Public Attributes | |
| PlayerID | selected_out = 0 |
| PlayerID | selected_in = 0 |
Static Public Attributes | |
| static constexpr const char * | WINDOW_ID = "###match_substitutions_modal" |
Private Member Functions | |
| void | collectMarkers (const TouchlineContext &context) |
| void | renderUsage (const TouchlineContext &context) const |
| void | renderPitch (const TouchlineContext &context, float width) |
| void | renderBench (const TouchlineContext &context, const Lineup &lineup, float width) |
| void | renderPlan (const TouchlineContext &context, const Lineup &lineup) |
| void | renderSuggestions (const TouchlineContext &context, const Lineup &lineup) |
| void | renderFooter (const TouchlineContext &context) |
| void | report (const TouchlineContext &context, const Lineup &lineup, const std::vector< MatchChanges::SubstitutionOutcome > &outcomes) const |
| void | selectionChanged (const TouchlineContext &context) |
Private Attributes | |
| MatchChanges::SubstitutionPlan | substitution_plan |
| std::vector< PitchMarker > | markers |
| std::vector< MatchChanges::Suggestion > | suggestions |
| std::uint64_t | suggestions_key = UINT64_MAX |
| std::size_t | suggestions_changes = 0 |
| bool | popup_opened = false |
| bool | close_requested = false |
| bool | swap_mode = false |
Substitutions dialog of the live match.
The eleven stand on a small pitch in their formation slots with their condition, cards and rating; the bench lists fitness, rating and how well each substitute suits the selected position. Dragging a substitute onto a player (or clicking one then the other) plans a change; several planned changes are made together at the next stoppage, so they use one window. Dragging one player onto another swaps their positions at once. The assistant proposes changes that can be added with one click.
|
private |
| void MatchSubsPanel::confirm | ( | const TouchlineContext & | context | ) |
Confirms the plan: made at once when play is stopped, otherwise at the next stoppage.
|
inline |
|
inline |
| bool MatchSubsPanel::plan | ( | const TouchlineContext & | context, |
| PlayerID | out, | ||
| PlayerID | in | ||
| ) |
Plans out -> in; the change is refused (with the reason in the HUD status) when the rules or the plan do not allow it.
| bool MatchSubsPanel::render | ( | const TouchlineContext & | context | ) |
Draws the dialog while it is shown.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Applies the outcomes of made changes to the HUD status.
|
inline |
Closes the dialog on its next frame.
|
inline |
Next render() opens the popup again (after it was hidden).
| void MatchSubsPanel::resetSelection | ( | ) |
Clears the selection and the dialog's own messages.
|
private |
Selection changed: plans the change once both players are chosen.
| bool MatchSubsPanel::substituteNow | ( | const TouchlineContext & | context, |
| PlayerID | out, | ||
| PlayerID | in | ||
| ) |
Makes one change right away (play stops for it, as the engine rules); false with the reason in the HUD status when refused.
| bool MatchSubsPanel::swapPositions | ( | const TouchlineContext & | context, |
| PlayerID | first, | ||
| PlayerID | second | ||
| ) |
Swaps the formation slots of two players on the pitch.
| void MatchSubsPanel::update | ( | const TouchlineContext & | context | ) |
Makes the confirmed plan once play stops (every frame).
|
private |
|
private |
|
private |
| PlayerID MatchSubsPanel::selected_in = 0 |
|
private |
|
private |
The assistant's proposals and when they were last worked out.
|
private |
|
private |
|
private |
The next pitch click swaps with the selected player.
|
staticconstexpr |
Window id kept stable for tests and for the Escape handling.