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

Modal one-to-one conversation with a managed player. More...

#include <player_talk_dialog.h>

Classes

struct  OptionRow
 
struct  PromiseLine
 
struct  Section
 

Public Member Functions

void open (GameController &controller, PlayerID player_id)
 
bool render (GameController &controller)
 
void inboxAction (GameController &controller, const InboxMessage &message)
 
bool isOpen () const
 

Private Member Functions

void rebuild (const GameController &controller)
 
void renderHeader () const
 
void renderOptions (GameController &controller)
 
void renderResult () const
 
void choose (GameController &controller, TalkOption option)
 

Private Attributes

PlayerID player_id = 0
 
bool open_requested = false
 
bool visible = false
 
bool has_result = false
 
std::string title
 
std::string subtitle
 
std::string morale_text
 
std::string trust_text
 
float morale = 0.0f
 
float trust = 0.0f
 
std::string request_text
 
std::string story_text
 
std::vector< PromiseLine > promises
 
std::vector< Section > sections
 
std::string reaction_text
 
ImVec4 reaction_color
 
std::string reply_text
 
std::vector< std::string > consequences
 

Detailed Description

Modal one-to-one conversation with a managed player.

Self-contained: a scene keeps one instance, calls open() from a button and render() every frame (inside its ImGui window). The dialog lists the conversation lines grouped by topic with the predicted reaction, cooldowns and why a line is unavailable, the player's open request and his promises with progress; after a line it shows his reply and what changed. One line per conversation: talks are meant to be rare and to matter.

All text is built when the dialog opens or a line is held, never per frame.

Member Function Documentation

◆ choose()

void PlayerTalkDialog::choose ( GameController &  controller,
TalkOption  option 
)
private

◆ inboxAction()

void PlayerTalkDialog::inboxAction ( GameController &  controller,
const InboxMessage &  message 
)

Inbox helper: a "Reply" button for messages from a player who waits for an answer (request or story); opens the dialog when clicked.

◆ isOpen()

bool PlayerTalkDialog::isOpen ( ) const
inline

◆ open()

void PlayerTalkDialog::open ( GameController &  controller,
PlayerID  player_id 
)

Opens the conversation (shown from the next render()).

◆ rebuild()

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

◆ render()

bool PlayerTalkDialog::render ( GameController &  controller)

Draws the dialog while open.

Returns
True on the frame a conversation line was held (refresh views).

◆ renderHeader()

void PlayerTalkDialog::renderHeader ( ) const
private

◆ renderOptions()

void PlayerTalkDialog::renderOptions ( GameController &  controller)
private

◆ renderResult()

void PlayerTalkDialog::renderResult ( ) const
private

Member Data Documentation

◆ consequences

std::vector<std::string> PlayerTalkDialog::consequences
private

◆ has_result

bool PlayerTalkDialog::has_result = false
private

◆ morale

float PlayerTalkDialog::morale = 0.0f
private

◆ morale_text

std::string PlayerTalkDialog::morale_text
private

◆ open_requested

bool PlayerTalkDialog::open_requested = false
private

◆ player_id

PlayerID PlayerTalkDialog::player_id = 0
private

◆ promises

std::vector<PromiseLine> PlayerTalkDialog::promises
private

◆ reaction_color

ImVec4 PlayerTalkDialog::reaction_color
private

◆ reaction_text

std::string PlayerTalkDialog::reaction_text
private

◆ reply_text

std::string PlayerTalkDialog::reply_text
private

◆ request_text

std::string PlayerTalkDialog::request_text
private

◆ sections

std::vector<Section> PlayerTalkDialog::sections
private

◆ story_text

std::string PlayerTalkDialog::story_text
private

◆ subtitle

std::string PlayerTalkDialog::subtitle
private

◆ title

std::string PlayerTalkDialog::title
private

◆ trust

float PlayerTalkDialog::trust = 0.0f
private

◆ trust_text

std::string PlayerTalkDialog::trust_text
private

◆ visible

bool PlayerTalkDialog::visible = false
private

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