[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 | |
---|
[11415] | 20 | //DialogueManager* DialogueManager::singletonPtr_s =nullptr; |
---|
[11393] | 21 | |
---|
[11415] | 22 | DialogueManager::DialogueManager(){ |
---|
[11406] | 23 | orxout() << "Dialog Konstruktor" << endl; |
---|
[11415] | 24 | //RegisterObject(DialogueManager); |
---|
[11393] | 25 | |
---|
[11371] | 26 | } |
---|
[11382] | 27 | |
---|
[11393] | 28 | |
---|
[11384] | 29 | /** |
---|
| 30 | * @brief set the config values in the orxonox.ini file |
---|
| 31 | */ |
---|
[11393] | 32 | |
---|
[11371] | 33 | |
---|
[11417] | 34 | void DialogueManager::registerquestion(NextQuestion* nq){ |
---|
[11421] | 35 | if(allQuestions.size()==0) { |
---|
| 36 | orxout(internal_info) << "At least one NextQuestion has to be set." << endl; |
---|
| 37 | } else { |
---|
| 38 | currentQuestion = allQuestions[0]; |
---|
| 39 | } |
---|
[11417] | 40 | allQuestions.push_back(nq); |
---|
[11421] | 41 | orxout(internal_info) << "qsize " << allQuestions.size(); |
---|
[11417] | 42 | |
---|
| 43 | } |
---|
| 44 | |
---|
[11406] | 45 | void DialogueManager::setquestion(std::string q){ |
---|
| 46 | question=q; |
---|
[11413] | 47 | |
---|
[11377] | 48 | } |
---|
| 49 | |
---|
[11384] | 50 | std::string DialogueManager::getquestion(void){ |
---|
[11406] | 51 | orxout() << question << endl; |
---|
[11382] | 52 | return question; |
---|
[11377] | 53 | } |
---|
[11413] | 54 | void DialogueManager::setanswers1(std::string a1){ |
---|
| 55 | orxout() << "setanswers1" << endl; |
---|
| 56 | this->a1=a1; |
---|
| 57 | orxout() << "A1 is " << a1; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | void DialogueManager::setanswers2(std::string a2){ |
---|
| 61 | this->a2=a2; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | std::string DialogueManager::getanswers1(void){ |
---|
| 67 | orxout() << "getanswers1" << endl; |
---|
| 68 | return a1; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | std::string DialogueManager::getanswers2(void){ |
---|
| 72 | return a2; |
---|
| 73 | } |
---|
[11421] | 74 | void DialogueManager::a1clicked(void){ |
---|
| 75 | |
---|
| 76 | assert((currentQuestion->retposQues())[0]); |
---|
| 77 | orxout() << "a14 clicked" << endl; |
---|
| 78 | orxout() << currentQuestion->possibleQuestions[0] << endl; |
---|
[11417] | 79 | currentQuestion = currentQuestion->possibleQuestions[0]; |
---|
[11421] | 80 | update(currentQuestion); |
---|
| 81 | |
---|
| 82 | |
---|
[11413] | 83 | } |
---|
[11421] | 84 | void DialogueManager::a2clicked(void){ |
---|
[11413] | 85 | orxout() << "a2 clicked" << endl; |
---|
[11421] | 86 | |
---|
[11413] | 87 | } |
---|
[11421] | 88 | void DialogueManager::update(NextQuestion* nq){ |
---|
| 89 | this->setquestion(nq->getquestion()); |
---|
| 90 | this->setanswers1(nq->getanswers1()); |
---|
| 91 | this->setanswers2(nq->getanswers2()); |
---|
| 92 | } |
---|
[11377] | 93 | |
---|
[11421] | 94 | |
---|
[11393] | 95 | |
---|
[11401] | 96 | |
---|
[11393] | 97 | |
---|
[11421] | 98 | /* |
---|
| 99 | |
---|
| 100 | bool DialogueManager::theEnd(){ |
---|
| 101 | if(currentQuestion->retposQues()) return true; |
---|
| 102 | else return false; |
---|
[11390] | 103 | } |
---|
| 104 | |
---|
| 105 | |
---|
[11413] | 106 | |
---|
[11384] | 107 | vector<std::string> DialogueManager::getanswers(void){ |
---|
[11382] | 108 | return options; |
---|
[11377] | 109 | } |
---|
| 110 | |
---|
[11384] | 111 | int DialogueManager::getnumOptions(){ |
---|
[11382] | 112 | return options.size(); |
---|
[11377] | 113 | } |
---|
| 114 | |
---|
[11390] | 115 | */ |
---|
[11371] | 116 | } |
---|