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" |
---|
8 | #include "DialogueManager.h" |
---|
9 | #include <vector> |
---|
10 | #include <string> |
---|
11 | #include "core/XMLPort.h" |
---|
12 | #include "NextQuestion.h" |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | namespace orxonox { |
---|
17 | ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false); |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | DialogueManager::DialogueManager(){} |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | void DialogueManager::registerquestion(NextQuestion* nq){ |
---|
28 | if(allQuestions.size()==0) { |
---|
29 | orxout(verbose) << "At least one NextQuestion has to be set." << endl; |
---|
30 | } |
---|
31 | allQuestions.push_back(nq); |
---|
32 | orxout(verbose) << "qsize " << allQuestions.size(); |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | void DialogueManager::setquestion(std::string q){ |
---|
37 | question=q; |
---|
38 | |
---|
39 | } |
---|
40 | void DialogueManager::setCurrentQuestion(NextQuestion* nq){ |
---|
41 | currentQuestion=nq; |
---|
42 | |
---|
43 | } |
---|
44 | |
---|
45 | std::string DialogueManager::getquestion(void){ |
---|
46 | return question; |
---|
47 | } |
---|
48 | |
---|
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 | } |
---|
66 | |
---|
67 | void DialogueManager::a1clicked(void){ |
---|
68 | |
---|
69 | currentQuestion = currentQuestion->possibleQuestions[0]; |
---|
70 | update(currentQuestion); |
---|
71 | |
---|
72 | |
---|
73 | } |
---|
74 | void DialogueManager::a2clicked(void){ |
---|
75 | |
---|
76 | currentQuestion = currentQuestion->possibleQuestions[1]; |
---|
77 | update(currentQuestion); |
---|
78 | } |
---|
79 | |
---|
80 | void DialogueManager::update(NextQuestion* nq){ |
---|
81 | this->setquestion(nq->getquestion()); |
---|
82 | this->setanswers1(nq->getanswers1()); |
---|
83 | this->setanswers2(nq->getanswers2()); |
---|
84 | } |
---|
85 | |
---|
86 | bool DialogueManager::theEnd(){ |
---|
87 | if((currentQuestion->possibleQuestions).empty()) { |
---|
88 | return true;} |
---|
89 | else return false; |
---|
90 | } |
---|
91 | |
---|
92 | } |
---|