Changeset 11607 for code/branches
- Timestamp:
- Nov 27, 2017, 4:57:47 PM (7 years ago)
- Location:
- code/branches/Dialog_HS17/src/modules/dialog
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Dialog_HS17/src/modules/dialog/Answer.cc
r11579 r11607 26 26 } 27 27 28 std::string getAnswerId(){28 std::string Answer::getAnswerId(){ 29 29 return this->answerId_; 30 30 } -
code/branches/Dialog_HS17/src/modules/dialog/Answer.h
r11579 r11607 1 #ifndef _Answer_H__ 2 #define _Answer_H__ 3 1 4 #include "core/BaseObject.h" 2 5 #include "core/XMLPort.h" 6 #include "core/CoreIncludes.h" 3 7 #include <string> 4 8 … … 10 14 public: 11 15 Answer(Context* context); 12 virtual ~Answer();16 // virtual ~Answer(); 13 17 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 14 18 … … 28 32 }; 29 33 } 34 35 #endif -
code/branches/Dialog_HS17/src/modules/dialog/AnswerId.cc
r11579 r11607 20 20 this->Id_ = Id; 21 21 } 22 const std::string&AnswerId::getId(){22 std::string AnswerId::getId(){ 23 23 return this->Id_; 24 24 } -
code/branches/Dialog_HS17/src/modules/dialog/AnswerId.h
r11579 r11607 1 #ifndef _AnswerID_H__ 2 #define _AnswerID_H__ 3 1 4 #include "core/XMLPort.h" 2 5 #include "core/BaseObject.h" 6 #include "core/CoreIncludes.h" 3 7 4 8 #include <string> 5 6 #pragma once7 9 8 10 namespace orxonox{ … … 11 13 public: 12 14 AnswerId(Context* context); 13 virtual ~AnswerId();15 // virtual ~AnswerId(); 14 16 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 15 17 … … 21 23 }; 22 24 } 25 26 #endif -
code/branches/Dialog_HS17/src/modules/dialog/CMakeLists.txt
r11579 r11607 11 11 FIND_HEADER_FILES 12 12 TOLUA_FILES 13 DialogManager.h14 Dialog.h15 13 LINK_LIBRARIES 16 14 orxonox -
code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
r11579 r11607 3 3 #include "core/XMLPort.h" 4 4 #include "core/EventIncludes.h" 5 #include "Dialog.h" 6 #include "Question.h" 5 7 6 8 namespace orxonox … … 21 23 XMLPortParam(Dialog, "name", setName, getName, xmlelement, mode); 22 24 XMLPortParam(Dialog, "currentQuestionId", setCurrentQuestionId, getCurrentQuestionId, xmlelement, mode); 23 XMLPortObject(Dialog, Question, "Questions", addQuestion, getQuestion, xmlelement, mode);25 XMLPortObject(Dialog, Question, "Questions", addQuestion, getQuestion, xmlelement, mode); 24 26 XMLPortObject(Dialog, Answer, "Answers", addAnswer, getAnswer, xmlelement, mode); 25 27 } … … 53 55 54 56 55 void Dialog::addQuestion(Question question) //fuegt Question der Map hinzu57 void Dialog::addQuestion(Question* question) //fuegt Question der Map hinzu 56 58 { 57 //questions_.emplace(question .getQuestionId, question);59 //questions_.emplace(question->getQuestionId(), question->getQuestion()); 58 60 } 59 61 60 void Dialog::addAnswer(Answer answer) //fuegt Answer der Map hinzu62 void Dialog::addAnswer(Answer* answer) //fuegt Answer der Map hinzu 61 63 { 62 //answers_.emplace(std::make_pair(answer .getAnswerId, answer));64 //answers_.emplace(std::make_pair(answer->getAnswerId(), answer->getAnswer())); 63 65 } 64 66 65 std::string Dialog::getQuestion()// returned nichts67 Question* Dialog::getQuestion(unsigned int index) const // returned nichts 66 68 { 67 Question question = (questions_.find(this->currentQuestionId_))->second; 68 return question.getQuestion(); 69 return nullptr; 70 // Question question = (questions_.find(this->currentQuestionId_))->second; 71 // return question.getQuestion(); 69 72 } 70 73 71 std::string Dialog::getAnswer(std::string answerId)//tolua_export //returned sting der Antwort zur Id.74 Answer* Dialog::getAnswer(unsigned int index) const//tolua_export //returned sting der Antwort zur Id. 72 75 { 73 return (this->answers_.find(answerId))->second.getAnswer(); 76 return nullptr; 77 // return (this->answers_.find(answerId))->second.getAnswer(); 74 78 } 75 79 -
code/branches/Dialog_HS17/src/modules/dialog/Dialog.h
r11579 r11607 1 #ifndef _Dialog_H__ 2 #define _Dialog_H__ 3 1 4 #include "core/BaseObject.h" 2 5 #include "Question.h" 3 6 #include "Answer.h" 4 7 #include "core/XMLPort.h" 8 #include "core/CoreIncludes.h" 5 9 #include "overlays/OrxonoxOverlay.h" 6 10 … … 13 17 public: 14 18 Dialog(Context* context); 15 virtual ~Dialog();19 // virtual ~Dialog(); 16 20 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 17 21 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); … … 23 27 std::string getCurrentQuestionId(); 24 28 25 void addQuestion(Question question); //fuegt Question der Map hinzu26 void addAnswer(Answer answer); //fuegt Answer der Map hinzu29 void addQuestion(Question* question); //fuegt Question der Map hinzu 30 void addAnswer(Answer* answer); //fuegt Answer der Map hinzu 27 31 28 std::string getQuestion(); //tolua_export // returned string der momentanen Frage29 std::string getAnswer(std::string answerId); //tolua_export //returned sting der Antwort zur Id.32 Question* getQuestion(unsigned int index) const; //tolua_export // returned string der momentanen Frage 33 Answer* getAnswer(unsigned int index) const; //tolua_export // returned string der momentanen Frage 30 34 std::vector<std::string> getAnswers(); //tolua_export // returned vector mit allen momentanen AntwortenIds 31 35 32 bool execute(bool bTriggered, BaseObject* trigger);36 bool execute(bool bTriggered, BaseObject* trigger); 33 37 34 38 void update(std::string givenAnswer); //tolua_export … … 44 48 }; 45 49 } 50 51 #endif -
code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc
r11579 r11607 1 #include "DialogManager.h" 2 #include "core/CoreIncludes.h" 3 #include "core/singleton/ScopedSingletonIncludes.h" 4 5 namespace orxonox 6 { 7 ManageScopedSingleton(DialogManager, ScopeID::ROOT, false); 8 9 RegisterAbstractClass(DialogManager).inheritsFrom<Listable>(); 10 11 DialogManager::DialogManager() 12 { 13 RegisterObject(DialogManager); 14 15 this->currentTalk_ = NULL; 16 } 17 18 void DialogManager::setDialog(Dialog* dialog) 19 { 20 this->currentTalk_ = dialog; 21 } 22 23 const Dialog* DialogManager::getCurrentDialog() 24 { 25 return this->currentTalk_; 26 } 27 28 bool DialogManager::empty() 29 { 30 if(this->currentTalk_ == NULL) 31 { 32 return true; 33 } 34 else 35 { 36 return false; 37 } 38 } 39 } 1 40 /*#include "core/CoreIncludes.h" 2 41 #include "core/LuaState.h" … … 46 85 } 47 86 } */ 48 49 #include "DialogManager.h"50 #include "core/CoreIncludes.h"51 #include "core/singleton/ScopedSingletonIncludes.h"52 53 namespace orxonox54 {55 ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);56 57 RegisterAbstractClass(DialogManager).inheritsFrom<Listable>();58 59 DialogManager::DialogManager()60 {61 RegisterObject(DialogManager);62 63 this->value_ = 999;64 }65 } -
code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h
r11579 r11607 73 73 74 74 void setDialog(Dialog* dialog); 75 const Dialog &getCurrentDialog();76 75 const Dialog* getCurrentDialog(); 76 bool empty(); 77 77 78 78 private: -
code/branches/Dialog_HS17/src/modules/dialog/Question.cc
r11579 r11607 19 19 XMLPortParam(Question, "Id", setQuestionId, getQuestionId, xmlement, mode); 20 20 21 XMLPortObject(Question, AnswerId, "answers", addAnswerId, getAnswerId s, xmlement, mode);21 XMLPortObject(Question, AnswerId, "answers", addAnswerId, getAnswerId, xmlement, mode); 22 22 } 23 23 … … 37 37 } 38 38 39 cstd::string Question::getQuestion()39 std::string Question::getQuestion() 40 40 { 41 41 return this->question_; 42 42 } 43 43 44 void Question::addAnswerId(AnswerId answerId)44 void Question::addAnswerId(AnswerId* answerId) 45 45 { 46 this->answerIds_.push_back(answerId .getId);46 this->answerIds_.push_back(answerId->getId()); 47 47 } 48 48 49 AnswerId* Question::getAnswerId(unsigned int index) const 50 { 51 return nullptr; 52 } 49 53 50 54 std::vector<std::string> Question::getAnswerIds() -
code/branches/Dialog_HS17/src/modules/dialog/Question.h
r11579 r11607 1 #ifndef _Question_H__ 2 #define _Question_H__ 3 1 4 #include "core/BaseObject.h" 2 5 #include "AnswerId.h" 3 6 #include "core/XMLPort.h" 7 #include "core/CoreIncludes.h" 4 8 5 9 #include <string> … … 11 15 public: 12 16 Question(Context* context); 13 virtual ~Question();17 // virtual ~Question(); 14 18 virtual void XMLPort(Element& xmelement, XMLPort::Mode mode); 15 19 … … 20 24 std::string getQuestion(); 21 25 22 void addAnswerId(AnswerId answerId); //leer lassen um Dialog zu beenden 26 void addAnswerId(AnswerId* answerId); //leer lassen um Dialog zu beenden 27 AnswerId* getAnswerId(unsigned int index) const; 23 28 24 29 … … 36 41 }; 37 42 } 43 44 #endif
Note: See TracChangeset
for help on using the changeset viewer.