Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gamestates2/data/gui/scripts/GUISheet.lua @ 6987

Last change on this file since 6987 was 6720, checked in by rgrieder, 15 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
RevLine 
[6718]1-- GUISheet.lua
[5491]2
3local P = {}
[6718]4_G[_REQUIREDNAME or "GUISheet"] = P
5P.__index = P
[5491]6
[6718]7-- Don't use directly --> use HUDSheet.new or MenuSheet.new
8function P.new(_name)
9    local newSheet = { name = _name }
10    setmetatable(newSheet, P)
11    return newSheet
[5491]12end
13
[6718]14-- Override this function if you need to do work on load
[6720]15function P:onLoad()
[5523]16end
17
[5491]18-- hide function for the GUI
[6595]19function P:hide()
[5491]20    self.window:hide()
[6718]21    self.bVisible = false
[5491]22end
23
24-- show function for the GUI
[6595]25function P:show()
[5491]26    self.window:show()
[6718]27    self.bVisible = true
[5491]28end
29
[6595]30function P:load()
[6718]31    -- Load the layout that describes the sheet
[6704]32    self.window = winMgr:loadWindowLayout(self.name .. ".layout")
[6718]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
[6720]39    self:onLoad()
[5559]40    return self
[5491]41end
42
[5661]43return P
Note: See TracBrowser for help on using the repository browser.