reorganize modules
|
@ -0,0 +1,22 @@
|
|||
Background = { }
|
||||
|
||||
-- private variables
|
||||
local background
|
||||
|
||||
-- public functions
|
||||
function Background.create()
|
||||
background = UI.loadAndDisplay('/background/background.otui')
|
||||
end
|
||||
|
||||
function Background.destroy()
|
||||
background:destroy()
|
||||
background = nil
|
||||
end
|
||||
|
||||
function Background.hide()
|
||||
background:hide()
|
||||
end
|
||||
|
||||
function Background.show()
|
||||
background:show()
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
Module
|
||||
name: background
|
||||
description: Handles the background of the login screen
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
- topmenu
|
||||
|
||||
onLoad: |
|
||||
require 'background'
|
||||
Background.create()
|
||||
return true
|
||||
|
||||
onUnload:
|
||||
Background.destroy()
|
||||
|
|
@ -1,13 +1,7 @@
|
|||
MenuButton < Button
|
||||
margin.bottom: 11
|
||||
margin.left: 20
|
||||
margin.right: 20
|
||||
|
||||
|
||||
Panel
|
||||
id: mainMenuBackground
|
||||
id: background
|
||||
image:
|
||||
source: /mainmenu/ui/background.png
|
||||
source: /background/background.png
|
||||
smooth: true
|
||||
fixed ratio: true
|
||||
anchors.top: topMenu.bottom
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
@ -3,7 +3,6 @@ Module
|
|||
description: Console for executing lua functions
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
version: 0.2
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
|
|
|
@ -7,19 +7,17 @@ Module
|
|||
autoLoad: true
|
||||
dependencies:
|
||||
- core_fonts
|
||||
- core_ui
|
||||
- core_styles
|
||||
|
||||
onLoad: |
|
||||
require 'ext/table'
|
||||
require 'ext/string'
|
||||
require 'constants'
|
||||
require 'util'
|
||||
require 'widget'
|
||||
require 'messagebox/messagebox'
|
||||
require 'dispatcher'
|
||||
|
||||
require 'widget'
|
||||
require 'ui'
|
||||
require 'gfx'
|
||||
require 'messagebox/messagebox'
|
||||
return true
|
||||
|
||||
onUnload: |
|
||||
rootWidget = nil
|
||||
|
||||
|
|
|
@ -20,11 +20,3 @@ function UI.displayLocked(widget)
|
|||
UI.root:addChild(widget)
|
||||
UI.root:lockChild(widget)
|
||||
end
|
||||
|
||||
importStyles('styles/buttons.otui')
|
||||
importStyles('styles/labels.otui')
|
||||
importStyles('styles/panels.otui')
|
||||
importStyles('styles/separators.otui')
|
||||
importStyles('styles/lineedits.otui')
|
||||
importStyles('styles/windows.otui')
|
||||
importStyles('styles/listboxes.otui')
|
|
@ -3,8 +3,6 @@ Module
|
|||
description: Contains fonts used by core
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
version: 0.2
|
||||
autoLoad: true
|
||||
onLoad: |
|
||||
importFont('verdana-11px-antialised')
|
||||
importFont('verdana-11px-monochrome')
|
||||
|
|
After Width: | Height: | Size: 9.7 KiB |
|
@ -1,7 +1,6 @@
|
|||
Font
|
||||
name: terminus-14px-bold
|
||||
height: 16
|
||||
spacing: 0 0
|
||||
top margin: 2
|
||||
texture: terminus-14px-bold.png
|
||||
glyph size: 16 16
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Font
|
||||
name: verdana-11px-antialised
|
||||
height: 14
|
||||
texture: verdana-11px-antialised.png
|
||||
height: 14
|
||||
glyph size: 16 16
|
||||
|
||||
glyph widths:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Font
|
||||
name: verdana-11px-monochrome
|
||||
height: 14
|
||||
texture: verdana-11px-monochrome.png
|
||||
height: 14
|
||||
glyph size: 16 16
|
||||
|
||||
glyph widths:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Font
|
||||
name: verdana-11px-rounded
|
||||
height: 14
|
||||
texture: verdana-11px-rounded.png
|
||||
height: 14
|
||||
glyph size: 16 16
|
||||
|
||||
glyph widths:
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
Module
|
||||
name: core_styles
|
||||
description: Contains ui styles used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
dependencies:
|
||||
- core_fonts
|
||||
onLoad: |
|
||||
importStyles 'styles/buttons.otui'
|
||||
importStyles 'styles/labels.otui'
|
||||
importStyles 'styles/panels.otui'
|
||||
importStyles 'styles/separators.otui'
|
||||
importStyles 'styles/lineedits.otui'
|
||||
importStyles 'styles/windows.otui'
|
||||
importStyles 'styles/listboxes.otui'
|
||||
return true
|
||||
|
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 763 B |
Before Width: | Height: | Size: 932 B After Width: | Height: | Size: 932 B |
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 696 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 385 B |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 660 B |
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 825 B |
Before Width: | Height: | Size: 833 B After Width: | Height: | Size: 833 B |
Before Width: | Height: | Size: 859 B After Width: | Height: | Size: 859 B |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
@ -5,18 +5,18 @@ Button < UIButton
|
|||
size: 106 24
|
||||
text-translate: 0 0
|
||||
border-image:
|
||||
source: /core_ui/images/button.png
|
||||
source: /core_styles/images/button.png
|
||||
border: 5
|
||||
|
||||
state.hover:
|
||||
border-image:
|
||||
source: /core_ui/images/button_hover.png
|
||||
source: /core_styles/images/button_hover.png
|
||||
border: 5
|
||||
|
||||
state.pressed:
|
||||
text-translate: 1 1
|
||||
border-image:
|
||||
source: /core_ui/images/button_down.png
|
||||
source: /core_styles/images/button_down.png
|
||||
border: 5
|
||||
|
||||
state.disabled:
|
||||
|
@ -28,13 +28,13 @@ TopButton < UIButton
|
|||
size: 26 25
|
||||
text-translate: 0 0
|
||||
border-image:
|
||||
source: /core_ui/images/top_button.png
|
||||
source: /core_styles/images/top_button.png
|
||||
size: 26 25
|
||||
border: 3
|
||||
|
||||
state.hover:
|
||||
border-image:
|
||||
source: /core_ui/images/top_button.png
|
||||
source: /core_styles/images/top_button.png
|
||||
size: 26 25
|
||||
offset: 26 0
|
||||
border: 3
|
||||
|
@ -42,7 +42,7 @@ TopButton < UIButton
|
|||
state.pressed:
|
||||
text-translate: 1 1
|
||||
border-image:
|
||||
source: /core_ui/images/top_button.png
|
||||
source: /core_styles/images/top_button.png
|
||||
size: 26 25
|
||||
offset: 52 0
|
||||
border: 3
|
|
@ -4,7 +4,7 @@ LineEdit < UILineEdit
|
|||
size: 86 20
|
||||
text margin: 3
|
||||
border-image:
|
||||
source: /core_ui/images/panel_flat.png
|
||||
source: /core_styles/images/panel_flat.png
|
||||
border: 1
|
||||
|
||||
PasswordLineEdit < LineEdit
|
|
@ -0,0 +1,5 @@
|
|||
TextList < UIWidget
|
||||
layout: verticalBox
|
||||
border-image:
|
||||
source: /core_styles/images/panel_flat.png
|
||||
border: 4
|
|
@ -3,21 +3,21 @@ Panel < UIWidget
|
|||
|
||||
FlatPanel < Panel
|
||||
border-image:
|
||||
source: /core_ui/images/panel_flat.png
|
||||
source: /core_styles/images/panel_flat.png
|
||||
border: 4
|
||||
|
||||
TopPanel < Panel
|
||||
height: 34
|
||||
image:
|
||||
source: /core_ui/images/top_panel.png
|
||||
source: /core_styles/images/top_panel.png
|
||||
repeated: true
|
||||
|
||||
RoundedPanel < Panel
|
||||
background-color: #ffffffdd
|
||||
border-image:
|
||||
source: /core_ui/images/panel_rounded.png
|
||||
source: /core_styles/images/panel_rounded.png
|
||||
border: 4
|
||||
|
||||
|
||||
RectPanel < UIWidget
|
||||
image: /core_ui/images/empty_rect.png
|
||||
image: /core_styles/images/empty_rect.png
|
|
@ -1,6 +1,6 @@
|
|||
HorizontalSeparator < UIWidget
|
||||
border-image:
|
||||
source: /core_ui/images/horizontal_separator.png
|
||||
source: /core_styles/images/horizontal_separator.png
|
||||
border.top: 2
|
||||
height: 2
|
||||
phantom: true
|
|
@ -6,7 +6,7 @@ Window < UIWindow
|
|||
head height: 20
|
||||
head text align: center
|
||||
border-image:
|
||||
source: /core_ui/images/window.png
|
||||
source: /core_styles/images/window.png
|
||||
border: 4
|
||||
border.top: 20
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
Module
|
||||
name: core_ui
|
||||
description: Contains ui styles used by other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
version: 0.2
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core_fonts
|
||||
onLoad: |
|
||||
require 'ui'
|
||||
return true
|
||||
|
Before Width: | Height: | Size: 171 B |
|
@ -1,5 +0,0 @@
|
|||
TextList < UIWidget
|
||||
layout: verticalBox
|
||||
border-image:
|
||||
source: /core_ui/images/panel_flat.png
|
||||
border: 4
|
|
@ -56,7 +56,7 @@ function CharacterList.create(characters, premDays)
|
|||
charactersWindow:destroy()
|
||||
end
|
||||
|
||||
charactersWindow = UI.loadAndDisplay('/mainmenu/ui/charlist.otui')
|
||||
charactersWindow = UI.loadAndDisplay('/entergame/characterlist.otui')
|
||||
characterList = charactersWindow:getChildById('characterList')
|
||||
local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel')
|
||||
charactersWindow.onKeyPress = onCharactersWindowKeyPress
|
||||
|
@ -89,7 +89,7 @@ function CharacterList.hide()
|
|||
charactersWindow:hide()
|
||||
end
|
||||
|
||||
function CharacterList.close()
|
||||
function CharacterList.destroy()
|
||||
CharacterList.hide()
|
||||
EnterGame.show()
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
CharacterListLabel < Label
|
||||
image: /core_ui/images/empty_rect.png
|
||||
image: /core_styles/images/empty_rect.png
|
||||
font: verdana-11px-monochrome
|
||||
background-color: #00000000
|
||||
offset: 2 0
|
||||
|
@ -14,10 +14,10 @@ CharacterListLabel < Label
|
|||
|
||||
MainWindow
|
||||
id: charactersWindow
|
||||
title: Charlist
|
||||
title: Character List
|
||||
size: 250 250
|
||||
onEnter: CharacterList.doLogin()
|
||||
onEscape: CharacterList.close()
|
||||
onEscape: CharacterList.destroy()
|
||||
|
||||
TextList
|
||||
id: characterList
|
||||
|
@ -65,4 +65,4 @@ MainWindow
|
|||
anchors.bottom: parent.bottom
|
||||
margin.bottom: 16
|
||||
margin.right: 16
|
||||
onClick: CharacterList.close()
|
||||
onClick: CharacterList.destroy()
|
|
@ -2,7 +2,7 @@ EnterGame = { }
|
|||
|
||||
-- private variables
|
||||
local loadBox
|
||||
local enterGameWindow
|
||||
local enterGame
|
||||
local motdNumber
|
||||
local motdMessage
|
||||
|
||||
|
@ -32,25 +32,26 @@ local function onCharacterList(protocol, characters, premDays)
|
|||
end
|
||||
|
||||
-- public functions
|
||||
function EnterGame.show()
|
||||
if not enterGameWindow then
|
||||
enterGameWindow = UI.loadAndDisplay('/mainmenu/ui/entergamewindow.otui')
|
||||
end
|
||||
enterGameWindow:show()
|
||||
end
|
||||
|
||||
function EnterGame.hide()
|
||||
enterGameWindow:hide()
|
||||
function EnterGame.create()
|
||||
enterGame = UI.loadAndDisplay('/entergame/entergame.otui')
|
||||
end
|
||||
|
||||
function EnterGame.destroy()
|
||||
enterGameWindow:destroy()
|
||||
enterGameWindow = nil
|
||||
enterGame:destroy()
|
||||
enterGame = nil
|
||||
end
|
||||
|
||||
function EnterGame.show()
|
||||
enterGame:show()
|
||||
end
|
||||
|
||||
function EnterGame.hide()
|
||||
enterGame:hide()
|
||||
end
|
||||
|
||||
function EnterGame.doLogin()
|
||||
EnterGame.account = enterGameWindow:getChildById('accountNameLineEdit'):getText()
|
||||
EnterGame.password = enterGameWindow:getChildById('accountPasswordLineEdit'):getText()
|
||||
EnterGame.account = enterGame:getChildById('accountNameLineEdit'):getText()
|
||||
EnterGame.password = enterGame:getChildById('accountPasswordLineEdit'):getText()
|
||||
EnterGame.hide()
|
||||
|
||||
local protocolLogin = ProtocolLogin.create()
|
|
@ -0,0 +1,21 @@
|
|||
Module
|
||||
name: entergame
|
||||
description: Manages enter game and character list windows
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
- topmenu
|
||||
- background
|
||||
|
||||
onLoad: |
|
||||
require 'entergame'
|
||||
require 'characterlist'
|
||||
EnterGame.create()
|
||||
return true
|
||||
|
||||
onUnload:
|
||||
EnterGame.destroy()
|
||||
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
MainWindow
|
||||
id: enterGameWindow
|
||||
id: enterGame
|
||||
title: Enter Game
|
||||
size: 236 160
|
||||
onEnter: EnterGame.doLogin()
|
||||
onEscape: function(self) self:destroy() end
|
||||
onEscape: EnterGame.hide()
|
||||
|
||||
LargerLabel
|
||||
text: Account name
|
||||
|
@ -54,4 +54,4 @@ MainWindow
|
|||
anchors.bottom: parent.bottom
|
||||
margin.bottom: 16
|
||||
margin.right: 16
|
||||
onClick: function(self) self:getParent():destroy() end
|
||||
onClick: EnterGame.hide()
|
|
@ -35,7 +35,7 @@ end
|
|||
|
||||
-- public functions
|
||||
function Game.onLogin()
|
||||
MainMenu.hide()
|
||||
Background.hide()
|
||||
CharacterList.destroyLoadBox()
|
||||
createMainInterface()
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ function Game.onConnectionError(message)
|
|||
end
|
||||
|
||||
function Game.onLogout()
|
||||
MainMenu.show()
|
||||
Background.show()
|
||||
CharacterList.show()
|
||||
destroyMainInterface()
|
||||
end
|
||||
|
|
|
@ -8,10 +8,10 @@ Module
|
|||
dependencies:
|
||||
- core
|
||||
- tibiafiles
|
||||
- topmenu
|
||||
- entergame
|
||||
- background
|
||||
|
||||
onLoad: |
|
||||
require 'game'
|
||||
return true
|
||||
|
||||
onUnload: |
|
||||
-- nothing yet
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
UIWidget
|
||||
id: gameRootInterface
|
||||
anchors.fill: parent
|
||||
anchors.top: topMenu.bottom
|
||||
margin.top: 1
|
||||
|
||||
UIMap
|
||||
id: gameMap
|
||||
anchors.fill:parent
|
||||
margin.right: 200
|
||||
|
||||
Button
|
||||
anchors.left: gameMap.right
|
||||
anchors.top: parent.top
|
||||
text: Logout
|
||||
onClick: Game.logout(false)
|
|
@ -1,15 +0,0 @@
|
|||
Module
|
||||
name: gfx
|
||||
description: Contains utilities for generating graphics effects
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
version: 0.2
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
onLoad: |
|
||||
require 'gfx'
|
||||
return true
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
MainMenu = { }
|
||||
|
||||
-- private variables
|
||||
local mainMenu
|
||||
|
||||
-- public functions
|
||||
function MainMenu.create()
|
||||
mainMenu = UI.loadAndDisplay("/mainmenu/ui/mainmenu.otui")
|
||||
end
|
||||
|
||||
function MainMenu.destroy()
|
||||
mainMenu:destroy()
|
||||
mainMenu = nil
|
||||
end
|
||||
|
||||
function MainMenu.hide()
|
||||
mainMenu:hide()
|
||||
end
|
||||
|
||||
function MainMenu.show()
|
||||
mainMenu:show()
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
Module
|
||||
name: mainmenu
|
||||
description: Create the game main menu
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
version: 0.2
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- core
|
||||
- topmenu
|
||||
|
||||
onLoad: |
|
||||
require 'mainmenu'
|
||||
require 'entergame'
|
||||
require 'characterlist'
|
||||
|
||||
if not initialized then
|
||||
MainMenu.create()
|
||||
EnterGame.show()
|
||||
initialized = true
|
||||
end
|
||||
return true
|
||||
|
||||
onUnload: |
|
||||
MainMenu.destroy()
|
||||
initialized = false
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
RoundedRectPanel
|
||||
id: loginPanel
|
||||
background-color: #000000e5
|
||||
size: 192 164
|
||||
anchors.centerIn: parent
|
||||
margin.top: 64
|
||||
opacity: 0
|
||||
|
||||
LargerLabel
|
||||
text: Account name
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
margin.left: 16
|
||||
margin.top: 12
|
||||
|
||||
LineEdit
|
||||
id: accountNameLineEdit
|
||||
text: otclient0
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
margin.left: 14
|
||||
margin.right: 14
|
||||
|
||||
LargerLabel
|
||||
text: Password
|
||||
anchors.left: parent.left
|
||||
anchors.top: prev.bottom
|
||||
margin.left: 16
|
||||
margin.top: 8
|
||||
|
||||
PasswordLineEdit
|
||||
id: accountPasswordLineEdit
|
||||
text: 123456
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
margin.left: 14
|
||||
margin.right: 14
|
||||
|
||||
Button
|
||||
id: loginButton
|
||||
text: Login
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
margin.bottom: 20
|
||||
onClick: EnterGame.doLogin()
|
Before Width: | Height: | Size: 5.4 KiB |
|
@ -1 +1 @@
|
|||
--UI.loadAndDisplayLocked('/mainmenu/ui/charlist.otui')
|
||||
-- place any code for testing purposes here
|
|
@ -6,6 +6,7 @@ TopPanel
|
|||
focusable: false
|
||||
|
||||
TopButton
|
||||
id: settingsButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
margin.top: 3
|
||||
|
@ -13,7 +14,7 @@ TopPanel
|
|||
|
||||
UIWidget
|
||||
size: 16 16
|
||||
image: /core_ui/icons/settings.png
|
||||
image: /core_styles/icons/settings.png
|
||||
anchors.centerIn: parent
|
||||
phantom: true
|
||||
|
||||
|
@ -21,10 +22,11 @@ TopPanel
|
|||
anchors.top: prev.top
|
||||
anchors.left: prev.right
|
||||
margin.left: 6
|
||||
onClick: EnterGame.show()
|
||||
|
||||
UIWidget
|
||||
size: 16 16
|
||||
image: /core_ui/icons/login.png
|
||||
image: /core_styles/icons/login.png
|
||||
anchors.centerIn: parent
|
||||
phantom: true
|
||||
|
||||
|
@ -33,9 +35,15 @@ TopPanel
|
|||
anchors.right: parent.right
|
||||
margin.top: 3
|
||||
margin.right: 6
|
||||
onClick: |
|
||||
if Game.isOnline() then
|
||||
Game.logout(false)
|
||||
else
|
||||
exit()
|
||||
end
|
||||
|
||||
UIWidget
|
||||
size: 16 16
|
||||
image: /core_ui/icons/logout.png
|
||||
image: /core_styles/icons/logout.png
|
||||
anchors.centerIn: parent
|
||||
phantom: true
|