add chat panel, send text messages, guard forbidden functions with an ifdef

This commit is contained in:
Eduardo Bart
2011-11-03 18:54:53 -02:00
parent 6d6479e4a9
commit b216b00a32
16 changed files with 142 additions and 37 deletions

View File

@@ -15,20 +15,23 @@ local function onGameKeyPress(self, keyCode, keyChar, keyboardModifiers)
end
-- public functions
function Game.create()
function Game.createInterface()
Background.hide()
CharacterList.destroyLoadBox()
Game.gameUi = loadUI('/game/ui/gameinterface.otui', UI.root)
Game.gameMapPanel = Game.gameUi:getChildById('mapPanel')
Game.gameRightPanel = Game.gameUi:getChildById('rightPanel')
Game.gameBottomPanel = Game.gameUi:getChildById('bottomPanel')
Game.gameUi.onKeyPress = onGameKeyPress
TextMessage.create()
end
function Game.destroy()
function Game.destroyInterface()
if Game.gameUi then
Game.gameUi:destroy()
Game.gameUi = nil
end
Background.show()
CharacterList.show()
end
function Game.show()
@@ -42,12 +45,6 @@ function Game.hide()
end
-- hooked events
function Game.onLogin()
Background.hide()
CharacterList.destroyLoadBox()
Game.show()
end
function Game.onLoginError(message)
CharacterList.destroyLoadBox()
local errorBox = displayErrorBox("Login Error", "Login error: " .. message)
@@ -60,8 +57,5 @@ function Game.onConnectionError(message)
errorBox.onOk = CharacterList.show
end
function Game.onLogout()
Game.hide()
Background.show()
CharacterList.show()
end
connect(Game, { onLogin = Game.createInterface,
onLogout = Game.destroyInterface })

View File

@@ -13,7 +13,4 @@ Module
onLoad: |
require 'game'
require 'textmessage'
Game.create()
Game.hide()
return true