Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Dialog_HS17/data/gui/scripts/Dialog.lua @ 11612

Last change on this file since 11612 was 11612, checked in by kuchlert, 6 years ago

funktioniert bis dialogmanager getInstance, angefangen und noch zu tun: luafunktionen von dialogmanager, lua und layout

File size: 2.3 KB
Line 
1-- Dialogue.lua
2
3local P = createMenuSheet("Dialog")
4
5P.wrapper = nil
6P.detailsWindows = {}
7
8P.showing = false
9
10-- Design parameters
11P.imageHeight = 50
12P.detailImageSize = 100
13P.textHeight = 50
14P.buttonWidth = 50
15
16function P.onLoad()
17    P.wrapper = nil
18end
19
20function P.onShow()
21
22    orxonox.CommandExecutor:execute("setTimeFactor 0")
23    P.createDialog()
24    P.showing = true
25
26end
27
28function P.onHide()
29    orxonox.CommandExecutor:execute("setTimeFactor 1")
30    P.showing = false
31    P.cleanup(true)
32end
33
34function P.update()
35    P.updateDialog()
36end
37
38function 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
59end
60
61function P.updateDialog()
62    --local questionn = orxonox.DialogueManager:getInstance():getquestion()
63    --root:setText("test")
64end
65
66
67function 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   
83end
84
85
86
87function 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
98end
99
100return P
Note: See TracBrowser for help on using the repository browser.