Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 11642 was 11642, checked in by kuchlert, 7 years ago

erste version bei der listenauswahl funktioniert

File size: 2.5 KB
Line 
1-- Dialogue.lua
2
3local P = createMenuSheet("Dialog")
4
5P.wrapper = nil
6P.detailsWindows = {}
7P.showing = false
8
9-- Design parameters
10P.imageHeight = 50
11P.detailImageSize = 100
12P.textHeight = 50
13P.buttonWidth = 50
14
15function P.onLoad()
16    P.wrapper = nil
17end
18
19function P.onShow()
20
21    orxonox.CommandExecutor:execute("setTimeFactor 0")
22    P.createDialog()
23    P.showing = true
24
25end
26
27function P.onHide()
28    orxonox.CommandExecutor:execute("setTimeFactor 1")
29    P.showing = false
30    P.cleanup(true)
31end
32
33function P.createDialog()
34
35    local manager = orxonox.DialogManager:getInstance()
36   
37   
38    local personfield = winMgr:getWindow("orxonox/Dialog/Person")
39    local person = manager:getPerson()
40    personfield:setText(person)
41
42    local questionfiled = winMgr:getWindow("orxonox/Dialog/Question")
43    local question = manager:getQuestion()
44    questionfiled:setText(question)
45
46    listboxwindow = winMgr:getWindow("orxonox/AnsListbox")
47
48    local themeList = {}
49    --[[
50    table.insert(themeList, "Default")
51    table.insert(themeList, "Drum n' Bass")
52    table.insert(themeList, "8-Bit Style")
53    table.insert(themeList, "Corny Jazz")
54    table.insert(themeList, "Metal")
55    --]]
56    local anssize = manager:getSize()
57
58    for index = 0, anssize -1, 1 do
59        table.insert(themeList, manager:getAnswer(index))
60    end 
61
62    for k,v in pairs(themeList) do
63        item = CEGUI.createListboxTextItem(v)
64        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
65        CEGUI.toListbox(listboxwindow):addItem(item)
66    end
67end
68
69function P.updateDialog()
70    local manager = orxonox.DialogManager:getInstance()
71    --manager:update()
72
73    local questionfiled = winMgr:getWindow("orxonox/Dialog/Question")
74    local question = manager:getQuestion()
75    questionfiled:setText(question)
76end
77
78function P.answer_changed(e)
79    -- body
80end
81
82
83function P.cleanup(destroyDetails)
84   
85    if P.wrapper ~= nil then
86        winMgr:destroyWindow(P.wrapper)
87    end
88   
89    --Destroy details windows.
90    if destroyDetails == false then
91        return
92    end
93    for k,v in pairs(P.detailsWindows) do
94        if v ~= nil then
95            P.destroyDetailWindow(k)
96        end
97    end
98   
99end
100
101
102
103function P.Button_clicked(e)
104    local ending = orxonox.DialogManager:getInstance():endtest()
105    orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
106   
107    if ending then
108        orxonox.CommandExecutor:execute("OrxonoxOverlay toggleVisibility Dialog")
109   
110   
111    else 
112        P.updateDialog(index)
113    end
114end
115
116return P
Note: See TracBrowser for help on using the repository browser.