mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
reorganize modules
This commit is contained in:
18
modules/client_topmenu/topmenu.lua
Normal file
18
modules/client_topmenu/topmenu.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
TopMenu = {}
|
||||
|
||||
-- private variables
|
||||
local topMenu
|
||||
|
||||
-- public functions
|
||||
function TopMenu.create()
|
||||
topMenu = UI.display('topmenu.otui')
|
||||
end
|
||||
|
||||
function TopMenu.destroy()
|
||||
topMenu:destroy()
|
||||
topMenu = nil
|
||||
end
|
||||
|
||||
function TopMenu.getButton(id)
|
||||
return topMenu:getChildById(id)
|
||||
end
|
13
modules/client_topmenu/topmenu.otmod
Normal file
13
modules/client_topmenu/topmenu.otmod
Normal file
@@ -0,0 +1,13 @@
|
||||
Module
|
||||
name: client_topmenu
|
||||
description: Create the top menu
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
onLoad: |
|
||||
require 'topmenu'
|
||||
TopMenu.create()
|
||||
return true
|
||||
|
||||
onUnload: |
|
||||
TopMenu.destroy()
|
71
modules/client_topmenu/topmenu.otui
Normal file
71
modules/client_topmenu/topmenu.otui
Normal file
@@ -0,0 +1,71 @@
|
||||
TopPanel
|
||||
id: topMenu
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
focusable: false
|
||||
|
||||
TopButton
|
||||
id: settingsButton
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
margin-top: 4
|
||||
margin-left: 6
|
||||
tooltip: Options
|
||||
icon: /core_styles/icons/settings.png
|
||||
@onClick: Options.create()
|
||||
|
||||
|
||||
TopButton
|
||||
id: enterGameButton
|
||||
anchors.top: prev.top
|
||||
anchors.left: prev.right
|
||||
margin-left: 6
|
||||
tooltip: Enter game with a character
|
||||
icon: /core_styles/icons/login.png
|
||||
@onClick: |
|
||||
if Game.isOnline() then
|
||||
CharacterList.show()
|
||||
else
|
||||
EnterGame.show()
|
||||
end
|
||||
|
||||
TopButton
|
||||
id: motdButton
|
||||
anchors.top: prev.top
|
||||
anchors.left: prev.right
|
||||
margin-left: 6
|
||||
tooltip: Message of the day
|
||||
icon: /core_styles/icons/motd.png
|
||||
visible: false
|
||||
@onClick: EnterGame.displayMotd()
|
||||
|
||||
TopButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
margin-top: 4
|
||||
margin-right: 6
|
||||
tooltip: Logout
|
||||
icon: /core_styles/icons/logout.png
|
||||
@onClick: |
|
||||
if Game.isOnline() then
|
||||
Game.logout(false)
|
||||
else
|
||||
exit()
|
||||
end
|
||||
|
||||
TopButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: prev.left
|
||||
margin-top: 4
|
||||
margin-right: 6
|
||||
tooltip: About OTClient
|
||||
icon: /core_styles/icons/about.png
|
||||
@onClick: About.create()
|
||||
|
||||
FrameCounter
|
||||
id: frameCounter
|
||||
anchors.top: parent.top
|
||||
anchors.right: prev.left
|
||||
margin-top: 8
|
||||
margin-right: 12
|
Reference in New Issue
Block a user