-- Dialog.lua local P = createMenuSheet("Dialog") P.wrapper = nil P.answerList = {} P.scrollbarWidht = 13 P.selectedAnswer = {} P.showing = false -- Design parameters P.imageHeight = 50 P.detailImageSize = 100 P.textHeight = 30 P.buttonWidth = 85 function P.onLoad() P.wrapper = nil end function P.onShow() orxonox.CommandExecutor:execute("setTimeFactor 0") P.createDialog() P.showing = true end function P.onHide() orxonox.CommandExecutor:execute("setTimeFactor 1") P.showing = false P.cleanup(true) end function P.update() P.updateDialog() if P.showing == false then return end P.cleanup(false) end function P.createDialog() local dialogManager = orxonox.DialogManager:getInstance() root = winMgr:getWindow("orxonox/Dialogue/Inventory") local dialog = dialogManager:getCurrentDialog() root:setText(dialog:getQuestion) 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 end function P.updateDialog() local dialog = orxonox.DialogManager:getInstance():getDialog() root:setText(dialog:getQuestion) --todo: tabellen updaten 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.acceptButton_clicked(e) local ending = orxonox.DialogManager:getInstance():getDialog:ending() if ending then orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog") --herausfindne wie tabelleneintrag uebergeben wird else P.update() end end return P