Last change
on this file since 6699 was
6659,
checked in by rgrieder, 15 years ago
|
Use "P." instead of "P:" when using our sheets as objects, not classes.
And use "P." instead of "self.".
This does not count for BasicGUI.lua because this is in fact seen as a class!!!
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Rev | Line | |
---|
[6363] | 1 | -- SingleplayerMenu.lua |
---|
| 2 | |
---|
[6621] | 3 | local P = createSheet("SingleplayerMenu") |
---|
[6363] | 4 | |
---|
[6659] | 5 | function P.init() |
---|
[6363] | 6 | listbox = winMgr:getWindow("orxonox/SingleplayerLevelListbox") |
---|
| 7 | preselect = orxonox.LevelManager:getInstance():getDefaultLevel() |
---|
| 8 | orxonox.LevelManager:getInstance():compileAvailableLevelList() |
---|
| 9 | local levelList = {} |
---|
| 10 | local index = 0 |
---|
| 11 | local level = "" |
---|
| 12 | while true do |
---|
| 13 | level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) |
---|
| 14 | if level == "" then |
---|
| 15 | break |
---|
| 16 | end |
---|
| 17 | table.insert(levelList, level) |
---|
| 18 | index = index + 1 |
---|
| 19 | end |
---|
| 20 | table.sort(levelList) |
---|
| 21 | for k,v in pairs(levelList) do |
---|
[6388] | 22 | item = CEGUI.createListboxTextItem(v) |
---|
[6571] | 23 | item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush") |
---|
[6363] | 24 | CEGUI.toListbox(listbox):addItem(item) |
---|
| 25 | if v .. ".oxw" == preselect then |
---|
| 26 | listbox:setItemSelectState(item, true) |
---|
| 27 | end |
---|
| 28 | end |
---|
| 29 | end |
---|
| 30 | |
---|
| 31 | function P.SingleplayerStartButton_clicked(e) |
---|
| 32 | choice = winMgr:getWindow("orxonox/SingleplayerLevelListbox"):getFirstSelectedItem() |
---|
| 33 | if choice then |
---|
| 34 | orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw") |
---|
[6403] | 35 | orxonox.execute("startGame") |
---|
[6363] | 36 | hideAllGUIs() |
---|
| 37 | end |
---|
| 38 | end |
---|
| 39 | |
---|
| 40 | function P.SingleplayerBackButton_clicked(e) |
---|
| 41 | hideGUI(P.filename) |
---|
| 42 | end |
---|
| 43 | |
---|
| 44 | return P |
---|
| 45 | |
---|
Note: See
TracBrowser
for help on using the repository browser.