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 | //DialogueManager* DialogueManager::singletonPtr_s =nullptr; |
---|
21 | |
---|
22 | DialogueManager::DialogueManager(){ |
---|
23 | orxout() << "Dialog Konstruktor" << endl; |
---|
24 | //RegisterObject(DialogueManager); |
---|
25 | |
---|
26 | } |
---|
27 | |
---|
28 | |
---|
29 | /** |
---|
30 | * @brief set the config values in the orxonox.ini file |
---|
31 | */ |
---|
32 | |
---|
33 | |
---|
34 | void DialogueManager::registerquestion(NextQuestion* nq){ |
---|
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 | } |
---|
40 | allQuestions.push_back(nq); |
---|
41 | orxout(internal_info) << "qsize " << allQuestions.size(); |
---|
42 | |
---|
43 | } |
---|
44 | |
---|
45 | void DialogueManager::setquestion(std::string q){ |
---|
46 | question=q; |
---|
47 | |
---|
48 | } |
---|
49 | |
---|
50 | std::string DialogueManager::getquestion(void){ |
---|
51 | orxout() << question << endl; |
---|
52 | return question; |
---|
53 | } |
---|
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 | } |
---|
74 | void DialogueManager::a1clicked(void){ |
---|
75 | |
---|
76 | assert((currentQuestion->retposQues())[0]); |
---|
77 | orxout() << "a14 clicked" << endl; |
---|
78 | orxout() << currentQuestion->possibleQuestions[0] << endl; |
---|
79 | currentQuestion = currentQuestion->possibleQuestions[0]; |
---|
80 | update(currentQuestion); |
---|
81 | |
---|
82 | |
---|
83 | } |
---|
84 | void DialogueManager::a2clicked(void){ |
---|
85 | orxout() << "a2 clicked" << endl; |
---|
86 | |
---|
87 | } |
---|
88 | void DialogueManager::update(NextQuestion* nq){ |
---|
89 | this->setquestion(nq->getquestion()); |
---|
90 | this->setanswers1(nq->getanswers1()); |
---|
91 | this->setanswers2(nq->getanswers2()); |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | /* |
---|
99 | |
---|
100 | bool DialogueManager::theEnd(){ |
---|
101 | if(currentQuestion->retposQues()) return true; |
---|
102 | else return false; |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | vector<std::string> DialogueManager::getanswers(void){ |
---|
108 | return options; |
---|
109 | } |
---|
110 | |
---|
111 | int DialogueManager::getnumOptions(){ |
---|
112 | return options.size(); |
---|
113 | } |
---|
114 | |
---|
115 | */ |
---|
116 | } |
---|