#include "core/CoreIncludes.h" #include "core/LuaState.h" #include "core/GUIManager.h" #include "core/class/Identifier.h" #include "core/singleton/ScopedSingletonIncludes.h" #include "network/Host.h" #include "network/NetworkFunctionIncludes.h" #include "DialogueManager.h" #include #include #include "core/XMLPort.h" #include "NextQuestion.h" namespace orxonox { ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false); //DialogueManager* DialogueManager::singletonPtr_s =nullptr; DialogueManager::DialogueManager(){ orxout() << "Dialog Konstruktor" << endl; //RegisterObject(DialogueManager); } /** * @brief set the config values in the orxonox.ini file */ void DialogueManager::registerquestion(NextQuestion* nq){ if(allQuestions.size()==0) { orxout(internal_info) << "At least one NextQuestion has to be set." << endl; } else { currentQuestion = allQuestions[0]; } allQuestions.push_back(nq); orxout(internal_info) << "qsize " << allQuestions.size(); } void DialogueManager::setquestion(std::string q){ question=q; } void DialogueManager::setCurrentQuestion(NextQuestion* nq){ currentQuestion=nq; } std::string DialogueManager::getquestion(void){ orxout() << question << endl; return question; } void DialogueManager::setanswers1(std::string a1){ orxout() << "setanswers1" << endl; this->a1=a1; orxout() << "A1 is " << a1; } void DialogueManager::setanswers2(std::string a2){ this->a2=a2; } std::string DialogueManager::getanswers1(void){ orxout() << "getanswers1" << endl; return a1; } std::string DialogueManager::getanswers2(void){ return a2; } void DialogueManager::a1clicked(void){ currentQuestion = currentQuestion->possibleQuestions[0]; update(currentQuestion); } void DialogueManager::a2clicked(void){ orxout() << "a2 clicked" << endl; currentQuestion = currentQuestion->possibleQuestions[1]; update(currentQuestion); } void DialogueManager::update(NextQuestion* nq){ this->setquestion(nq->getquestion()); this->setanswers1(nq->getanswers1()); this->setanswers2(nq->getanswers2()); depth=depth+1; } void DialogueManager::clean(){ orxout() <<" depth " << depth << endl; //allQuestions.at(2*depth+1); } bool DialogueManager::theEnd(){ if((currentQuestion->possibleQuestions).empty()) { orxout() << "endtrue" << endl; return true;} else return false; } /* vector DialogueManager::getanswers(void){ return options; } int DialogueManager::getnumOptions(){ return options.size(); } */ }