1 | -- Dialogue.lua |
---|
2 | |
---|
3 | local P = createMenuSheet("Dialog") |
---|
4 | |
---|
5 | P.wrapper = nil |
---|
6 | P.detailsWindows = {} |
---|
7 | |
---|
8 | P.showing = false |
---|
9 | |
---|
10 | -- Design parameters |
---|
11 | P.imageHeight = 50 |
---|
12 | P.detailImageSize = 100 |
---|
13 | P.textHeight = 50 |
---|
14 | P.buttonWidth = 50 |
---|
15 | |
---|
16 | function P.onLoad() |
---|
17 | P.wrapper = nil |
---|
18 | end |
---|
19 | |
---|
20 | function P.onShow() |
---|
21 | |
---|
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 | |
---|
40 | local manager = orxonox.DialogManager:getInstance() |
---|
41 | |
---|
42 | ---[[ |
---|
43 | root = winMgr:getWindow("orxonox/Dialogue/Inventory") |
---|
44 | local question = orxonox.DialogueManager:getInstance():getquestion() |
---|
45 | root:setText(question) |
---|
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 | |
---|
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 | |
---|
59 | end |
---|
60 | |
---|
61 | function P.updateDialog() |
---|
62 | --local questionn = orxonox.DialogueManager:getInstance():getquestion() |
---|
63 | --root:setText("test") |
---|
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 | |
---|
87 | function P.Button_clicked(e) |
---|
88 | --local ending = orxonox.DialogManager:getInstance():theEnd() |
---|
89 | |
---|
90 | --if ending then |
---|
91 | orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog") |
---|
92 | |
---|
93 | |
---|
94 | -- else |
---|
95 | -- orxonox.DialogueManager:getInstance():a1clicked() |
---|
96 | -- P.update() |
---|
97 | -- end |
---|
98 | end |
---|
99 | |
---|
100 | return P |
---|