Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

tabs → spaces

File size: 2.0 KB
RevLine 
[11371]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"
[11417]8#include "DialogueManager.h"
[11382]9#include <vector>
10#include <string>
[11393]11#include "core/XMLPort.h"
[11415]12#include "NextQuestion.h"
[11371]13
[11393]14
[11417]15
[11371]16namespace orxonox {
[11718]17    ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
[11393]18   
[11718]19    DialogueManager::DialogueManager(){}
[11371]20
[11718]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();
[11417]27
[11718]28    }
[11417]29
[11406]30    void DialogueManager::setquestion(std::string q){
[11718]31        question=q;
[11377]32
[11718]33    }
34    void DialogueManager::setCurrentQuestion(NextQuestion* nq){
35        currentQuestion=nq;
[11435]36
[11718]37    }
[11413]38
[11718]39    std::string DialogueManager::getquestion(void){
40        return question;
41    }
[11413]42
[11718]43    void DialogueManager::setanswers1(std::string a1){
44        this->a1=a1;
45    }
[11413]46
[11718]47    void DialogueManager::setanswers2(std::string a2){
48        this->a2=a2;
49    }
[11413]50
[11435]51
[11421]52
[11718]53    std::string DialogueManager::getanswers1(void){
54        return a1;
55    }
[11428]56
[11718]57    std::string DialogueManager::getanswers2(void){
58        return a2;
59    }
[11435]60
[11718]61    void DialogueManager::a1clicked(void){
[11393]62
[11718]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.