[11371] | 1 | #include "core/CoreIncludes.h" |
---|
| 2 | #include "core/LuaState.h" |
---|
| 3 | #include "core/GUIManager.h" |
---|
| 4 | #include "core/class/Identifier.h" |
---|
| 5 | #include "core/singleton/ScopedSingletonIncludes.h" |
---|
| 6 | #include "network/Host.h" |
---|
| 7 | #include "network/NetworkFunctionIncludes.h" |
---|
[11417] | 8 | #include "DialogueManager.h" |
---|
[11382] | 9 | #include <vector> |
---|
| 10 | #include <string> |
---|
[11393] | 11 | #include "core/XMLPort.h" |
---|
[11415] | 12 | #include "NextQuestion.h" |
---|
[11371] | 13 | |
---|
[11393] | 14 | |
---|
[11417] | 15 | |
---|
[11371] | 16 | namespace orxonox { |
---|
[11415] | 17 | ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false); |
---|
| 18 | |
---|
[11371] | 19 | |
---|
[11435] | 20 | |
---|
| 21 | DialogueManager::DialogueManager(){} |
---|
| 22 | |
---|
[11393] | 23 | |
---|
[11382] | 24 | |
---|
[11393] | 25 | |
---|
[11371] | 26 | |
---|
[11417] | 27 | void DialogueManager::registerquestion(NextQuestion* nq){ |
---|
[11421] | 28 | if(allQuestions.size()==0) { |
---|
| 29 | orxout(internal_info) << "At least one NextQuestion has to be set." << endl; |
---|
[11435] | 30 | } |
---|
[11417] | 31 | allQuestions.push_back(nq); |
---|
[11421] | 32 | orxout(internal_info) << "qsize " << allQuestions.size(); |
---|
[11417] | 33 | |
---|
| 34 | } |
---|
| 35 | |
---|
[11406] | 36 | void DialogueManager::setquestion(std::string q){ |
---|
| 37 | question=q; |
---|
[11413] | 38 | |
---|
[11377] | 39 | } |
---|
[11432] | 40 | void DialogueManager::setCurrentQuestion(NextQuestion* nq){ |
---|
| 41 | currentQuestion=nq; |
---|
| 42 | |
---|
| 43 | } |
---|
[11377] | 44 | |
---|
[11384] | 45 | std::string DialogueManager::getquestion(void){ |
---|
[11382] | 46 | return question; |
---|
[11377] | 47 | } |
---|
[11435] | 48 | |
---|
[11413] | 49 | void DialogueManager::setanswers1(std::string a1){ |
---|
| 50 | this->a1=a1; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | void DialogueManager::setanswers2(std::string a2){ |
---|
| 54 | this->a2=a2; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | std::string DialogueManager::getanswers1(void){ |
---|
| 60 | return a1; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | std::string DialogueManager::getanswers2(void){ |
---|
| 64 | return a2; |
---|
| 65 | } |
---|
[11435] | 66 | |
---|
[11421] | 67 | void DialogueManager::a1clicked(void){ |
---|
| 68 | |
---|
[11417] | 69 | currentQuestion = currentQuestion->possibleQuestions[0]; |
---|
[11421] | 70 | update(currentQuestion); |
---|
| 71 | |
---|
| 72 | |
---|
[11413] | 73 | } |
---|
[11421] | 74 | void DialogueManager::a2clicked(void){ |
---|
[11435] | 75 | |
---|
[11428] | 76 | currentQuestion = currentQuestion->possibleQuestions[1]; |
---|
| 77 | update(currentQuestion); |
---|
[11435] | 78 | } |
---|
[11428] | 79 | |
---|
[11421] | 80 | void DialogueManager::update(NextQuestion* nq){ |
---|
| 81 | this->setquestion(nq->getquestion()); |
---|
| 82 | this->setanswers1(nq->getanswers1()); |
---|
| 83 | this->setanswers2(nq->getanswers2()); |
---|
| 84 | } |
---|
[11435] | 85 | |
---|
[11428] | 86 | bool DialogueManager::theEnd(){ |
---|
| 87 | if((currentQuestion->possibleQuestions).empty()) { |
---|
| 88 | return true;} |
---|
| 89 | else return false; |
---|
| 90 | } |
---|
[11393] | 91 | |
---|
[11371] | 92 | } |
---|