Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Dialogue_FS17/data/gui/scripts/Dialogue.lua @ 11412

Last change on this file since 11412 was 11407, checked in by rrogge, 8 years ago

lua Buttons angefangen

File size: 2.5 KB
Line 
1--[[local P = createMenuSheet("Dialogue Window")
2
3function P.onLoad()
4        P.createWindow()
5        P.showing = true   
6end
7 function function_name( ... )
8        -- body
9 end
10
11
12
13
14function P.createWindow()
15   
16    local question = orxonox.DialogueManager:getInstance():getquestion()
17    local default = (winMgr:createWindow("DefaultWindow"))
18    default:setText(question)
19    default:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
20    default:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")
21   
22   
23
24
25   
26end
27local numOptions = DialogueManager:getnumOptions()
28    local counter = 1
29    local offset = 0
30    --create and name buttons while there are still options
31    while counter <= numOptions do
32       
33       
34    end]]
35-- Dialogue.lua
36
37local P = createMenuSheet("Dialogue")
38
39P.wrapper = nil
40P.detailsWindows = {}
41P.detailPickups = {}
42P.pickupsList = {}
43
44P.showing = false
45
46-- Design parameters
47P.imageHeight = 50
48P.detailImageSize = 100
49P.textHeight = 30
50P.buttonWidth = 85
51
52function P.onLoad()
53        orxout("loading")
54    P.wrapper = nil
55    P.detailsWindows = {}
56    P.detailPickups = {}
57    P.pickupsList = {}
58end
59
60function P.onShow()
61        orxout("showing")
62    P.createInventory()
63    P.showing = true
64end
65
66function P.onHide()
67    P.showing = false
68    P.cleanup(true)
69end
70
71function P.update()
72    if P.showing == false then
73        return
74    end
75
76    -- Update opened detail windows.
77   
78
79    -- Update main inventory.
80    P.cleanup(false)
81    P.createInventory()
82    -- TODO: Recover scrolling position
83   
84end
85
86function P.createInventory()
87    local pickupManager = orxonox.DialogueManager:getInstance()
88   
89    local root = winMgr:getWindow("orxonox/Dialogue/Inventory")
90    local question = orxonox.DialogueManager:getInstance():getquestion()
91    root:setText(question)
92    P.wrapper = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/Dialogue/Inventory/Wrapper")
93    P.wrapper:setSize(CEGUI.UVector2(CEGUI.UDim(1,0),CEGUI.UDim(1,0)))
94    root:addChildWindow(P.wrapper)
95    root:addChild(answerButton)
96   
97   
98
99end
100
101
102
103function P.cleanup(destroyDetails)
104    if P.wrapper ~= nil then
105        winMgr:destroyWindow(P.wrapper)
106    end
107   
108    --Destroy details windows.
109    if destroyDetails == false then
110        return
111    end
112    for k,v in pairs(P.detailsWindows) do
113        if v ~= nil then
114            P.destroyDetailWindow(k)
115        end
116    end
117end
118
119
120
121function P.InventoryBackButton_clicked(e)
122    orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialogue")
123end
124
125return P
Note: See TracBrowser for help on using the repository browser.