Last change
on this file since 7749 was
7689,
checked in by dafrick, 14 years ago
|
Merging menu branch to trunk.
|
-
Property svn:eol-style set to
native
|
File size:
1.4 KB
|
Rev | Line | |
---|
[6718] | 1 | -- GUISheet.lua |
---|
[5491] | 2 | |
---|
| 3 | local P = {} |
---|
[6718] | 4 | _G[_REQUIREDNAME or "GUISheet"] = P |
---|
| 5 | P.__index = P |
---|
[5491] | 6 | |
---|
[6718] | 7 | -- Don't use directly --> use HUDSheet.new or MenuSheet.new |
---|
| 8 | function P.new(_name) |
---|
| 9 | local newSheet = { name = _name } |
---|
| 10 | setmetatable(newSheet, P) |
---|
| 11 | return newSheet |
---|
[5491] | 12 | end |
---|
| 13 | |
---|
[6718] | 14 | -- Override this function if you need to do work on load |
---|
[6720] | 15 | function P:onLoad() |
---|
[5523] | 16 | end |
---|
| 17 | |
---|
[6747] | 18 | -- show function for the GUI |
---|
| 19 | function P:show() |
---|
| 20 | self.window:show() |
---|
| 21 | self.bVisible = true |
---|
| 22 | |
---|
| 23 | self:onShow() |
---|
| 24 | end |
---|
| 25 | |
---|
| 26 | -- Override this function if you need to do work on show |
---|
| 27 | function P:onShow() |
---|
| 28 | end |
---|
| 29 | |
---|
[5491] | 30 | -- hide function for the GUI |
---|
[6595] | 31 | function P:hide() |
---|
[5491] | 32 | self.window:hide() |
---|
[6718] | 33 | self.bVisible = false |
---|
[6747] | 34 | |
---|
| 35 | self:onHide() |
---|
[5491] | 36 | end |
---|
| 37 | |
---|
[6747] | 38 | -- Override this function if you need to do work on hide |
---|
| 39 | function P:onHide() |
---|
[5491] | 40 | end |
---|
| 41 | |
---|
[7403] | 42 | -- Override this function if you need to do work just after the sheet has been hidden |
---|
| 43 | function P:afterHide() |
---|
| 44 | end |
---|
| 45 | |
---|
[6595] | 46 | function P:load() |
---|
[6718] | 47 | -- Load the layout that describes the sheet |
---|
[6704] | 48 | self.window = winMgr:loadWindowLayout(self.name .. ".layout") |
---|
[6718] | 49 | if self.window == nil then |
---|
| 50 | error("Could not load layout file for GUI sheet '"..self.name.."'") |
---|
| 51 | end |
---|
| 52 | -- Hide it at first |
---|
| 53 | self:hide() |
---|
| 54 | -- Allow sheets to do some work upon loading |
---|
[6720] | 55 | self:onLoad() |
---|
[6748] | 56 | |
---|
| 57 | -- Also load additional sheets to avoid display lags |
---|
| 58 | if self.loadAlong then |
---|
| 59 | for k, sheet in pairs(self.loadAlong) do |
---|
| 60 | loadSheet(sheet) |
---|
| 61 | end |
---|
| 62 | end |
---|
[5559] | 63 | return self |
---|
[5491] | 64 | end |
---|
| 65 | |
---|
[7689] | 66 | function P:onKeyPressed(e) |
---|
| 67 | end |
---|
| 68 | |
---|
[5661] | 69 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.