Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/dialogue/DialogueManager.cc @ 11780

Last change on this file since 11780 was 11718, checked in by landauf, 7 years ago

tabs → spaces

File size: 2.0 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    DialogueManager::DialogueManager(){}
20
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();
27
28    }
29
30    void DialogueManager::setquestion(std::string q){
31        question=q;
32
33    }
34    void DialogueManager::setCurrentQuestion(NextQuestion* nq){
35        currentQuestion=nq;
36
37    }
38
39    std::string DialogueManager::getquestion(void){
40        return question;
41    }
42
43    void DialogueManager::setanswers1(std::string a1){
44        this->a1=a1;
45    }
46
47    void DialogueManager::setanswers2(std::string a2){
48        this->a2=a2;
49    }
50
51
52
53    std::string DialogueManager::getanswers1(void){
54        return a1;
55    }
56
57    std::string DialogueManager::getanswers2(void){
58        return a2;
59    }
60
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    }
86
87}
Note: See TracBrowser for help on using the repository browser.