[11612] | 1 | -- Dialogue.lua |
---|
[11579] | 2 | |
---|
| 3 | local P = createMenuSheet("Dialog") |
---|
| 4 | |
---|
| 5 | P.wrapper = nil |
---|
[11612] | 6 | P.detailsWindows = {} |
---|
[11579] | 7 | |
---|
| 8 | P.showing = false |
---|
| 9 | |
---|
| 10 | -- Design parameters |
---|
| 11 | P.imageHeight = 50 |
---|
| 12 | P.detailImageSize = 100 |
---|
[11612] | 13 | P.textHeight = 50 |
---|
| 14 | P.buttonWidth = 50 |
---|
[11579] | 15 | |
---|
| 16 | function P.onLoad() |
---|
| 17 | P.wrapper = nil |
---|
| 18 | end |
---|
| 19 | |
---|
| 20 | function P.onShow() |
---|
[11612] | 21 | |
---|
[11579] | 22 | orxonox.CommandExecutor:execute("setTimeFactor 0") |
---|
| 23 | P.createDialog() |
---|
| 24 | P.showing = true |
---|
| 25 | |
---|
| 26 | end |
---|
| 27 | |
---|
| 28 | function P.onHide() |
---|
| 29 | orxonox.CommandExecutor:execute("setTimeFactor 1") |
---|
| 30 | P.showing = false |
---|
| 31 | P.cleanup(true) |
---|
| 32 | end |
---|
| 33 | |
---|
| 34 | function P.update() |
---|
| 35 | P.updateDialog() |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | function P.createDialog() |
---|
| 39 | |
---|
[11612] | 40 | local manager = orxonox.DialogManager:getInstance() |
---|
[11579] | 41 | |
---|
[11612] | 42 | ---[[ |
---|
[11579] | 43 | root = winMgr:getWindow("orxonox/Dialogue/Inventory") |
---|
[11612] | 44 | local question = orxonox.DialogueManager:getInstance():getquestion() |
---|
| 45 | root:setText(question) |
---|
[11579] | 46 | P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/Dialogue/Inventory/Wrapper") |
---|
| 47 | P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0))) |
---|
| 48 | root:addChildWindow(P.wrapper) |
---|
| 49 | |
---|
[11612] | 50 | --]] |
---|
| 51 | detailsButton = winMgr:createWindow("MenuWidgets/Button", "/DetailsButton") |
---|
| 52 | detailsButton:setPosition(CEGUI.UVector2(CEGUI.UDim(0.1, 0),CEGUI.UDim(0.5, (P.imageHeight-P.textHeight)/2))) |
---|
| 53 | detailsButton:setSize(CEGUI.UVector2(CEGUI.UDim(0.25, 0), CEGUI.UDim(0, P.textHeight))) |
---|
| 54 | detailsButton:setText("say") |
---|
| 55 | orxonox.GUIManager:subscribeEventHelper(detailsButton, "Clicked", P.name ..".Button_clicked") |
---|
| 56 | P.wrapper:addChildWindow(detailsButton) |
---|
| 57 | --]] |
---|
| 58 | |
---|
[11579] | 59 | end |
---|
| 60 | |
---|
| 61 | function P.updateDialog() |
---|
[11612] | 62 | --local questionn = orxonox.DialogueManager:getInstance():getquestion() |
---|
| 63 | --root:setText("test") |
---|
[11579] | 64 | end |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | function P.cleanup(destroyDetails) |
---|
| 68 | |
---|
| 69 | if P.wrapper ~= nil then |
---|
| 70 | winMgr:destroyWindow(P.wrapper) |
---|
| 71 | end |
---|
| 72 | |
---|
| 73 | --Destroy details windows. |
---|
| 74 | if destroyDetails == false then |
---|
| 75 | return |
---|
| 76 | end |
---|
| 77 | for k,v in pairs(P.detailsWindows) do |
---|
| 78 | if v ~= nil then |
---|
| 79 | P.destroyDetailWindow(k) |
---|
| 80 | end |
---|
| 81 | end |
---|
| 82 | |
---|
| 83 | end |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | |
---|
[11612] | 87 | function P.Button_clicked(e) |
---|
| 88 | --local ending = orxonox.DialogManager:getInstance():theEnd() |
---|
[11579] | 89 | |
---|
[11612] | 90 | --if ending then |
---|
[11579] | 91 | orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog") |
---|
| 92 | |
---|
[11612] | 93 | |
---|
| 94 | -- else |
---|
| 95 | -- orxonox.DialogueManager:getInstance():a1clicked() |
---|
| 96 | -- P.update() |
---|
| 97 | -- end |
---|
[11579] | 98 | end |
---|
| 99 | |
---|
| 100 | return P |
---|