[Orxonox-commit 6773] r11401 - in code/branches/Dialogue_FS17: data/gui/scripts data/levels data/overlays src/modules/dialogue

rrogge at orxonox.net rrogge at orxonox.net
Thu Apr 13 15:47:48 CEST 2017


Author: rrogge
Date: 2017-04-13 15:47:48 +0200 (Thu, 13 Apr 2017)
New Revision: 11401

Added:
   code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
Modified:
   code/branches/Dialogue_FS17/data/levels/events.oxw
   code/branches/Dialogue_FS17/data/overlays/HUDTemplates3.oxo
   code/branches/Dialogue_FS17/src/modules/dialogue/CMakeLists.txt
   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:
zeigt PickupInventory an

Added: code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
===================================================================
--- code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua	                        (rev 0)
+++ code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua	2017-04-13 13:47:48 UTC (rev 11401)
@@ -0,0 +1,375 @@
+--[[local P = createMenuSheet("Dialogue Window")
+
+function P.onLoad()
+	P.createWindow()
+	P.showing = true    
+end
+ function function_name( ... )
+ 	-- body
+ end
+
+
+
+
+function P.createWindow()
+    
+    local question = orxonox.DialogueManager:getInstance():getquestion()
+    local default = (winMgr:createWindow("DefaultWindow"))
+    default:setText(question)
+    default:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
+    default:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")
+    
+    
+
+
+    
+end
+local numOptions = DialogueManager:getnumOptions()
+    local counter = 1
+    local offset = 0
+    --create and name buttons while there are still options
+    while counter <= numOptions do
+        
+        
+    end]]
+-- Dialogue.lua
+
+local P = createMenuSheet("PickupInventory")
+
+P.wrapper = nil
+P.detailsWindows = {}
+P.detailPickups = {}
+P.pickupsList = {}
+
+P.showing = false
+
+-- Design parameters
+P.imageHeight = 50
+P.detailImageSize = 100
+P.textHeight = 30
+P.buttonWidth = 85
+
+function P.onLoad()
+	orxout("loading")
+    P.wrapper = nil
+    P.detailsWindows = {}
+    P.detailPickups = {}
+    P.pickupsList = {}
+end
+
+function P.onShow()
+	orxout("showing")
+    P.createInventory()
+    P.showing = true
+end
+
+function P.onHide()
+    P.showing = false
+    P.cleanup(true)
+end
+
+function P.update()
+    if P.showing == false then
+        return
+    end
+
+    -- Update opened detail windows.
+    for k,v in pairs(P.detailsWindows) do
+        if v ~= nil then
+            local pickup = P.detailPickups[k]
+            if pickup ~= nil and pickup ~= 0 then
+                local useButton = winMgr:getWindow("orxonox/PickupInventory/Details" .. k .. "/UseButton")
+                local dropButton = winMgr:getWindow("orxonox/PickupInventory/Details" .. k .. "/DropButton")
+                if orxonox.PickupManager:getInstance():isValidPickup(pickup.pickup) == false then
+                    useButton:setEnabled(false)
+                    dropButton:setEnabled(false)
+                    P.detailPickups[k] = nil
+                else
+                    useButton:setEnabled(true)
+                    if pickup.inUse == true then
+                        useButton:setText("unuse")
+                        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked")
+                        if pickup.usable == false then
+                            useButton:setEnabled(false)
+                        end
+                    else
+                        useButton:setText("use")
+                        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked")
+                        if pickup.unusable == false then
+                            useButton:setEnabled(false)
+                        end
+                    end
+
+                    if pickup.pickedUp == false then
+                        useButton:setEnabled(false)
+                        dropButton:setEnabled(false)
+                        P.detailPickups[k] = nil
+                    end
+                end
+            end
+        end
+    end
+
+    -- Update main inventory.
+    P.cleanup(false)
+    P.createInventory()
+    -- TODO: Recover scrolling position
+    
+end
+
+function P.createInventory()
+    local pickupManager = orxonox.PickupManager:getInstance()
+    
+    local root = winMgr:getWindow("orxonox/PickupInventory/Inventory")
+    P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/PickupInventory/Inventory/Wrapper")
+    P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0)))
+    root:addChildWindow(P.wrapper)
+    
+    P.pickupsList = {}
+
+    local numPickups = pickupManager:getNumPickups()
+    local counter = 1
+    local offset = 0
+    while counter <= numPickups do
+        local pickup = pickupManager:popPickup()
+        table.insert(P.pickupsList, pickup)
+        local window = P.createPickupEntry(counter, pickup)
+        window:setYPosition(CEGUI.UDim(0,offset))
+        offset = offset + window:getHeight():asAbsolute(1)
+        P.wrapper:addChildWindow(window)
+        counter = counter + 1
+    end
+
+end
+
+function P.createPickupEntry(index, pickup)
+    local representation = orxonox.PickupManager:getInstance():getRepresentation(pickup.representationName)
+
+    local name = "orxonox/PickupInventory/Box/Pickup" .. index
+
+    local item = winMgr:createWindow("MenuWidgets/StaticText", name)
+    item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, P.imageHeight)))
+    item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+
+    local image = winMgr:createWindow("MenuWidgets/StaticImage", name .. "/Image")
+    image:setProperty("Image", "set:PickupInventory image:" .. representation:getInventoryRepresentation())
+    image:setProperty("BackgroundEnabled", "set:False")
+    image:setProperty("FrameEnabled", "set:True")
+    image:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.imageHeight), CEGUI.UDim(0, P.imageHeight)))
+    item:addChildWindow(image)
+
+    local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Title")
+    title:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.imageHeight+5), CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))
+    title:setSize(CEGUI.UVector2(CEGUI.UDim(0.3, 0), CEGUI.UDim(0, P.textHeight)))
+    title:setText(representation:getPickupName())
+    title:setProperty("FrameEnabled", "set:False")
+    item:addChildWindow(title)
+
+    local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton")
+    useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+10),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))
+    useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
+    if pickup.inUse == false then
+        useButton:setText("use")
+        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseButton_clicked")
+        if pickup.usable == false then
+            useButton:setEnabled(false)
+        end
+    else
+        useButton:setText("unuse")
+        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseButton_clicked")
+        if pickup.unusable == false then
+            useButton:setEnabled(false)
+        end
+    end
+    item:addChildWindow(useButton)
+
+    local dropButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DropButton")
+    dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+15+P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))
+    dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
+    dropButton:setText("drop")
+    orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropButton_clicked")
+    item:addChildWindow(dropButton)
+
+    local detailsButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DetailsButton")
+    detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.3, P.imageHeight+20+2*P.buttonWidth),CEGUI.UDim(0, (P.imageHeight-P.textHeight)/2)))
+    detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
+    detailsButton:setText("details")
+    orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name .. ".InventoryDetailsButton_clicked")
+    item:addChildWindow(detailsButton)
+
+    return item
+end
+
+function P.cleanup(destroyDetails)
+    if P.wrapper ~= nil then
+        winMgr:destroyWindow(P.wrapper)
+    end
+    
+    --Destroy details windows.
+    if destroyDetails == false then
+        return
+    end
+    for k,v in pairs(P.detailsWindows) do
+        if v ~= nil then
+            P.destroyDetailWindow(k)
+        end
+    end
+end
+
+function P.windowToPickupHelper(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local pickupIndex = tonumber(match())
+
+    return pickupIndex
+end
+
+function P.createDetailsWindow(pickupIndex)
+    local pickup = P.pickupsList[pickupIndex]
+    local representation = orxonox.PickupManager:getInstance():getRepresentation(pickup.representationName)
+
+    local index = P.getNewDetailNumber()
+    local name = "orxonox/PickupInventory/Details" .. index
+    
+    local window = winMgr:createWindow("MenuWidgets/FrameWindow", name)
+    window:setSize(CEGUI.UVector2(CEGUI.UDim(0.5,0),CEGUI.UDim(0.4,0)))
+    orxonox.GUIManager:subscribeEventHelper(window, "CloseClicked", P.name .. ".closeDetailWindow")
+    
+    local root = winMgr:getWindow("orxonox/PickupInventory/Background")
+    root:addChildWindow(window)
+    
+    local wrapper = winMgr:createWindow("DefaultWindow", name .. "/Wrapper")
+    wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1, -20),CEGUI.UDim(1, -50)))
+    wrapper:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10),CEGUI.UDim(0, 40)))
+    window:addChildWindow(wrapper)
+    
+    local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Title")
+    title:setText(representation:getPickupName())
+    title:setHeight(CEGUI.UDim(0, P.textHeight))
+    title:setProperty("FrameEnabled", "set:False")
+    title:setProperty("BackgroundEnabled", "set:False")
+    wrapper:addChildWindow(title)
+    
+    local image = winMgr:createWindow("MenuWidgets/StaticImage", name .. "/Image")
+    image:setProperty("Image", "set:PickupInventory image:" .. representation:getInventoryRepresentation())
+    image:setProperty("BackgroundEnabled", "set:False")
+    image:setProperty("FrameEnabled", "set:True")
+    image:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize), CEGUI.UDim(0, P.detailImageSize)))
+    image:setYPosition(CEGUI.UDim(0, P.textHeight + 5))
+    wrapper:addChildWindow(image)
+    
+    local box = winMgr:createWindow("MenuWidgets/ScrollablePane", name .. "/Description")
+    box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -1*(P.detailImageSize + 10)),CEGUI.UDim(1, -(P.textHeight + 5 + P.textHeight + 20))))
+    box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize + 10),CEGUI.UDim(0, P.textHeight + 5)))
+    local description = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Description/Text")
+    description:setText(representation:getPickupDescription())
+    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
+    description:setProperty("VertFormatting", "TopAligned")
+    box:addChildWindow(description)
+    wrapper:addChildWindow(box)
+
+    local useButton = winMgr:createWindow("MenuWidgets/Button", name .. "/UseButton")
+    useButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize+10),CEGUI.UDim(1, -40)))
+    useButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
+    if pickup.inUse == false then
+        useButton:setText("use")
+        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUseDetailButton_clicked")
+        if pickup.usable == false then
+            useButton:setEnabled(false)
+        end
+    else
+        useButton:setText("unuse")
+        orxonox.GUIManager:subscribeEventHelper(useButton, "Clicked", P.name .. ".InventoryUnuseDetailButton_clicked")
+        if pickup.unusable == false then
+            useButton:setEnabled(false)
+        end
+    end
+    wrapper:addChildWindow(useButton)
+    
+    local dropButton = winMgr:createWindow("MenuWidgets/Button", name .. "/DropButton")
+    dropButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.detailImageSize+10+P.buttonWidth+10),CEGUI.UDim(1, -40)))
+    dropButton:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.buttonWidth), CEGUI.UDim(0, P.textHeight)))
+    dropButton:setText("drop")
+    orxonox.GUIManager:subscribeEventHelper(dropButton, "Clicked", P.name .. ".InventoryDropDetailButton_clicked")
+    wrapper:addChildWindow(dropButton)
+
+    P.detailsWindows[index] = window
+    P.detailPickups[index] = pickup
+    
+end
+
+function P.getNewDetailNumber()
+    local number = table.getn(P.detailsWindows)
+    for k,v in pairs(P.detailsWindows) do
+        if v == nil then
+            number = k-1
+        end
+    end
+    return number+1
+end
+
+function P.InventoryUseButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    local pickup = P.pickupsList[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, true)
+end
+
+function P.InventoryUnuseButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    local pickup = P.pickupsList[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, false)
+end
+
+function P.InventoryDropButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    local pickup = P.pickupsList[pickupIndex]
+    orxonox.PickupManager:getInstance():dropPickup(pickup.pickup)
+end
+
+function P.InventoryDetailsButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    P.createDetailsWindow(pickupIndex)
+end
+
+function P.InventoryUseDetailButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    local pickup = P.detailPickups[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, true)
+end
+
+function P.InventoryUnuseDetailButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    local pickup = P.detailPickups[pickupIndex]
+    orxonox.PickupManager:getInstance():usePickup(pickup.pickup, false)
+end
+
+function P.InventoryDropDetailButton_clicked(e)
+    local pickupIndex = P.windowToPickupHelper(e)
+    local pickup = P.detailPickups[pickupIndex]
+    orxonox.PickupManager:getInstance():dropPickup(pickup.pickup)
+end
+
+function P.closeDetailWindow(e)
+    --Get some numbers from the window
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+    local match = string.gmatch(name, "%d+")
+    local detailNr = tonumber(match())
+    
+    P.destroyDetailWindow(detailNr)
+end
+
+function P.destroyDetailWindow(detailNr)
+    local window = P.detailsWindows[detailNr]
+    winMgr:destroyWindow(window)
+    P.detailsWindows[detailNr] = nil
+    P.detailPickups[detailNr] = nil
+end
+
+function P.InventoryBackButton_clicked(e)
+    orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility PickupInventory")
+end
+
+return P

Modified: code/branches/Dialogue_FS17/data/levels/events.oxw
===================================================================
--- code/branches/Dialogue_FS17/data/levels/events.oxw	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/data/levels/events.oxw	2017-04-13 13:47:48 UTC (rev 11401)
@@ -57,14 +57,14 @@
     -->
 
 <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,0"/>
-    <DialogueManager question="Hello World3">
+    <Backlight position="0,0,0" visible=true frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,0,1"/>
+    <NextQuestion question="Hello World3">
       <events>
         <execute>
            <EventListener event="test" />
         </execute>
       </events>
-    </DialogueManager>
+    </NextQuestion>
 
     <!-- red -->
     <!--

Modified: code/branches/Dialogue_FS17/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/Dialogue_FS17/data/overlays/HUDTemplates3.oxo	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/data/overlays/HUDTemplates3.oxo	2017-04-13 13:47:48 UTC (rev 11401)
@@ -213,5 +213,11 @@
       visible = "false"
     />
 
+    <GUIOverlay
+      name = "Dialogue"
+      guiname = "Dialogue"
+      visible = "false"
+    />
+
   </OverlayGroup>
 </Template>

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/CMakeLists.txt
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/CMakeLists.txt	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/CMakeLists.txt	2017-04-13 13:47:48 UTC (rev 11401)
@@ -1,5 +1,6 @@
 SET_SOURCE_FILES(DIALOGUE_SRC_FILES
   DialogueManager.cc
+  NextQuestion.cc
  
 )
 

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc	2017-04-13 13:47:48 UTC (rev 11401)
@@ -40,31 +40,15 @@
 	std::string DialogueManager::getquestion(void){
 		return question;
 	}
-	void DialogueManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+	/*void DialogueManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(DialogueManager, XMLPort, xmlelement, mode);
 
         XMLPortParam(DialogueManager, "question", setquestion, getquestion, xmlelement, mode);
-    }
+    }*/
 
-	bool DialogueManager::execute(bool bTriggered, BaseObject* trigger)
-    {  
-        //if(!bTriggered) return false;
+	
 
-
-
-        orxout() << "bTriggered is " << bTriggered;
-        //orxout() << " 1 " << mystring << endl;
-        return false;
-    }
-
-    void DialogueManager::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(DialogueManager, XMLEventPort, xmlelement, mode);
-
-        XMLPortEventSink(DialogueManager, BaseObject, "execute", execute, xmlelement, mode); 
-    }
-
 	/*std::string DialogueManager::setnpc(std::string npc){
 		return npc;
 	}

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h	2017-04-13 13:47:48 UTC (rev 11401)
@@ -5,7 +5,6 @@
 #include "core/singleton/ScopedSingletonIncludes.h"
 #include "network/Host.h"
 #include "network/NetworkFunctionIncludes.h"
-#include "DialoguePrereqs.h"
 #include "util/Singleton.h"
 #include <string>
 #include <vector>
@@ -23,6 +22,7 @@
 		friend class Singleton<DialogueManager>;
 		//tolua_begin
 		public:
+		
 
 		DialogueManager(Context* context); // tolua_export
 		
@@ -29,15 +29,11 @@
 
 		static DialogueManager& getInstance() { return Singleton<DialogueManager>::getInstance(); } 
 		
-		virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
 		void setquestion(std::string question);
 		std::string getquestion(void);
+		
 
-
-		virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
-		bool execute(bool bTriggered, BaseObject* trigger);
-
+		
 	
 
 			/*std::string setnpc(std::string npc);

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc	2017-04-13 13:47:48 UTC (rev 11401)
@@ -1,6 +1,9 @@
 #include <vector>
 #include <string>
+#include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
 
+
 #include "NextQuestion.h"
 #include "core/XMLPort.h"
 
@@ -8,9 +11,55 @@
 
 	RegisterClass(NextQuestion);
 
-	vector<NextQuestion> nextquestion;
+	NextQuestion::NextQuestion(Context* context) : BaseObject(context)
+    {
+        RegisterObject(NextQuestion);
+        orxout() << "Klasse aufgerufen" << endl;
 
-	void NextQuestion::setanswers(std::string option1, std::string option2, std::string option3){
+    }
+
+	void NextQuestion::setquestion(std::string question){
+		question=question;
+	}
+
+	std::string NextQuestion::getquestion(void){
+		return question;
+	}
+
+	
+	//
+
+	
+	//XML and Event shit
+	void NextQuestion::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(NextQuestion, XMLPort, xmlelement, mode);
+
+        XMLPortParam(NextQuestion, "question", setquestion, getquestion, xmlelement, mode);
+    }
+	bool NextQuestion::execute(bool bTriggered, BaseObject* trigger)
+    {  
+        //if(!bTriggered) return false;
+    	
+        
+
+
+        orxout() << "bTriggered is " << bTriggered << endl;
+
+        for (DialogueManager* hud : ObjectList<DialogueManager>())
+            m = hud;
+        m->setquestion(question);
+        //orxout() << " 1 " << mystring << endl;
+        return false;
+    }
+
+    void NextQuestion::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(NextQuestion, XMLEventPort, xmlelement, mode);
+
+        XMLPortEventSink(NextQuestion, BaseObject, "execute", execute, xmlelement, mode); 
+    }
+	/*void NextQuestion::setanswers(std::string option1, std::string option2, std::string option3){
 		options.at(0)=option1;
 		options.at(1)=option2;
 		options.at(2)=option3;
@@ -22,6 +71,6 @@
 
 	int NextQuestion::getnumOptions(){
 		return options.size();
-	}
+	}*/
 
 }
\ No newline at end of file

Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h	2017-04-13 13:30:24 UTC (rev 11400)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.h	2017-04-13 13:47:48 UTC (rev 11401)
@@ -1,12 +1,47 @@
 #include <vector>
 #include <string>
-
+#include "core/class/Identifier.h"
+#include "OrxonoxPrereqs.h"
 #include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+#include "DialogueManager.h"
 
+
+
 namespace orxonox{
-	void setanswers(std::string option1, std::string option2, std::string option3);
-	std::vector <std::string> getanswers(void);
+	class _OrxonoxExport NextQuestion : public BaseObject
+	{
+		
+		//tolua_begin
+		public:
 
-	int getnumOptions();
-	std::vector<std::string> options;
+		NextQuestion (Context* context); // tolua_export
+		
+
+		void setquestion(std::string question);
+		std::string getquestion(void);
+
+
+		
+ 
+		
+		virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+		/*void setanswers(std::string option1, std::string option2, std::string option3);
+		std::vector <std::string> getanswers(void);
+
+		int getnumOptions();
+		std::vector<std::string> options;*/
+
+		//Event
+		virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+		bool execute(bool bTriggered, BaseObject* trigger);
+
+		
+	private:
+		std::string question;
+		DialogueManager* m;
+
+	};
+	
 }
\ No newline at end of file



More information about the Orxonox-commit mailing list