[Orxonox-commit 6778] r11406 - in code/branches/Dialogue_FS17: data/gui/layouts data/gui/scripts data/tcl src/modules/dialogue
rrogge at orxonox.net
rrogge at orxonox.net
Thu Apr 27 15:37:04 CEST 2017
Author: rrogge
Date: 2017-04-27 15:36:57 +0200 (Thu, 27 Apr 2017)
New Revision: 11406
Added:
code/branches/Dialogue_FS17/data/gui/layouts/Dialogue.layout
code/branches/Dialogue_FS17/data/tcl/core
Removed:
code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.layout
code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.lua
Modified:
code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
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
Log:
Dialogfenster geht auf :D
Added: code/branches/Dialogue_FS17/data/gui/layouts/Dialogue.layout
===================================================================
--- code/branches/Dialogue_FS17/data/gui/layouts/Dialogue.layout (rev 0)
+++ code/branches/Dialogue_FS17/data/gui/layouts/Dialogue.layout 2017-04-27 13:36:57 UTC (rev 11406)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+ <Window Type="DefaultWindow" Name="orxonox/Dialogue/Background" >
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialogue/Inventory" >
+ <Property Name="Text" Value="Dialogue" />
+ <Property Name="Alpha" Value="0.8" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="HorzFormatting" Value="HorzCentred" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.15,0},{0.85,0},{0.8,0}}" />
+ <Window Type="MenuWidgets/Button" Name="orxonox/PickupInventory/InventoryBackButton" >
+ <Property Name="Text" Value="Back" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8350,0},{0.6,0},{0.8800,0}}" />
+ <Event Name="Clicked" Function="PickupInventory.InventoryBackButton_clicked"/>
+ </Window>
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/Dialogue/Wrapper" >
+ <Property Name="TextColours" Value="FF4444FF" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="HorzFormatting" Value="HorzCentred" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
+ </Window>
+ </Window>
+
+ </Window>
+</GUILayout>
\ No newline at end of file
Modified: code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua
===================================================================
--- code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua 2017-04-27 13:36:57 UTC (rev 11406)
@@ -34,7 +34,7 @@
end]]
-- Dialogue.lua
-local P = createMenuSheet("PickupInventory")
+local P = createMenuSheet("Dialogue")
P.wrapper = nil
P.detailsWindows = {}
@@ -74,42 +74,8 @@
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()
@@ -118,88 +84,21 @@
end
function P.createInventory()
- local pickupManager = orxonox.PickupManager:getInstance()
+ local pickupManager = orxonox.DialogueManager:getInstance()
- local root = winMgr:getWindow("orxonox/PickupInventory/Inventory")
- P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/PickupInventory/Inventory/Wrapper")
+ local root = winMgr:getWindow("orxonox/Dialogue/Inventory")
+ 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)
- 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)
@@ -216,160 +115,10 @@
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")
+ orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialogue")
end
return P
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-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/data/tcl/core 2017-04-27 13:36:57 UTC (rev 11406)
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/CMakeLists.txt
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/CMakeLists.txt 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/CMakeLists.txt 2017-04-27 13:36:57 UTC (rev 11406)
@@ -7,6 +7,8 @@
ORXONOX_ADD_LIBRARY(dialogue
MODULE
FIND_HEADER_FILES
+ TOLUA_FILES
+ DialogueManager.h
LINK_LIBRARIES
orxonox
SOURCE_FILES ${DIALOGUE_SRC_FILES}
Deleted: code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.layout
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.layout 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.layout 2017-04-27 13:36:57 UTC (rev 11406)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<GUILayout >
- <Window Type="DefaultWindow" Name="orxonox/PickupInventory/Background" >
- <Property Name="InheritsAlpha" Value="False" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
- <Window Type="MenuWidgets/StaticText" Name="orxonox/PickupInventory/PickupInventory" >
- <Property Name="Text" Value="Pickup Inventory" />
- <Property Name="Alpha" Value="0.8" />
- <Property Name="InheritsAlpha" Value="False" />
- <Property Name="HorzFormatting" Value="HorzCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="VertFormatting" Value="TopAligned" />
- <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.15,0},{0.85,0},{0.8,0}}" />
- <Window Type="MenuWidgets/StaticText" Name="orxonox/PickupInventory/Wrapper" >
- <Property Name="TextColours" Value="FF4444FF" />
- <Property Name="InheritsAlpha" Value="False" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="HorzFormatting" Value="HorzCentred" />
- <Property Name="VertFormatting" Value="TopAligned" />
- <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
- </Window>
- </Window>
- </Window>
-</GUILayout>
\ No newline at end of file
Deleted: code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.lua
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.lua 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/Dialogue.lua 2017-04-27 13:36:57 UTC (rev 11406)
@@ -1,31 +0,0 @@
-local P = createMenuSheet("Dialogue Window")
-
-function P.onLoad()
- P.createWindow()
-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]]
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.cc 2017-04-27 13:36:57 UTC (rev 11406)
@@ -21,6 +21,7 @@
DialogueManager* DialogueManager::singletonPtr_s =nullptr;
DialogueManager::DialogueManager(Context* context): BaseObject(context){
+ orxout() << "Dialog Konstruktor" << endl;
RegisterObject(DialogueManager);
@@ -33,11 +34,14 @@
*/
- void DialogueManager::setquestion(std::string question){
- question=question;
+ void DialogueManager::setquestion(std::string q){
+ orxout() << "setquestion" << endl;
+ question=q;
+ orxout() << "Question is " << question;
}
std::string DialogueManager::getquestion(void){
+ orxout() << question << endl;
return question;
}
/*void DialogueManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/DialogueManager.h 2017-04-27 13:36:57 UTC (rev 11406)
@@ -13,24 +13,25 @@
#include "core/XMLPort.h"
#include "core/EventIncludes.h"
-//tolua_begin
-namespace orxonox
-//tolua_end
-{//toluaexport
- class _OrxonoxExport DialogueManager : public Singleton<DialogueManager>, public BaseObject
- {
+
+namespace orxonox //tolua_export
+
+{//tolua_export
+ class _OrxonoxExport DialogueManager //tolua_export
+ : public Singleton<DialogueManager>, public BaseObject
+ {//tolua_export
friend class Singleton<DialogueManager>;
- //tolua_begin
+
public:
- DialogueManager(Context* context); // tolua_export
+ DialogueManager(Context* context);
- static DialogueManager& getInstance() { return Singleton<DialogueManager>::getInstance(); }
+ static DialogueManager& getInstance() { return Singleton<DialogueManager>::getInstance(); } //tolua_export
- void setquestion(std::string question);
- std::string getquestion(void);
+ void setquestion(std::string question); //tolua_export
+ std::string getquestion(void); //tolua_export
@@ -47,11 +48,12 @@
std::string npc;
std::vector<std::string> options;
- //tolua_end
+
*/
private:
std::string question;
static DialogueManager* singletonPtr_s;
- };//toluaexport
-}
+ };//tolua_export
+}//tolua_export
+
Modified: code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
===================================================================
--- code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc 2017-04-27 13:08:16 UTC (rev 11405)
+++ code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc 2017-04-27 13:36:57 UTC (rev 11406)
@@ -2,6 +2,7 @@
#include <string>
#include "core/CoreIncludes.h"
#include "core/GUIManager.h"
+#include "overlays/OrxonoxOverlay.h"
#include "NextQuestion.h"
@@ -15,14 +16,17 @@
{
RegisterObject(NextQuestion);
orxout() << "Klasse aufgerufen" << endl;
+ DialogueManager* d = new DialogueManager(context);
+
}
void NextQuestion::setquestion(std::string question){
- question=question;
+ this->question=question;
}
std::string NextQuestion::getquestion(void){
+ orxout() << question;
return question;
}
@@ -46,10 +50,17 @@
orxout() << "bTriggered is " << bTriggered << endl;
- for (DialogueManager* hud : ObjectList<DialogueManager>())
- m = hud;
- m->setquestion(question);
- //orxout() << " 1 " << mystring << endl;
+ //for (DialogueManager* hud : ObjectList<DialogueManager>())
+ //m = hud;
+
+ DialogueManager& m = DialogueManager::getInstance();
+
+ m.setquestion(question);
+ orxout() << " 1 " << endl;
+
+
+ OrxonoxOverlay::showOverlay("Dialogue");
+
return false;
}
More information about the Orxonox-commit
mailing list