Changeset 11612 for code/branches/Dialog_HS17/src/modules
- Timestamp:
- Nov 30, 2017, 3:35:25 PM (7 years ago)
- Location:
- code/branches/Dialog_HS17/src/modules/dialog
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
r11611 r11612 113 113 return end; 114 114 } 115 116 std::string Dialog::getQuestionString() 117 { 118 return this->questions_.find(this->currentQuestionId_)->second->getQuestion(); 119 } 115 120 } -
code/branches/Dialog_HS17/src/modules/dialog/Dialog.h
r11611 r11612 33 33 void addAnswer(Answer* answer); //fuegt Answer der Map hinzu 34 34 35 Question* getQuestion(unsigned int index) const; // returned string der momentanen Frage36 Answer* getAnswer(unsigned int index) const; // returned string der momentanen Frage35 Question* getQuestion(unsigned int index) const; // // benoetigt fuer xmlPort 36 Answer* getAnswer(unsigned int index) const; // benoetigt fuer xmlPort 37 37 std::vector<std::string> getAnswers(); // returned vector mit allen momentanen AntwortenIds 38 38 … … 43 43 bool ending(); //retruned true wenn die Id der Antwort end ist oder keine Antworten auf die frage eingetragen sind 44 44 45 std::string getQuestionString(); //gibt string der momentanen Frage 45 46 46 47 private: -
code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc
r11611 r11612 2 2 #include "core/CoreIncludes.h" 3 3 #include "core/singleton/ScopedSingletonIncludes.h" 4 #include <string> 4 5 5 namespace orxonox 6 { 7 ManageScopedSingleton(DialogManager, ScopeID::ROOT, false); 6 namespace orxonox { 7 ManageScopedSingleton(DialogManager, ScopeID::ROOT, false); 8 8 9 9 RegisterAbstractClass(DialogManager).inheritsFrom<Listable>(); 10 11 DialogManager::DialogManager() 12 { 13 this->currentTalk_ = nullptr; 14 } 10 15 11 DialogManager::DialogManager() 12 { 13 RegisterObject(DialogManager); 14 15 this->currentTalk_ = NULL; 16 } 17 18 void DialogManager::setDialog(Dialog* dialog) 16 void DialogManager::setDialog(Dialog* dialog) 19 17 { 20 18 this->currentTalk_ = dialog; 21 19 } 22 20 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 } 21 //from here onward funcionality for lua axports 22 23 std::string DialogManager::getQuestion() 24 { 25 return this->currentTalk_->getQuestionString(); 26 } 27 28 /* 29 std::vector<std::string> DialogManager::getAnswers() 30 { 31 // lua hat komisch arrays (eigentlich tables), wie implementiert man answers so das man nacher den key der gegeben antwort a 32 // hat um ihn fuer update zu benutzen? 33 } 34 */ 39 35 } -
code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h
r11611 r11612 4 4 #include "DialogPrereqs.h" 5 5 #include "util/Singleton.h" 6 #include "core/singleton/ScopedSingletonIncludes.h" 6 7 #include "core/object/Listable.h" 7 8 #include "Dialog.h" 8 9 9 namespace orxonox 10 { 11 class _DialogExport DialogManager : public Singleton<DialogManager>, public Listable 12 { 10 #include <string> 11 12 namespace orxonox //tolua_export 13 14 {//tolua_export 15 class _OrxonoxExport DialogManager //tolua_export 16 : public Singleton<DialogManager> 17 {//tolua_export 13 18 friend class Singleton<DialogManager>; 19 20 public: 21 22 DialogManager(); 23 14 24 15 public: 16 DialogManager(); 25 static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //tolua_export 17 26 18 // int getValue() const { return this->value_; }27 void setDialog(Dialog* dialog); 19 28 20 static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //toloa_export29 //from here on luafunctionality is declared 21 30 22 void setDialog(Dialog* dialog); 23 const Dialog* getCurrentDialog(); 24 bool empty(); 31 std::string getQuestion(); //tolua_export 32 //std::vector<std::string> getAnswers(); 25 33 26 //form here on all lua functionality used in lua scrips is declared 34 private: 35 static DialogManager* singletonPtr_s; 27 36 37 Dialog* currentTalk_; 28 38 29 private: 30 Dialog* currentTalk_; 31 //int value_; 32 33 static DialogManager* singletonPtr_s; 34 }; 35 } 39 };//tolua_export 40 }//tolua_export 36 41 37 42 #endif /* _DialogManager_H__ */ -
code/branches/Dialog_HS17/src/modules/dialog/DialogPrereqs.h
r11611 r11612 43 43 //----------------------------------------------------------------------- 44 44 45 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialog ue_STATIC_BUILD)46 # ifdef Dialog ue_SHARED_BUILD45 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialog_STATIC_BUILD) 46 # ifdef Dialog_SHARED_BUILD 47 47 # define _DialogExport __declspec(dllexport) 48 48 # else
Note: See TracChangeset
for help on using the changeset viewer.