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

rrogge at orxonox.net rrogge at orxonox.net
Thu May 18 16:06:55 CEST 2017


Author: rrogge
Date: 2017-05-18 16:06:53 +0200 (Thu, 18 May 2017)
New Revision: 11428

Modified:
   code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
   code/branches/Dialogue_FS17/data/tcl/core
   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
Log:
Alles funktionioniert so weit, bloss kann man pro Spiel bloss einmal einen Dialog durchlaufen

Modified: code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
===================================================================
--- code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua	2017-05-18 14:06:09 UTC (rev 11427)
+++ code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua	2017-05-18 14:06:53 UTC (rev 11428)
@@ -145,12 +145,30 @@
 
 
 function P.a1Button_clicked(e)
-    orxonox.DialogueManager:getInstance():a1clicked()
-    P.update()
+    local ending = orxonox.DialogueManager:getInstance():theEnd()
+    
+    if ending then
+        orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialogue")
+    
+    
+    else 
+        orxonox.DialogueManager:getInstance():a1clicked()
+        P.update()
+    end
 end
 
 function P.a2Button_clicked(e)
-    orxonox.DialogueManager:getInstance():a2clicked()
+    local ending = orxonox.DialogueManager:getInstance():theEnd()
+    
+    if ending then
+        orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialogue")
+    
+    
+    else 
+        orxonox.DialogueManager:getInstance():a2clicked()
+        P.update()
+    end
+    
 end
 
 return P

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

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc	2017-05-18 14:06:09 UTC (rev 11427)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc	2017-05-18 14:06:53 UTC (rev 11428)
@@ -73,9 +73,7 @@
 	}
 	void DialogueManager::a1clicked(void){
 		
-		assert((currentQuestion->retposQues())[0]);
-		orxout() << "a14 clicked" << endl;
-		orxout() << currentQuestion->possibleQuestions[0] << endl;
+		
 		currentQuestion = currentQuestion->possibleQuestions[0];
 		update(currentQuestion);
 
@@ -83,6 +81,10 @@
 	}
 	void DialogueManager::a2clicked(void){
 		orxout() << "a2 clicked" << endl;
+
+		currentQuestion = currentQuestion->possibleQuestions[1];
+		update(currentQuestion);
+
 		
 	}
 	 void DialogueManager::update(NextQuestion* nq){
@@ -91,17 +93,19 @@
 	 	this->setanswers2(nq->getanswers2());
 	 }
 
-	
+	bool DialogueManager::theEnd(){
+	if((currentQuestion->possibleQuestions).empty()) {
+		orxout() << "endtrue" << endl;
+		return true;}
+	else return false;
+	}
 
 	
 
 	/*
 	
-	bool DialogueManager::theEnd(){
-	if(currentQuestion->retposQues()) return true;
-	else return false;
-	}
 	
+	
 
 	
 	vector<std::string> DialogueManager::getanswers(void){

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h	2017-05-18 14:06:09 UTC (rev 11427)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h	2017-05-18 14:06:53 UTC (rev 11428)
@@ -47,7 +47,7 @@
 		std::string getanswers2(void); //tolua_export
 		void a1clicked(void); //tolua_export
 		void a2clicked(void); //tolua_export
-			//bool theEnd(); 
+		bool theEnd(); //tolua_export 
 		void update(NextQuestion* nq);
 
 private:

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc	2017-05-18 14:06:09 UTC (rev 11427)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc	2017-05-18 14:06:53 UTC (rev 11428)
@@ -19,7 +19,7 @@
         orxout() << "Klasse aufgerufen" << endl;
         DialogueManager& m = DialogueManager::getInstance();
         m.registerquestion(this);
-       
+       //possibleQuestions=nullptr;
         
     }
 
@@ -113,9 +113,9 @@
 	}
 
 	std::vector<NextQuestion*> NextQuestion::retposQues(){
-		orxout() << "fish" << endl;
-		assert(possibleQuestions[0]);
-		orxout() << possibleQuestions.size() << endl;
+		//if(possibleQuestions.size()==0) return NULL;
+	
+		orxout() << "SIZE" << possibleQuestions.size() << endl;
 		return possibleQuestions;
 	}
 



More information about the Orxonox-commit mailing list