[Orxonox-commit 6789] r11417 - in code/branches/Dialogue_FS17: data/gui/scripts data/levels src/modules/dialogue
rrogge at orxonox.net
rrogge at orxonox.net
Thu May 11 16:15:10 CEST 2017
Author: rrogge
Date: 2017-05-11 16:15:10 +0200 (Thu, 11 May 2017)
New Revision: 11417
Modified:
code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
code/branches/Dialogue_FS17/data/levels/events.oxw
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/DialoguePrereqs.h
code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h
Log:
Funktion der Buttons noch fehlerhaft
Modified: code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
===================================================================
--- code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua 2017-05-11 14:15:10 UTC (rev 11417)
@@ -138,7 +138,7 @@
end
function P.a2Button_clicked(e)
- orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialogue")
+ orxonox.DialogueManager:getInstance():a2clicked()
end
return P
Modified: code/branches/Dialogue_FS17/data/levels/events.oxw
===================================================================
--- code/branches/Dialogue_FS17/data/levels/events.oxw 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/data/levels/events.oxw 2017-05-11 14:15:10 UTC (rev 11417)
@@ -58,11 +58,12 @@
<DistanceTrigger name="test" position="0,0,0" target="Pawn" distance=25 stayActive="true" />
<Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,1"/>
+
<NextQuestion question="Continue?" a1="yes" a2="no" >
- <!-- <possibleQuestions>
+ <possibleQuestions>
<NextQuestion question="Are you sure?" a1="yep let me continue" a2="no actually not" />
<NextQuestion question="Why?" a1="Got a dentist's appointment" a2="this sucks" />
- </possibleQuestions> -->
+ </possibleQuestions>
<events>
<execute>
<EventListener event="test" />
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc 2017-05-11 14:15:10 UTC (rev 11417)
@@ -5,7 +5,7 @@
#include "core/singleton/ScopedSingletonIncludes.h"
#include "network/Host.h"
#include "network/NetworkFunctionIncludes.h"
-#include "DialoguePrereqs.h"
+#include "DialogueManager.h"
#include <vector>
#include <string>
#include "core/XMLPort.h"
@@ -12,6 +12,7 @@
#include "NextQuestion.h"
+
namespace orxonox {
ManageScopedSingleton(DialogueManager, ScopeID::ROOT, false);
@@ -32,6 +33,11 @@
*/
+ void DialogueManager::registerquestion(NextQuestion* nq){
+ allQuestions.push_back(nq);
+
+ }
+
void DialogueManager::setquestion(std::string q){
question=q;
@@ -63,7 +69,7 @@
}
bool DialogueManager::a1clicked(void){
orxout() << "a1 clicked" << endl;
-
+ currentQuestion = currentQuestion->possibleQuestions[0];
return true;
}
bool DialogueManager::a2clicked(void){
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h 2017-05-11 14:15:10 UTC (rev 11417)
@@ -1,3 +1,6 @@
+#ifndef _DialogueManager_H__
+#define _DialogueManager_H__
+
#include "core/CoreIncludes.h"
#include "core/LuaState.h"
#include "core/GUIManager.h"
@@ -8,15 +11,16 @@
#include "util/Singleton.h"
#include <string>
#include <vector>
-#include "OrxonoxPrereqs.h"
+//#include "OrxonoxPrereqs.h"
#include "core/config/Configurable.h"
#include "core/XMLPort.h"
#include "core/EventIncludes.h"
+#include "DialoguePrereqs.h"
+#include "NextQuestion.h"
-
namespace orxonox //tolua_export
{//tolua_export
@@ -36,7 +40,7 @@
void setquestion(std::string question); //tolua_export
std::string getquestion(void); //tolua_export
-
+ void registerquestion(NextQuestion* nq);
void setanswers1(std::string a1); //tolua_export
void setanswers2(std::string a2); //tolua_export
std::string getanswers1(void); //tolua_export
@@ -57,7 +61,8 @@
*/
private:
- //NextQuestion currentQuestion;
+ NextQuestion* currentQuestion;
+ std::vector<NextQuestion*> allQuestions;
std::string a1;
std::string a2;
std::string question;
@@ -65,4 +70,4 @@
};//tolua_export
}//tolua_export
-
+#endif
\ No newline at end of file
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialoguePrereqs.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialoguePrereqs.h 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialoguePrereqs.h 2017-05-11 14:15:10 UTC (rev 11417)
@@ -69,6 +69,7 @@
{
class DialogueManager;
+ class NextQuestion;
}
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc 2017-05-11 14:15:10 UTC (rev 11417)
@@ -7,6 +7,7 @@
#include "NextQuestion.h"
#include "core/XMLPort.h"
+#include "DialogueManager.h"
namespace orxonox{
@@ -16,6 +17,8 @@
{
RegisterObject(NextQuestion);
orxout() << "Klasse aufgerufen" << endl;
+ DialogueManager& m = DialogueManager::getInstance();
+ m.registerquestion(this);
}
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h 2017-05-11 13:18:27 UTC (rev 11416)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h 2017-05-11 14:15:10 UTC (rev 11417)
@@ -1,3 +1,7 @@
+#ifndef _NextQuestion_H__
+#define _NextQuestion_H__
+
+
//#include <vector>
#include <string>
#include "core/class/Identifier.h"
@@ -4,10 +8,11 @@
#include "OrxonoxPrereqs.h"
#include "core/XMLPort.h"
#include "core/EventIncludes.h"
-#include "DialogueManager.h"
+#include "DialoguePrereqs.h"
+
namespace orxonox{
class _OrxonoxExport NextQuestion : public BaseObject
{
@@ -40,11 +45,11 @@
virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
bool execute(bool bTriggered, BaseObject* trigger);
-
+ std::vector<NextQuestion*> possibleQuestions;
private:
std::string a1;
std::string a2;
- std::vector<NextQuestion*> possibleQuestions;
+
std::string question;
@@ -52,4 +57,5 @@
};
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
More information about the Orxonox-commit
mailing list