/* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: * ... * Co-authors: * ... * */ #ifndef _DialogManager_H__ #define _DialogManager_H__ #include "DialogPrereqs.h" #include "util/Singleton.h" #include "core/singleton/ScopedSingletonIncludes.h" #include "core/object/Listable.h" #include "Dialog.h" #include namespace orxonox //tolua_export {//tolua_export /** @brief 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... */ class _DialogExport DialogManager //tolua_export : public Singleton {//tolua_export friend class Singleton; public: DialogManager(); /** @brief gives the pointer to the sigleton dialog manager to the lua script @return returns pointer */ static DialogManager& getInstance() { return Singleton::getInstance(); } //tolua_export /** @brief allows to set the current dialog this is used by a dialog when triggered to set its self to the current dialog @param dialog pointer to the dialog that wants to be current one */ void setDialog(Dialog* dialog); //from here on functions for lua interface /** @brief gives the string of the momentary npc textoption @return string of npc text */ std::string getQuestion(); //tolua_export /** @brief function that returns size of answerid array @return returns number of possible answers to momentary questions, 0 if there are no player text options */ int getSize(); //tolua_export /** @brief returns the answer to the id that is at index in the array of answers @param param1 index of desired answer @return string of answer */ std::string getAnswer(int index); //tolua_export /** @brief gives name of npc the player is currently talking to @return sting with name */ std::string getPerson(); //tolua_export /** @brief tests the dialog if there are any followup npc textoptions to the given answer or if there are no answers to the current question @return true if the answer array of the question is empty or the next question id of the answer does not exist */ bool endtest(int index); //tolua_export /** @brief 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 @param param1 index of the answer given by the player */ void update(int index); //tolua_export private: static DialogManager* singletonPtr_s; //!< a pointer to the single class object Dialog* currentTalk_; //!< pointer to the currently active dialog or last active if no one is currently active const std::vector* answerIds_; //!< pointer to the possible answerIds of the current question, for faster access };//tolua_export }//tolua_export #endif /* _DialogManager_H__ */