mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
Updated Top Menu, Health Info, Combat Controls, Console (Channels), Game Toggle Buttons, Minimap Layout, Game Interface Prompts, and Creature Draw Info.
* Added new left and right game button panels. * Relocated main game toggle buttons to the right side of the screen to make it easier to toggle miniwindows. * Added table.empty(t) function to table lib. * Renamed module game_healthbar to game_healthinfo. * Combat controls now save per character (e.g. Fight mode, chase mode, safe fight mode) * Last channels open now save per character. * Fixed typo in containers.lua. * Added logout prompting window message when you logout via the logout button. * Added exit promting window message when you attempt to exit the client. * Repositioned some minimap buttons. * Fixed so when creatures health percent is < 1 it will not draw the creature information. Known Issues: * If you move a container widget into the map rect if you move an item onto itself it will allow this to execute still dropping the item on the ground. * The server is calling to open channels after onGameStart is executed causing it to focus the last tab opened. Fix: Don't save channels to the settings that are opened by the server.
This commit is contained in:
@@ -20,6 +20,8 @@ end
|
||||
|
||||
function GameInterface.init()
|
||||
g_ui.importStyle('styles/countwindow.otui')
|
||||
g_ui.importStyle('styles/logoutwindow.otui')
|
||||
g_ui.importStyle('styles/exitwindow.otui')
|
||||
|
||||
connect(g_game, { onGameStart = GameInterface.show }, true)
|
||||
connect(g_game, { onGameEnd = GameInterface.hide }, true)
|
||||
@@ -63,8 +65,8 @@ function GameInterface.init()
|
||||
g_keyboard.bindKeyPress('Escape', function() g_game.cancelAttackAndFollow() end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||
g_keyboard.bindKeyPress('Ctrl+=', function() gameMapPanel:zoomIn() end, gameRootPanel, 250)
|
||||
g_keyboard.bindKeyPress('Ctrl+-', function() gameMapPanel:zoomOut() end, gameRootPanel, 250)
|
||||
g_keyboard.bindKeyDown('Ctrl+Q', GameInterface.tryLogout, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Ctrl+L', GameInterface.tryLogout, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Ctrl+Q', GameInterface.logout, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Ctrl+L', GameInterface.logout, gameRootPanel)
|
||||
g_keyboard.bindKeyDown('Ctrl+W', function() g_map.cleanTexts() TextMessage.clearMessages() end, gameRootPanel)
|
||||
|
||||
g_keyboard.bindKeyDown('Ctrl+.', function()
|
||||
@@ -114,7 +116,7 @@ function GameInterface.hide()
|
||||
g_app.onClose = nil
|
||||
end
|
||||
|
||||
function GameInterface.tryExit()
|
||||
function GameInterface.exit()
|
||||
if g_game.isOnline() then
|
||||
g_game.forceLogout()
|
||||
scheduleEvent(exit, 10)
|
||||
@@ -122,13 +124,47 @@ function GameInterface.tryExit()
|
||||
end
|
||||
end
|
||||
|
||||
function GameInterface.tryLogout()
|
||||
function GameInterface.tryExit()
|
||||
local exitWindow = g_ui.createWidget('ExitWindow', rootWidget)
|
||||
local exitButton = exitWindow:getChildById('buttonExit')
|
||||
local logoutButton = exitWindow:getChildById('buttonLogout')
|
||||
|
||||
local exitFunc = function()
|
||||
GameInterface.exit()
|
||||
exitButton:getParent():destroy()
|
||||
end
|
||||
|
||||
local logoutFunc = function()
|
||||
GameInterface.logout()
|
||||
logoutButton:getParent():destroy()
|
||||
end
|
||||
|
||||
exitWindow.onEnter = logoutFunc
|
||||
exitButton.onClick = exitFunc
|
||||
logoutButton.onClick = logoutFunc
|
||||
return true -- signal closing
|
||||
end
|
||||
|
||||
function GameInterface.logout()
|
||||
if g_game.isOnline() then
|
||||
g_game.safeLogout()
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function GameInterface.tryLogout()
|
||||
local logoutWindow = g_ui.createWidget('LogoutWindow', rootWidget)
|
||||
local yesButton = logoutWindow:getChildById('buttonYes')
|
||||
|
||||
local logoutFunc = function()
|
||||
GameInterface.logout()
|
||||
yesButton:getParent():destroy()
|
||||
end
|
||||
|
||||
logoutWindow.onEnter = logoutFunc
|
||||
yesButton.onClick = logoutFunc
|
||||
end
|
||||
|
||||
function GameInterface.onMouseGrabberRelease(self, mousePosition, mouseButton)
|
||||
if GameInterface.selectedThing == nil then return false end
|
||||
if mouseButton == MouseLeftButton then
|
||||
|
Reference in New Issue
Block a user