Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc @ 11432

Last change on this file since 11432 was 11432, checked in by rrogge, 7 years ago

Reload works now

File size: 2.6 KB
Line 
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
16namespace 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        void DialogueManager::setCurrentQuestion(NextQuestion* nq){
50                currentQuestion=nq;
51               
52        }
53
54        std::string DialogueManager::getquestion(void){
55                orxout() << question << endl;
56                return question;
57        }
58        void DialogueManager::setanswers1(std::string a1){
59                orxout() << "setanswers1" << endl;
60                this->a1=a1;
61                orxout() << "A1 is " << a1;
62                                }
63
64        void DialogueManager::setanswers2(std::string a2){
65                this->a2=a2;
66                                }
67
68       
69
70        std::string DialogueManager::getanswers1(void){
71                orxout() << "getanswers1" << endl;
72                return a1;
73        }
74
75        std::string DialogueManager::getanswers2(void){
76                return a2;
77        }
78        void DialogueManager::a1clicked(void){
79               
80               
81                currentQuestion = currentQuestion->possibleQuestions[0];
82                update(currentQuestion);
83
84               
85        }
86        void DialogueManager::a2clicked(void){
87                orxout() << "a2 clicked" << endl;
88
89                currentQuestion = currentQuestion->possibleQuestions[1];
90                update(currentQuestion);
91
92               
93        }
94         void DialogueManager::update(NextQuestion* nq){
95                this->setquestion(nq->getquestion());
96                this->setanswers1(nq->getanswers1());
97                this->setanswers2(nq->getanswers2());
98                depth=depth+1;
99               
100               
101         }
102        void DialogueManager::clean(){
103                orxout() <<" depth " << depth << endl;
104                //allQuestions.at(2*depth+1);
105        }
106        bool DialogueManager::theEnd(){
107        if((currentQuestion->possibleQuestions).empty()) {
108                orxout() << "endtrue" << endl;
109                return true;}
110        else return false;
111        }
112
113       
114
115        /*
116       
117       
118       
119
120       
121        vector<std::string> DialogueManager::getanswers(void){
122                return options;
123        }
124
125        int DialogueManager::getnumOptions(){
126                return options.size();
127        }
128
129        */
130}
Note: See TracBrowser for help on using the repository browser.