Last change
on this file since 8073 was
7726,
checked in by konrad, 14 years ago
|
decision popup in ingame menu has been changed
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6145] | 1 | -- DecisionPopup.lua |
---|
| 2 | |
---|
[6746] | 3 | local P = createMenuSheet("DecisionPopup") |
---|
[6145] | 4 | |
---|
[7726] | 5 | P.buttonList = {} |
---|
| 6 | |
---|
| 7 | function P.onShow() |
---|
| 8 | --indices to iterate through buttonlist |
---|
| 9 | P.oldindex = -2 |
---|
| 10 | P.index = -1 |
---|
| 11 | end |
---|
| 12 | |
---|
| 13 | function P.onLoad() |
---|
| 14 | |
---|
| 15 | --button are arranged in a 1x2 matrix |
---|
| 16 | local item = { |
---|
| 17 | ["button"] = winMgr:getWindow("orxonox/DecisionPopup_button_yes"), |
---|
| 18 | ["function"] = P.button_yes |
---|
| 19 | } |
---|
| 20 | P.buttonList[1] = item |
---|
| 21 | |
---|
| 22 | local item = { |
---|
| 23 | ["button"] = winMgr:getWindow("orxonox/DecisionPopup_button_no"), |
---|
| 24 | ["function"] = P.button_no |
---|
| 25 | } |
---|
| 26 | P.buttonList[2] = item |
---|
| 27 | |
---|
| 28 | end |
---|
| 29 | |
---|
[6145] | 30 | function P.setCallback(functionPtr) |
---|
| 31 | P.functionPtr = functionPtr |
---|
| 32 | end |
---|
| 33 | |
---|
| 34 | function P.setText( text ) |
---|
| 35 | winMgr:getWindow("orxonox/DecisionPopup_text"):setText( text ) |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | -- events for ingamemenu |
---|
| 39 | function P.button_yes(e) |
---|
| 40 | if P.functionPtr ~= nil then |
---|
| 41 | P.functionPtr(true) |
---|
| 42 | end |
---|
[6746] | 43 | hideMenuSheet("DecisionPopup") |
---|
[6145] | 44 | end |
---|
| 45 | |
---|
| 46 | function P.button_no(e) |
---|
| 47 | if P.functionPtr ~= nil then |
---|
| 48 | P.functionPtr(false) |
---|
| 49 | end |
---|
[6746] | 50 | hideMenuSheet("DecisionPopup") |
---|
[6145] | 51 | end |
---|
| 52 | |
---|
[7726] | 53 | function P.onKeyPressed() |
---|
| 54 | buttonIteratorHelper(P.buttonList, code, P, 1, 2) |
---|
| 55 | end |
---|
| 56 | |
---|
[6145] | 57 | return P |
---|
| 58 | |
---|
Note: See
TracBrowser
for help on using the repository browser.