[Orxonox-commit 6793] r11421 - in code/branches/Dialogue_FS17: data/gui/scripts data/tcl src/modules/dialogue

rrogge at orxonox.net rrogge at orxonox.net
Thu May 18 14:49:19 CEST 2017


Author: rrogge
Date: 2017-05-18 14:49:13 +0200 (Thu, 18 May 2017)
New Revision: 11421

Added:
   code/branches/Dialogue_FS17/data/tcl/core
Modified:
   code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
   code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc
   code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h
   code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
   code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h
Log:
question updates

Modified: code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
===================================================================
--- code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua	2017-05-18 12:16:01 UTC (rev 11420)
+++ code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua	2017-05-18 12:49:13 UTC (rev 11421)
@@ -69,6 +69,8 @@
 end
 
 function P.update()
+    orxout("UPDATING")
+    P.createInventory()
     if P.showing == false then
         return
     end
@@ -135,6 +137,7 @@
 
 function P.a1Button_clicked(e)
     orxonox.DialogueManager:getInstance():a1clicked()
+    P.update()
 end
 
 function P.a2Button_clicked(e)

Added: code/branches/Dialogue_FS17/data/tcl/core
===================================================================
(Binary files differ)

Index: code/branches/Dialogue_FS17/data/tcl/core
===================================================================
--- code/branches/Dialogue_FS17/data/tcl/core	2017-05-18 12:16:01 UTC (rev 11420)
+++ code/branches/Dialogue_FS17/data/tcl/core	2017-05-18 12:49:13 UTC (rev 11421)

Property changes on: code/branches/Dialogue_FS17/data/tcl/core
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc	2017-05-18 12:16:01 UTC (rev 11420)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc	2017-05-18 12:49:13 UTC (rev 11421)
@@ -23,8 +23,6 @@
 		orxout() << "Dialog Konstruktor" << endl;
 		//RegisterObject(DialogueManager);
 		
-		
-
 	}
 	
 
@@ -34,7 +32,13 @@
     
 
 	void DialogueManager::registerquestion(NextQuestion* nq){
+		if(allQuestions.size()==0) {
+			orxout(internal_info) << "At least one NextQuestion has to be set." << endl;
+		} else  {
+			currentQuestion = allQuestions[0];
+		}
 		allQuestions.push_back(nq);
+			orxout(internal_info) << "qsize " << allQuestions.size();
 
 	}	
 
@@ -67,28 +71,36 @@
 	std::string DialogueManager::getanswers2(void){
 		return a2;
 	}
-	bool DialogueManager::a1clicked(void){
-		orxout() << "a1 clicked" << endl;
+	void DialogueManager::a1clicked(void){
+		
+		assert((currentQuestion->retposQues())[0]);
+		orxout() << "a14 clicked" << endl;
+		orxout() << currentQuestion->possibleQuestions[0] << endl;
 		currentQuestion = currentQuestion->possibleQuestions[0];
-		return true;
+		update(currentQuestion);
+
+		
 	}
-	bool DialogueManager::a2clicked(void){
+	void DialogueManager::a2clicked(void){
 		orxout() << "a2 clicked" << endl;
-		return true;
+		
 	}
-	/*void DialogueManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(DialogueManager, XMLPort, xmlelement, mode);
+	 void DialogueManager::update(NextQuestion* nq){
+	 	this->setquestion(nq->getquestion());
+	 	this->setanswers1(nq->getanswers1());
+	 	this->setanswers2(nq->getanswers2());
+	 }
 
-        XMLPortParam(DialogueManager, "question", setquestion, getquestion, xmlelement, mode);
-    }*/
+	
 
 	
 
-	/*std::string DialogueManager::setnpc(std::string npc){
-		return npc;
+	/*
+	
+	bool DialogueManager::theEnd(){
+	if(currentQuestion->retposQues()) return true;
+	else return false;
 	}
-
 	
 
 	

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h	2017-05-18 12:16:01 UTC (rev 11420)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h	2017-05-18 12:49:13 UTC (rev 11421)
@@ -45,21 +45,11 @@
 		void setanswers2(std::string a2); //tolua_export
 		std::string getanswers1(void); //tolua_export
 		std::string getanswers2(void); //tolua_export
-		bool a1clicked(void); //tolua_export
-		bool a2clicked(void); //tolua_export
-			/*std::string setnpc(std::string npc);
+		void a1clicked(void); //tolua_export
+		void a2clicked(void); //tolua_export
+			//bool theEnd(); 
+		void update(NextQuestion* nq);
 
-			void setanswers(std::string option1, std::string option2, std::string option3);
-			std::vector <std::string> getanswers(void);
-
-			int getnumOptions();
-			
-
-			
-			std::string npc;
-			std::vector<std::string> options;
-		
-*/
 private:
 	NextQuestion* currentQuestion;
 	std::vector<NextQuestion*> allQuestions;

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc	2017-05-18 12:16:01 UTC (rev 11420)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc	2017-05-18 12:49:13 UTC (rev 11421)
@@ -47,7 +47,8 @@
                return effect;
             i--;
         }
-        return nullptr; }
+        return nullptr;
+         }
 	
 	//XML and Event stuff
 	void NextQuestion::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -111,16 +112,16 @@
 		return a2;
 	}
 
+	std::vector<NextQuestion*> NextQuestion::retposQues(){
+		orxout() << "fish" << endl;
+		assert(possibleQuestions[0]);
+		orxout() << possibleQuestions.size() << endl;
+		return possibleQuestions;
+	}
 
-	/*NextQuestion NextQuestion::compare(){
-		DialogueManager& m = DialogueManager::getInstance();
-		if(m.a1clicked()){
-			return *possibleQuestions[0];
-		}
 
-		else if(m.a2clicked()){
-			return *possibleQuestions[1];
-		}
+	/*
+
 	}*/
 
 

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h	2017-05-18 12:16:01 UTC (rev 11420)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h	2017-05-18 12:49:13 UTC (rev 11421)
@@ -11,8 +11,6 @@
 #include "DialoguePrereqs.h"
 
 
-
-
 namespace orxonox{
 	class _OrxonoxExport NextQuestion : public BaseObject
 	{
@@ -46,6 +44,7 @@
 		bool execute(bool bTriggered, BaseObject* trigger);
 
 		std::vector<NextQuestion*> possibleQuestions;
+		std::vector<NextQuestion*> retposQues();
 	private:
 		std::string a1;
 		std::string a2;



More information about the Orxonox-commit mailing list