[Orxonox-commit 6991] r11612 - in code/branches/Dialog_HS17: data/gui/scripts data/overlays src/modules/dialog

kuchlert at orxonox.net kuchlert at orxonox.net
Thu Nov 30 15:35:25 CET 2017


Author: kuchlert
Date: 2017-11-30 15:35:25 +0100 (Thu, 30 Nov 2017)
New Revision: 11612

Modified:
   code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua
   code/branches/Dialog_HS17/data/gui/scripts/Dialogue.lua
   code/branches/Dialog_HS17/data/overlays/HUDTemplates3.oxo
   code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
   code/branches/Dialog_HS17/src/modules/dialog/Dialog.h
   code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc
   code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h
   code/branches/Dialog_HS17/src/modules/dialog/DialogPrereqs.h
Log:
funktioniert bis dialogmanager getInstance, angefangen und noch zu tun: luafunktionen von dialogmanager, lua und layout

Modified: code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua
===================================================================
--- code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua	2017-11-30 14:35:25 UTC (rev 11612)
@@ -1,12 +1,9 @@
+-- Dialogue.lua
 
--- Dialog.lua
-
 local P = createMenuSheet("Dialog")
 
 P.wrapper = nil
-P.answerList = {}
-P.scrollbarWidht = 13
-P.selectedAnswer = {}
+P.detailsWindows = {}
 
 P.showing = false
 
@@ -13,15 +10,15 @@
 -- Design parameters
 P.imageHeight = 50
 P.detailImageSize = 100
-P.textHeight = 30
-P.buttonWidth = 85
+P.textHeight = 50
+P.buttonWidth = 50
 
 function P.onLoad()
     P.wrapper = nil
-
 end
 
 function P.onShow()
+
     orxonox.CommandExecutor:execute("setTimeFactor 0")
     P.createDialog()
     P.showing = true
@@ -36,44 +33,34 @@
 
 function P.update()
     P.updateDialog()
-    if P.showing == false then
-        return
-    end
-
-    P.cleanup(false)
 end
 
 function P.createDialog()
 
-    local dialogManager = orxonox.DialogManager:getInstance()
+    local manager = orxonox.DialogManager:getInstance()
     
+    ---[[
     root = winMgr:getWindow("orxonox/Dialogue/Inventory")
-    local dialog = dialogManager:getCurrentDialog()
-    root:setText(dialog:getQuestion)
+    local question = orxonox.DialogueManager:getInstance():getquestion()
+    root:setText(question)
     P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/Dialogue/Inventory/Wrapper")
     P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0)))
     root:addChildWindow(P.wrapper)
     
-    acceptButton = winMgr:createWindow("MenuWidgets/Button", "/a2Button")   --a2 da graphik aus version mit 2 knoepfen uebernommen
-    acceptButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0),CEGUI.UDim(0.4, (P.imageHeight-P.textHeight)/2)))
-    acceptButton:setSize(CEGUI.UVector2(CEGUI.UDim(0.8, 0), CEGUI.UDim(0, P.textHeight)))
-    acceptButton:setText("accept")
-    orxonox.GUIManager:subscribeEventHelper(acceptButton, "Clicked", P.name ..".acceptButton_clicked")
-    P.wrapper:addChildWindow(acceptButton)
-    
-    P.answerList = {}                       -- erstellen der tabelle aus AntwortIds und Antworten im Lua
-    local answers = dialog:getAnswers()
-    for ans in answers do
-        P.answerList[ans] = dialog:getAnswer(ans)
-    end
-    --todo herausfinden wie antworten in tabelle enzeigen
+    --]]
+    detailsButton = winMgr:createWindow("MenuWidgets/Button", "/DetailsButton")
+    detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0),CEGUI.UDim(0.5, (P.imageHeight-P.textHeight)/2)))
+    detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0, P.textHeight)))
+    detailsButton:setText("say")
+    orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name ..".Button_clicked")
+    P.wrapper:addChildWindow(detailsButton)
+    --]]
+
 end
 
-
 function P.updateDialog()
-    local dialog = orxonox.DialogManager:getInstance():getDialog()
-    root:setText(dialog:getQuestion)
-    --todo: tabellen updaten 
+    --local questionn = orxonox.DialogueManager:getInstance():getquestion()
+    --root:setText("test")
 end
 
 
@@ -97,16 +84,17 @@
 
 
 
-function P.acceptButton_clicked(e)
-    local ending = orxonox.DialogManager:getInstance():getDialog:ending()
+function P.Button_clicked(e)
+    --local ending = orxonox.DialogManager:getInstance():theEnd()
     
-    if ending then
+    --if ending then
         orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
     
-    --herausfindne wie tabelleneintrag uebergeben wird
-    else
-        P.update()
-    end
+    
+   -- else 
+   --     orxonox.DialogueManager:getInstance():a1clicked()
+   --     P.update()
+   -- end
 end
 
 return P

Modified: code/branches/Dialog_HS17/data/gui/scripts/Dialogue.lua
===================================================================
--- code/branches/Dialog_HS17/data/gui/scripts/Dialogue.lua	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/data/gui/scripts/Dialogue.lua	2017-11-30 14:35:25 UTC (rev 11612)
@@ -21,6 +21,7 @@
     P.detailsWindows = {}
     P.detailPickups = {}
     P.pickupsList = {}
+    
 end
 
 function P.onShow()
@@ -27,9 +28,9 @@
     orxonox.CommandExecutor:execute("setTimeFactor 0")
     P.createInventory()
     P.showing = true
-
 end
 
+
 function P.onHide()
     orxonox.CommandExecutor:execute("setTimeFactor 1")
     P.showing = false

Modified: code/branches/Dialog_HS17/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/Dialog_HS17/data/overlays/HUDTemplates3.oxo	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/data/overlays/HUDTemplates3.oxo	2017-11-30 14:35:25 UTC (rev 11612)
@@ -219,5 +219,11 @@
       visible = "false"
     />
 
+    <GUIOverlay
+      name = "Dialog"
+      guiname = "Dialog"
+      visible = "false"
+    />
+
   </OverlayGroup>
 </Template>

Modified: code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc	2017-11-30 14:35:25 UTC (rev 11612)
@@ -112,4 +112,9 @@
     	}	
     	return end;
     }
+
+	std::string Dialog::getQuestionString()
+	{
+		return this->questions_.find(this->currentQuestionId_)->second->getQuestion();
+	}
 }
\ No newline at end of file

Modified: code/branches/Dialog_HS17/src/modules/dialog/Dialog.h
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/Dialog.h	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/src/modules/dialog/Dialog.h	2017-11-30 14:35:25 UTC (rev 11612)
@@ -32,8 +32,8 @@
 			void addQuestion(Question* question); //fuegt Question der Map hinzu
 			void addAnswer(Answer* answer); //fuegt Answer der Map hinzu
 
-			Question* getQuestion(unsigned int index) const; // returned string der momentanen Frage
-			Answer* getAnswer(unsigned int index) const; // returned string der momentanen Frage
+			Question* getQuestion(unsigned int index) const; // // benoetigt fuer xmlPort
+			Answer* getAnswer(unsigned int index) const; // benoetigt fuer xmlPort
 			std::vector<std::string> getAnswers(); 	// returned vector mit allen momentanen AntwortenIds
 
 	 		bool execute(bool bTriggered, BaseObject* trigger);
@@ -42,6 +42,7 @@
 
 			bool ending(); //retruned true wenn die Id der Antwort end ist oder keine Antworten auf die frage eingetragen sind
 
+			std::string getQuestionString(); //gibt string der momentanen Frage 
 
 		private: 
 			std::string name_;

Modified: code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc	2017-11-30 14:35:25 UTC (rev 11612)
@@ -1,39 +1,35 @@
 #include "DialogManager.h"
 #include "core/CoreIncludes.h"
 #include "core/singleton/ScopedSingletonIncludes.h"
+#include <string>
 
-namespace orxonox
-{
-    ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
+namespace orxonox {
+	ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
+	
 
-    RegisterAbstractClass(DialogManager).inheritsFrom<Listable>();
+	
+	DialogManager::DialogManager()
+	{
+		this->currentTalk_ = nullptr;
+	}
 
-    DialogManager::DialogManager()
-    {
-        RegisterObject(DialogManager);
-
-        this->currentTalk_ = NULL;
-    }
-
-    void DialogManager::setDialog(Dialog* dialog)
+	void DialogManager::setDialog(Dialog* dialog)
 	{
 		this->currentTalk_ = dialog;	
 	}
 
-	const Dialog* DialogManager::getCurrentDialog()
-	{
-		return this->currentTalk_;
-	}
-	
-	bool DialogManager::empty()
-	{
-		if(this->currentTalk_ == NULL)
-		{
-			return true;
-		}
-		else 
-		{
-			return false;
-		}
-	} 
+	//from here onward funcionality for lua axports
+
+    std::string DialogManager::getQuestion()
+    {
+    	return this->currentTalk_->getQuestionString();
+    }
+
+    /*
+    std::vector<std::string> DialogManager::getAnswers()
+    {
+    	// lua hat komisch arrays (eigentlich tables), wie implementiert man answers so das man nacher den key der gegeben antwort a
+    	// hat um ihn fuer update zu benutzen?
+    }
+	*/
 }

Modified: code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h	2017-11-30 14:35:25 UTC (rev 11612)
@@ -3,35 +3,40 @@
 
 #include "DialogPrereqs.h"
 #include "util/Singleton.h"
+#include "core/singleton/ScopedSingletonIncludes.h"
 #include "core/object/Listable.h"
 #include "Dialog.h"
 
-namespace orxonox
-{
-    class _DialogExport DialogManager : public Singleton<DialogManager>, public Listable
-    {
+#include <string>
+
+namespace orxonox //tolua_export
+
+{//tolua_export
+    class _OrxonoxExport DialogManager //tolua_export
+    : public Singleton<DialogManager>
+    {//tolua_export
         friend class Singleton<DialogManager>;
-
+    
         public:
-            DialogManager();
+        
+        DialogManager(); 
+        
 
-           // int getValue() const { return this->value_; }
+        static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //tolua_export
 
-        	static DialogManager& getInstance() { return Singleton<DialogManager>::getInstance(); } //toloa_export
+        void setDialog(Dialog* dialog);
 
-       	 	void setDialog(Dialog* dialog);
-        	const Dialog* getCurrentDialog();
-       		bool empty();
+        //from here on luafunctionality is declared
 
-            //form here on all lua functionality used in lua scrips is declared
+        std::string getQuestion(); //tolua_export
+        //std::vector<std::string> getAnswers();
 
+private:
+    static DialogManager* singletonPtr_s;
 
-        private:
-        	Dialog* currentTalk_;
-            //int value_;
+    Dialog* currentTalk_;
 
-            static DialogManager* singletonPtr_s;
-    };
-}
+    };//tolua_export
+}//tolua_export
 
 #endif /* _DialogManager_H__ */
\ No newline at end of file

Modified: code/branches/Dialog_HS17/src/modules/dialog/DialogPrereqs.h
===================================================================
--- code/branches/Dialog_HS17/src/modules/dialog/DialogPrereqs.h	2017-11-30 08:33:27 UTC (rev 11611)
+++ code/branches/Dialog_HS17/src/modules/dialog/DialogPrereqs.h	2017-11-30 14:35:25 UTC (rev 11612)
@@ -42,8 +42,8 @@
 // Shared library settings
 //-----------------------------------------------------------------------
 
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialogue_STATIC_BUILD)
-#  ifdef Dialogue_SHARED_BUILD
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Dialog_STATIC_BUILD)
+#  ifdef Dialog_SHARED_BUILD
 #    define _DialogExport __declspec(dllexport)
 #  else
 #    if defined( __MINGW32__ )



More information about the Orxonox-commit mailing list