Player12
An open source football management simulator
Loading...
Searching...
No Matches
OfferNegotiationDialog Class Reference

Modal talks over an AI club's bid for one of the managed players, or its offer to borrow him. More...

#include <offer_negotiation_dialog.h>

Classes

struct  Line
 
struct  RoundLine
 

Public Member Functions

void open (GameController &controller, std::uint32_t offer_id)
 
bool render (GameController &controller)
 
bool isOpen () const
 

Private Types

enum class  Mode : int { Counter = 0 , NamePrice = 1 }
 

Private Member Functions

void rebuild (const GameController &controller)
 
void refreshCounterTexts ()
 
void rebuildTransferLines ()
 
void rebuildLoanLines ()
 
void renderHeader () const
 
void renderBid () const
 
void renderHistory () const
 
void renderAnswer ()
 
void renderActions (GameController &controller)
 
void renderResult () const
 
void accept (GameController &controller)
 
void reject (GameController &controller)
 
void notForSale (GameController &controller)
 
void submit (GameController &controller)
 
void finish (std::string_view headline, const ImVec4 &color, std::string_view detail)
 

Private Attributes

std::uint32_t offer_id = 0
 
bool open_requested = false
 
bool visible = false
 
bool changed = false
 
std::optional< GameController::IncomingOfferView > view
 
std::string title
 
std::string subtitle
 
std::string stance_text
 
ImVec4 stance_color {}
 
std::vector< Line > facts
 
std::vector< Line > bid_lines
 
std::string bid_total
 
std::vector< RoundLine > rounds
 
std::string status_text
 
ImVec4 status_color {}
 
std::string proposal_text
 
std::vector< UI::MoneyChip > counter_chips
 
std::array< UI::MoneyChip, 4 > price_chips {}
 
Mode mode = Mode::Counter
 
TransferNegotiation::OfferTerms counter
 
TransferNegotiation::LoanTerms loan_counter
 
std::int64_t price = 0
 
std::string counter_upfront_text
 
std::string counter_worth_text
 
std::string loan_wage_text
 
std::string loan_saving_text
 
std::string notice
 
ImVec4 notice_color {}
 
bool finished = false
 
std::string result_headline
 
ImVec4 result_color {}
 
std::string result_detail
 

Friends

class GameFlowTest_GUIFlowLifecycle_Test
 

Detailed Description

Modal talks over an AI club's bid for one of the managed players, or its offer to borrow him.

Self-contained like PlayerTalkDialog: the inbox and the transfer market each keep one, call open() from a button and render() every frame. It shows the buyer, the player (value, asking price, contract, how he feels about the move), the bid on the table broken down (fee, upfront part, instalments, add-ons, sell-on) and every round so far. The club accepts, rejects, counters with a full structure, names its price or declares the player not for sale; the buyer's answer arrives on a later day (the same day near the deadline). A loan offer shows the loan terms instead and is countered with wage share, length, purchase option or obligation, recall clause and guaranteed appearances.

Text is built when the dialog opens and after each action, never per frame; only the terms editor runs every frame.

Member Enumeration Documentation

◆ Mode

enum class OfferNegotiationDialog::Mode : int
strongprivate
Enumerator
Counter 
NamePrice 

Member Function Documentation

◆ accept()

void OfferNegotiationDialog::accept ( GameController &  controller)
private

◆ finish()

void OfferNegotiationDialog::finish ( std::string_view  headline,
const ImVec4 &  color,
std::string_view  detail 
)
private

Shows the end of the talks.

◆ isOpen()

bool OfferNegotiationDialog::isOpen ( ) const
inline

◆ notForSale()

void OfferNegotiationDialog::notForSale ( GameController &  controller)
private

◆ open()

void OfferNegotiationDialog::open ( GameController &  controller,
std::uint32_t  offer_id 
)

Opens the talks over offer_id (shown from the next render()).

◆ rebuild()

void OfferNegotiationDialog::rebuild ( const GameController &  controller)
private

◆ rebuildLoanLines()

void OfferNegotiationDialog::rebuildLoanLines ( )
private

◆ rebuildTransferLines()

void OfferNegotiationDialog::rebuildTransferLines ( )
private

The offer on the table, line by line.

◆ refreshCounterTexts()

void OfferNegotiationDialog::refreshCounterTexts ( )
private

Upfront and present-value texts of the counter being prepared.

◆ reject()

void OfferNegotiationDialog::reject ( GameController &  controller)
private

◆ render()

bool OfferNegotiationDialog::render ( GameController &  controller)

Draws the dialog while open.

Returns
True on the frame an action changed the talks (refresh views).

◆ renderActions()

void OfferNegotiationDialog::renderActions ( GameController &  controller)
private

◆ renderAnswer()

void OfferNegotiationDialog::renderAnswer ( )
private

◆ renderBid()

void OfferNegotiationDialog::renderBid ( ) const
private

◆ renderHeader()

void OfferNegotiationDialog::renderHeader ( ) const
private

◆ renderHistory()

void OfferNegotiationDialog::renderHistory ( ) const
private

◆ renderResult()

void OfferNegotiationDialog::renderResult ( ) const
private

◆ submit()

void OfferNegotiationDialog::submit ( GameController &  controller)
private

Friends And Related Symbol Documentation

◆ GameFlowTest_GUIFlowLifecycle_Test

friend class GameFlowTest_GUIFlowLifecycle_Test
friend

Member Data Documentation

◆ bid_lines

std::vector<Line> OfferNegotiationDialog::bid_lines
private

◆ bid_total

std::string OfferNegotiationDialog::bid_total
private

◆ changed

bool OfferNegotiationDialog::changed = false
private

◆ counter

TransferNegotiation::OfferTerms OfferNegotiationDialog::counter
private

◆ counter_chips

std::vector<UI::MoneyChip> OfferNegotiationDialog::counter_chips
private

◆ counter_upfront_text

std::string OfferNegotiationDialog::counter_upfront_text
private

◆ counter_worth_text

std::string OfferNegotiationDialog::counter_worth_text
private

◆ facts

std::vector<Line> OfferNegotiationDialog::facts
private

◆ finished

bool OfferNegotiationDialog::finished = false
private

◆ loan_counter

TransferNegotiation::LoanTerms OfferNegotiationDialog::loan_counter
private

◆ loan_saving_text

std::string OfferNegotiationDialog::loan_saving_text
private

Wages saved over the loan.

◆ loan_wage_text

std::string OfferNegotiationDialog::loan_wage_text
private

The borrower's weekly share.

◆ mode

Mode OfferNegotiationDialog::mode = Mode::Counter
private

◆ notice

std::string OfferNegotiationDialog::notice
private

Result of the last action while still open.

◆ notice_color

ImVec4 OfferNegotiationDialog::notice_color {}
private

◆ offer_id

std::uint32_t OfferNegotiationDialog::offer_id = 0
private

◆ open_requested

bool OfferNegotiationDialog::open_requested = false
private

◆ price

std::int64_t OfferNegotiationDialog::price = 0
private

◆ price_chips

std::array<UI::MoneyChip, 4> OfferNegotiationDialog::price_chips {}
private

◆ proposal_text

std::string OfferNegotiationDialog::proposal_text
private

The pending counter, while awaited.

◆ result_color

ImVec4 OfferNegotiationDialog::result_color {}
private

◆ result_detail

std::string OfferNegotiationDialog::result_detail
private

◆ result_headline

std::string OfferNegotiationDialog::result_headline
private

◆ rounds

std::vector<RoundLine> OfferNegotiationDialog::rounds
private

◆ stance_color

ImVec4 OfferNegotiationDialog::stance_color {}
private

◆ stance_text

std::string OfferNegotiationDialog::stance_text
private

◆ status_color

ImVec4 OfferNegotiationDialog::status_color {}
private

◆ status_text

std::string OfferNegotiationDialog::status_text
private

Awaiting reply, final offer, window.

◆ subtitle

std::string OfferNegotiationDialog::subtitle
private

◆ title

std::string OfferNegotiationDialog::title
private

◆ view

std::optional<GameController::IncomingOfferView> OfferNegotiationDialog::view
private

◆ visible

bool OfferNegotiationDialog::visible = false
private

The documentation for this class was generated from the following files: