mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
BEAWARE all game functionality is disabled with this commit for a while
* rework client modules * hide main window when loading * remake top menu functions * rework modules autoload * improve path resolving for otml and lua * move core_widgets to core_lib * fix tooltip issues * split some styles * add bit32 lua library * fix assert issues * fix compilation on linux 32 systems * rework gcc compile options * renable and fix some warnings * remove unused constants * speedup sprite cache * move UIGame to lua (not funcional yet) * fix a lot of issues in x11 window * fix crash handler * add some warnings do uiwidget and much more...
This commit is contained in:
@@ -16,8 +16,9 @@ function ModuleManager.init()
|
||||
Keyboard.bindKeyPress('Up', function() moduleList:focusPreviousChild(KeyboardFocusReason) end, moduleManagerWindow)
|
||||
Keyboard.bindKeyPress('Down', function() moduleList:focusNextChild(KeyboardFocusReason) end, moduleManagerWindow)
|
||||
|
||||
moduleManagerButton = TopMenu.addButton('moduleManagerButton', 'Module manager', 'modulemanager.png', ModuleManager.toggle)
|
||||
moduleManagerButton = TopMenu.addLeftButton('moduleManagerButton', 'Module manager', 'modulemanager.png', ModuleManager.toggle)
|
||||
|
||||
-- refresh modules only after all modules are loaded
|
||||
addEvent(ModuleManager.listModules)
|
||||
end
|
||||
|
||||
@@ -36,8 +37,8 @@ end
|
||||
|
||||
function ModuleManager.show()
|
||||
moduleManagerWindow:show()
|
||||
moduleManagerWindow:focus()
|
||||
moduleManagerWindow:raise()
|
||||
moduleManagerWindow:focus()
|
||||
end
|
||||
|
||||
function ModuleManager.toggle()
|
||||
@@ -98,8 +99,8 @@ function ModuleManager.updateModuleInfo(moduleName)
|
||||
website = module:getWebsite()
|
||||
version = module:getVersion()
|
||||
loaded = module:isLoaded()
|
||||
canReload = module:canReload()
|
||||
canUnload = module:canUnload()
|
||||
canReload = not loaded or canUnload
|
||||
end
|
||||
|
||||
moduleManagerWindow:recursiveGetChildById('moduleName'):setText(name)
|
||||
@@ -111,12 +112,10 @@ function ModuleManager.updateModuleInfo(moduleName)
|
||||
|
||||
local reloadButton = moduleManagerWindow:recursiveGetChildById('moduleReloadButton')
|
||||
reloadButton:setEnabled(canReload)
|
||||
reloadButton:setVisible(true)
|
||||
if loaded then reloadButton:setText('Reload')
|
||||
else reloadButton:setText('Load') end
|
||||
|
||||
local unloadButton = moduleManagerWindow:recursiveGetChildById('moduleUnloadButton')
|
||||
unloadButton:setVisible(true)
|
||||
unloadButton:setEnabled(canUnload)
|
||||
end
|
||||
|
||||
@@ -126,6 +125,7 @@ function ModuleManager.reloadCurrentModule()
|
||||
local module = g_modules.getModule(focusedChild:getText())
|
||||
if module then
|
||||
module:reload()
|
||||
if ModuleManager == nil then return end
|
||||
ModuleManager.updateModuleInfo(module:getName())
|
||||
ModuleManager.refreshLoadedModules()
|
||||
ModuleManager.show()
|
||||
@@ -139,6 +139,7 @@ function ModuleManager.unloadCurrentModule()
|
||||
local module = g_modules.getModule(focusedChild:getText())
|
||||
if module then
|
||||
module:unload()
|
||||
if ModuleManager == nil then return end
|
||||
ModuleManager.updateModuleInfo(module:getName())
|
||||
ModuleManager.refreshLoadedModules()
|
||||
end
|
||||
|
@@ -3,15 +3,16 @@ Module
|
||||
description: Manage other modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
reloadable: true
|
||||
autoload: true
|
||||
autoload-antecedence: 140
|
||||
autoload-priority: 140
|
||||
|
||||
dependencies:
|
||||
- client_topmenu
|
||||
|
||||
onLoad: |
|
||||
@onLoad: |
|
||||
dofile 'modulemanager'
|
||||
ModuleManager.init()
|
||||
|
||||
onUnload: |
|
||||
@onUnload: |
|
||||
ModuleManager.terminate()
|
||||
|
@@ -27,7 +27,7 @@ ModuleValueLabel < UILabel
|
||||
font: verdana-11px-antialised
|
||||
color: #aaaaaa
|
||||
text-offset: 3 0
|
||||
image-source: /core_styles/images/panel_flat.png
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
height: 16
|
||||
|
||||
@@ -92,9 +92,9 @@ MainWindow
|
||||
// id: moduleAutoload
|
||||
|
||||
//ModuleInfoLabel
|
||||
// text: Autoload antecedence
|
||||
// text: Autoload priority
|
||||
//ModuleValueLabel
|
||||
// id: moduleLoadAntecedence
|
||||
// id: moduleLoadPriority
|
||||
// text: 1000
|
||||
|
||||
ModuleInfoLabel
|
||||
@@ -118,7 +118,7 @@ MainWindow
|
||||
anchors.left: moduleInfo.left
|
||||
margin-top: 8
|
||||
text: Load
|
||||
visible: false
|
||||
enabled: false
|
||||
@onClick: ModuleManager.reloadCurrentModule()
|
||||
|
||||
Button
|
||||
@@ -128,6 +128,14 @@ MainWindow
|
||||
margin-left: 10
|
||||
margin-top: 8
|
||||
text: Unload
|
||||
visible: false
|
||||
enabled: false
|
||||
@onClick: ModuleManager.unloadCurrentModule()
|
||||
|
||||
Button
|
||||
id: closeButton
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
text: Close
|
||||
width: 60
|
||||
@onClick: ModuleManager.hide()
|
||||
|
||||
|
Reference in New Issue
Block a user