Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
orxonox::DialogManager Class Reference

this class is used for calling on a dialog form luascript More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/modules/dialog/DialogManager.h>

Inheritance diagram for orxonox::DialogManager:
orxonox::Singleton< DialogManager >

Public Member Functions

 DialogManager ()
 
bool endtest (int index)
 tests the dialog if there are any followup npc textoptions to the given answer or if there are no answers to the current question More...
 
std::string getAnswer (int index)
 returns the answer to the id that is at index in the array of answers More...
 
std::string getPerson ()
 gives name of npc the player is currently talking to More...
 
std::string getQuestion ()
 gives the string of the momentary npc textoption More...
 
int getSize ()
 function that returns size of answerid array More...
 
void setDialog (Dialog *dialog)
 allows to set the current dialog More...
 
void update (int index)
 tells the dialog to update according to a given answer, if no answer is actively clicked the standard index is sett 0 in the lua when called the current question of the dialog is set to the new one and the answerId vector is set accordingly More...
 

Static Public Member Functions

static DialogManagergetInstance ()
 gives the pointer to the sigleton dialog manager to the lua script More...
 
- Static Public Member Functions inherited from orxonox::Singleton< DialogManager >
static bool exists ()
 Tells whether the singleton has been created. More...
 
static DialogManagergetInstance ()
 Returns a reference to the singleton instance. More...
 

Private Attributes

const std::vector< std::string > * answerIds_
 pointer to the possible answerIds of the current question, for faster access More...
 
DialogcurrentTalk_
 pointer to the currently active dialog or last active if no one is currently active More...
 

Static Private Attributes

static DialogManagersingletonPtr_s
 a pointer to the single class object More...
 

Friends

class Singleton< DialogManager >
 

Additional Inherited Members

- Protected Member Functions inherited from orxonox::Singleton< DialogManager >
 Singleton ()
 Constructor sets the singleton instance pointer. More...
 
virtual ~Singleton ()
 Destructor resets the singleton instance pointer. More...
 

Detailed Description

this class is used for calling on a dialog form luascript

the class is the interface of dialog to lua, all lua functionallity is given by this class, it can be found by lua due to singleton definition

Todo:
reseting or setting new start for dialog on exit, to allow coming back to a npc picture of person parameters to differ dialog depending on some world values, like items, completed objectives etc...

Constructor & Destructor Documentation

orxonox::DialogManager::DialogManager ( )

Member Function Documentation

bool orxonox::DialogManager::endtest ( int  index)

tests the dialog if there are any followup npc textoptions to the given answer or if there are no answers to the current question

Returns
true if the answer array of the question is empty or the next question id of the answer does not exist
std::string orxonox::DialogManager::getAnswer ( int  index)

returns the answer to the id that is at index in the array of answers

Parameters
param1index of desired answer
Returns
string of answer
static DialogManager& orxonox::DialogManager::getInstance ( )
inlinestatic

gives the pointer to the sigleton dialog manager to the lua script

Returns
returns pointer
std::string orxonox::DialogManager::getPerson ( )

gives name of npc the player is currently talking to

Returns
sting with name
std::string orxonox::DialogManager::getQuestion ( )

gives the string of the momentary npc textoption

Returns
string of npc text
int orxonox::DialogManager::getSize ( void  )

function that returns size of answerid array

Returns
returns number of possible answers to momentary questions, 0 if there are no player text options
void orxonox::DialogManager::setDialog ( Dialog dialog)

allows to set the current dialog

this is used by a dialog when triggered to set its self to the current dialog

Parameters
dialogpointer to the dialog that wants to be current one
void orxonox::DialogManager::update ( int  index)

tells the dialog to update according to a given answer, if no answer is actively clicked the standard index is sett 0 in the lua when called the current question of the dialog is set to the new one and the answerId vector is set accordingly

Parameters
param1index of the answer given by the player

Friends And Related Function Documentation

friend class Singleton< DialogManager >
friend

Member Data Documentation

const std::vector<std::string>* orxonox::DialogManager::answerIds_
private

pointer to the possible answerIds of the current question, for faster access

Dialog* orxonox::DialogManager::currentTalk_
private

pointer to the currently active dialog or last active if no one is currently active

DialogManager* orxonox::DialogManager::singletonPtr_s
staticprivate

a pointer to the single class object


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