Changeset 11718 for code/trunk/src/modules/dialogue/DialogueManager.cc
- Timestamp:
- Jan 7, 2018, 10:34:30 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/dialogue/DialogueManager.cc
r11435 r11718 15 15 16 16 namespace orxonox { 17 ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false); 18 17 ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false); 18 19 DialogueManager::DialogueManager(){} 19 20 20 21 DialogueManager::DialogueManager(){} 22 21 void DialogueManager::registerquestion(NextQuestion* nq){ 22 if(allQuestions.size()==0) { 23 orxout(internal_info) << "At least one NextQuestion has to be set." << endl; 24 } 25 allQuestions.push_back(nq); 26 orxout(internal_info) << "qsize " << allQuestions.size(); 23 27 24 25 26 27 void DialogueManager::registerquestion(NextQuestion* nq){ 28 if(allQuestions.size()==0) { 29 orxout(internal_info) << "At least one NextQuestion has to be set." << endl; 30 } 31 allQuestions.push_back(nq); 32 orxout(internal_info) << "qsize " << allQuestions.size(); 33 34 } 28 } 35 29 36 30 void DialogueManager::setquestion(std::string q){ 37 question=q; 38 39 } 40 void DialogueManager::setCurrentQuestion(NextQuestion* nq){ 41 currentQuestion=nq; 42 43 } 31 question=q; 44 32 45 std::string DialogueManager::getquestion(void){ 46 return question; 47 } 33 } 34 void DialogueManager::setCurrentQuestion(NextQuestion* nq){ 35 currentQuestion=nq; 48 36 49 void DialogueManager::setanswers1(std::string a1){ 50 this->a1=a1; 51 } 37 } 52 38 53 void DialogueManager::setanswers2(std::string a2){54 this->a2=a2;55 39 std::string DialogueManager::getquestion(void){ 40 return question; 41 } 56 42 57 43 void DialogueManager::setanswers1(std::string a1){ 44 this->a1=a1; 45 } 58 46 59 std::string DialogueManager::getanswers1(void){60 return a1;61 47 void DialogueManager::setanswers2(std::string a2){ 48 this->a2=a2; 49 } 62 50 63 std::string DialogueManager::getanswers2(void){64 return a2;65 }66 51 67 void DialogueManager::a1clicked(void){68 69 currentQuestion = currentQuestion->possibleQuestions[0];70 update(currentQuestion);71 52 72 73 } 74 void DialogueManager::a2clicked(void){ 75 76 currentQuestion = currentQuestion->possibleQuestions[1]; 77 update(currentQuestion); 78 } 53 std::string DialogueManager::getanswers1(void){ 54 return a1; 55 } 79 56 80 void DialogueManager::update(NextQuestion* nq){ 81 this->setquestion(nq->getquestion()); 82 this->setanswers1(nq->getanswers1()); 83 this->setanswers2(nq->getanswers2()); 84 } 57 std::string DialogueManager::getanswers2(void){ 58 return a2; 59 } 85 60 86 bool DialogueManager::theEnd(){ 87 if((currentQuestion->possibleQuestions).empty()) { 88 return true;} 89 else return false; 90 } 61 void DialogueManager::a1clicked(void){ 62 63 currentQuestion = currentQuestion->possibleQuestions[0]; 64 update(currentQuestion); 65 66 67 } 68 void DialogueManager::a2clicked(void){ 69 70 currentQuestion = currentQuestion->possibleQuestions[1]; 71 update(currentQuestion); 72 } 73 74 void DialogueManager::update(NextQuestion* nq){ 75 this->setquestion(nq->getquestion()); 76 this->setanswers1(nq->getanswers1()); 77 this->setanswers2(nq->getanswers2()); 78 } 79 80 bool DialogueManager::theEnd(){ 81 if((currentQuestion->possibleQuestions).empty()) 82 return true; 83 else 84 return false; 85 } 91 86 92 87 }
Note: See TracChangeset
for help on using the changeset viewer.