Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 7, 2018, 10:34:30 PM (6 years ago)
Author:
landauf
Message:

tabs → spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/dialogue/DialogueManager.cc

    r11435 r11718  
    1515
    1616namespace orxonox {
    17         ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
    18        
     17    ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
     18   
     19    DialogueManager::DialogueManager(){}
    1920
    20        
    21         DialogueManager::DialogueManager(){}
    22        
     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();
    2327
    24        
    25    
    26 
    27         void DialogueManager::registerquestion(NextQuestion* nq){
    28                 if(allQuestions.size()==0) {
    29                         orxout(internal_info) << "At least one NextQuestion has to be set." << endl;
    30                 }
    31                 allQuestions.push_back(nq);
    32                         orxout(internal_info) << "qsize " << allQuestions.size();
    33 
    34         }       
     28    }
    3529
    3630    void DialogueManager::setquestion(std::string q){
    37                 question=q;
    38                
    39         }
    40         void DialogueManager::setCurrentQuestion(NextQuestion* nq){
    41                 currentQuestion=nq;
    42                
    43         }
     31        question=q;
    4432
    45         std::string DialogueManager::getquestion(void){
    46                 return question;
    47         }
     33    }
     34    void DialogueManager::setCurrentQuestion(NextQuestion* nq){
     35        currentQuestion=nq;
    4836
    49         void DialogueManager::setanswers1(std::string a1){
    50                 this->a1=a1;
    51                                 }
     37    }
    5238
    53         void DialogueManager::setanswers2(std::string a2){
    54                 this->a2=a2;
    55                                 }
     39    std::string DialogueManager::getquestion(void){
     40        return question;
     41    }
    5642
    57        
     43    void DialogueManager::setanswers1(std::string a1){
     44        this->a1=a1;
     45    }
    5846
    59         std::string DialogueManager::getanswers1(void){
    60                 return a1;
    61         }
     47    void DialogueManager::setanswers2(std::string a2){
     48        this->a2=a2;
     49    }
    6250
    63         std::string DialogueManager::getanswers2(void){
    64                 return a2;
    65         }
    6651
    67         void DialogueManager::a1clicked(void){
    68                
    69                 currentQuestion = currentQuestion->possibleQuestions[0];
    70                 update(currentQuestion);
    7152
    72                
    73         }
    74         void DialogueManager::a2clicked(void){
    75                
    76                 currentQuestion = currentQuestion->possibleQuestions[1];
    77                 update(currentQuestion);
    78         }
     53    std::string DialogueManager::getanswers1(void){
     54        return a1;
     55    }
    7956
    80          void DialogueManager::update(NextQuestion* nq){
    81                 this->setquestion(nq->getquestion());
    82                 this->setanswers1(nq->getanswers1());
    83                 this->setanswers2(nq->getanswers2());
    84          }
     57    std::string DialogueManager::getanswers2(void){
     58        return a2;
     59    }
    8560
    86         bool DialogueManager::theEnd(){
    87         if((currentQuestion->possibleQuestions).empty()) {
    88                 return true;}
    89         else return false;
    90         }
     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    }
    9186
    9287}
Note: See TracChangeset for help on using the changeset viewer.