|
Last change
on this file since 7188 was
6720,
checked in by rgrieder, 16 years ago
|
|
"init" lua function —> "onLoad" to make it clear that it is a user function.
|
-
Property svn:eol-style set to
native
|
|
File size:
923 bytes
|
| Line | |
|---|
| 1 | -- GUISheet.lua |
|---|
| 2 | |
|---|
| 3 | local P = {} |
|---|
| 4 | _G[_REQUIREDNAME or "GUISheet"] = P |
|---|
| 5 | P.__index = P |
|---|
| 6 | |
|---|
| 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 |
|---|
| 12 | end |
|---|
| 13 | |
|---|
| 14 | -- Override this function if you need to do work on load |
|---|
| 15 | function P:onLoad() |
|---|
| 16 | end |
|---|
| 17 | |
|---|
| 18 | -- hide function for the GUI |
|---|
| 19 | function P:hide() |
|---|
| 20 | self.window:hide() |
|---|
| 21 | self.bVisible = false |
|---|
| 22 | end |
|---|
| 23 | |
|---|
| 24 | -- show function for the GUI |
|---|
| 25 | function P:show() |
|---|
| 26 | self.window:show() |
|---|
| 27 | self.bVisible = true |
|---|
| 28 | end |
|---|
| 29 | |
|---|
| 30 | function P:load() |
|---|
| 31 | -- Load the layout that describes the sheet |
|---|
| 32 | self.window = winMgr:loadWindowLayout(self.name .. ".layout") |
|---|
| 33 | if self.window == nil then |
|---|
| 34 | error("Could not load layout file for GUI sheet '"..self.name.."'") |
|---|
| 35 | end |
|---|
| 36 | -- Hide it at first |
|---|
| 37 | self:hide() |
|---|
| 38 | -- Allow sheets to do some work upon loading |
|---|
| 39 | self:onLoad() |
|---|
| 40 | return self |
|---|
| 41 | end |
|---|
| 42 | |
|---|
| 43 | return P |
|---|
Note: See
TracBrowser
for help on using the repository browser.