Minor fixes and improvements

master
Eduardo Bart 11 years ago
parent 46aa0c005f
commit e528fcc8f8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 243 B

@ -1,8 +1,9 @@
MessageBoxLabel < Label
id: messageBoxLabel
text-auto-resize: true
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text-wrap: true
text-auto-resize: true
MessageBoxButtonHolder < UIWidget
id: buttonHolder

@ -111,12 +111,7 @@ end
function onGameConnectionError(message, code)
CharacterList.destroyLoadBox()
local text
if g_game.getProtocolGame() and g_game.getProtocolGame():isConnecting() then
text = tr('Unable to establish a connection. (err: %d)%s', code)
else
text = tr('Your connection has been lost. (err: %d)', code)
end
local text = translateNetworkError(code, g_game.getProtocolGame() and g_game.getProtocolGame():isConnecting(), message)
errorBox = displayErrorBox(tr("Connection Error"), text)
errorBox.onOk = function()
errorBox = nil

@ -68,8 +68,10 @@ end
function online()
showGameButtons()
if modules.client_options.getOption('showFps') and (g_game.getFeature(GameClientPing) or g_game.getFeature(GameExtendedClientPing)) then
if g_settings.getBoolean('showPing') and (g_game.getFeature(GameClientPing) or g_game.getFeature(GameExtendedClientPing)) then
pingLabel:show()
else
pingLabel:hide()
end
end

@ -17,6 +17,7 @@ Module
dofile 'settings'
dofile 'keyboard'
dofile 'mouse'
dofile 'net'
dofiles 'ui'

@ -0,0 +1,16 @@
function translateNetworkError(errcode, connecting, errdesc)
local text
if errcode == 111 then
text = tr('Connection refused, the server might be offline or restarting.\nPlease try again later.')
elseif errcode == 110 then
text = tr('Connection timed out. Either your network is failing or the server is offline.')
elseif errcode == 1 then
text = tr('Connection failed, the server address does not exist.')
elseif connecting then
text = tr('Connection failed.')
else
text = tr('Your connection has been lost.\nEither your network or the server went down.')
end
text = text .. ' ' .. tr('(ERROR %d)', errcode)
return text
end

@ -83,10 +83,17 @@ local function onTabDragMove(tab, mousePos, mouseMoved)
end
end
local function tabBlink(tab)
if not tab.blinking then return end
local function tabBlink(tab, step)
step = step or 0
tab:setOn(not tab:isOn())
tab.blinkEvent = scheduleEvent(function() tabBlink(tab) end, 500)
removeEvent(tab.blinkEvent)
if step < 4 then
tab.blinkEvent = scheduleEvent(function() tabBlink(tab, step+1) end, 500)
else
tab:setOn(true)
tab.blinkEvent = nil
end
end
-- public functions
@ -240,7 +247,7 @@ function UIMoveableTabBar:selectPrevTab()
end
function UIMoveableTabBar:blinkTab(tab)
if tab:isChecked() or tab.blinking then return end
if tab:isChecked() then return end
tab.blinking = true
tabBlink(tab)
end

@ -237,7 +237,7 @@ function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
if not self.mouseScroll then
return false
end
if mouseWheel == MouseWheelDown then
if mouseWheel == MouseWheelUp then
if self.orientation == 'vertical' then
self:decrement()
else

@ -19,14 +19,15 @@ function UITextEdit:onMouseWheel(mousePos, mouseWheel)
else
self.verticalScrollBar:increment()
end
return true
elseif self.horizontalScrollBar then
if mouseWheel == MouseWheelUp then
self.horizontalScrollBar:increment()
else
self.horizontalScrollBar:decrement()
end
return true
end
return true
end
function UITextEdit:onTextAreaUpdate(virtualOffset, virtualSize, totalSize)

@ -288,6 +288,7 @@ function openPlayerReportRuleViolationWindow()
g_game.talkChannel(MessageModes.RVRChannel, 0, text)
violationReportTab = addTab(tr('Report Rule') .. '...', true)
addTabText(tr('Please wait patiently for a gamemaster to reply') .. '.', SpeakTypesSettings.privateRed, violationReportTab)
addTabText(applyMessagePrefixies(g_game.getCharacterName(), 0, text), SpeakTypesSettings.say, violationReportTab, g_game.getCharacterName())
violationReportTab.locked = true
violationWindow:destroy()
violationWindow = nil

@ -21,6 +21,8 @@ ConsolePhantomLabel < UILabel
selection-background-color: #999999
ConsoleTabBar < MoveableTabBar
height: 28
ConsoleTabBarPanel < MoveableTabBarPanel
id: consoleTab
@ -64,7 +66,6 @@ Panel
ConsoleTabBar
id: consoleTabBar
height: 28
anchors.left: prev.right
anchors.top: parent.top
anchors.right: next.left

@ -87,6 +87,7 @@ end
function online()
loadMap(not preloaded)
updateCameraPosition()
end
function offline()
@ -128,6 +129,9 @@ end
function updateCameraPosition()
local player = g_game.getLocalPlayer()
if not player then return end
local pos = player:getPosition()
if not pos then return end
if not minimapWidget:isDragging() then
if not fullmapView then
minimapWidget:setCameraPosition(player:getPosition())
@ -153,7 +157,6 @@ function toggleFullMap()
local zoom = oldZoom or 0
local pos = oldPos or minimapWidget:getCameraPosition()
pos.z = 7
oldZoom = minimapWidget:getZoom()
oldPos = minimapWidget:getCameraPosition()
minimapWidget:setZoom(zoom)

@ -10,7 +10,7 @@ MiniWindow
text: ?
text-align: center
phantom: false
!tooltip: tr('Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks')
!tooltip: tr('Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks\nPress Ctrl+Shift+M to view the entire game map')')
anchors.top: minimizeButton.top
anchors.right: minimizeButton.left
margin-right: 3

@ -157,11 +157,6 @@ function ProtocolLogin:parseOpcode(opcode, msg)
end
function ProtocolLogin:onError(msg, code)
local text
if self:isConnecting() then
text = tr('Unable to establish a connection. (err: %d)', code)
else
text = tr('Your connection has been lost. (err: %d)', code)
end
local text = translateNetworkError(code, self:isConnecting(), msg)
signalcall(self.onLoginError, self, text)
end

@ -34,6 +34,12 @@ function UIMinimap:onVisibilityChange()
end
end
function UIMinimap:onCameraPositionChange(cameraPos)
if self.cross then
self:setCrossPosition(self.cross.pos)
end
end
function UIMinimap:hideFloor()
self.floorUpWidget:hide()
self.floorDownWidget:hide()
@ -91,6 +97,7 @@ function UIMinimap:setCrossPosition(pos)
self.cross = cross
end
pos.z = self:getCameraPosition().z
cross.pos = pos
if pos then
self:centerInPosition(cross, pos)
@ -106,7 +113,8 @@ function UIMinimap:addFlag(pos, icon, description)
return
end
flag = g_ui.createWidget('MinimapFlag', self)
flag = g_ui.createWidget('MinimapFlag')
self:insertChild(1, flag)
flag.pos = pos
flag.description = description
flag.icon = icon
@ -130,7 +138,7 @@ function UIMinimap:setAlternativeWidgetsVisible(show)
layout:disableUpdates()
for _,widget in pairs(self.alternatives) do
if show then
self:addChild(widget)
self:insertChild(1, widget)
self:centerInPosition(widget, widget.pos)
else
self:removeChild(widget)

@ -71,7 +71,6 @@ void ProtocolGame::onRecv(const InputMessagePtr& inputMessage)
void ProtocolGame::onError(const boost::system::error_code& error)
{
Protocol::onError(error);
g_game.processConnectionError(error);
disconnect();
}

@ -30,7 +30,7 @@ class Platform
{
public:
void processArgs(std::vector<std::string>& args);
bool spawnProcess(const std::string& process, const std::vector<std::string>& args);
bool spawnProcess(std::string process, const std::vector<std::string>& args);
int getProcessId();
bool isProcessRunning(const std::string& name);
bool killProcess(const std::string& name);

@ -35,7 +35,7 @@ void Platform::processArgs(std::vector<std::string>& args)
//nothing todo, linux args are already utf8 encoded
}
bool Platform::spawnProcess(const std::string& process, const std::vector<std::string>& args)
bool Platform::spawnProcess(std::string process, const std::vector<std::string>& args)
{
struct stat sts;
if(stat(process.c_str(), &sts) == -1 && errno == ENOENT)

@ -42,11 +42,16 @@ void Platform::processArgs(std::vector<std::string>& args)
}
}
bool Platform::spawnProcess(const std::string& process, const std::vector<std::string>& args)
bool Platform::spawnProcess(std::string process, const std::vector<std::string>& args)
{
std::string commandLine;
for(uint i = 0; i < args.size(); ++i)
commandLine += stdext::format(" \"%s\"", args[i]);
boost::replace_all(process, "/", "\\");
if(!boost::ends_with(process, ".exe"))
process += ".exe";
std::wstring wfile = stdext::utf8_to_utf16(process);
std::wstring wcommandLine = stdext::utf8_to_utf16(commandLine);
@ -83,9 +88,12 @@ bool Platform::killProcess(const std::string& name)
std::string Platform::getTempPath()
{
std::string ret;
wchar_t path[MAX_PATH];
GetTempPathW(MAX_PATH, path);
return stdext::utf16_to_utf8(path);
ret = stdext::utf16_to_utf8(path);
boost::replace_all(ret, "\\", "/");
return ret;
}
std::string Platform::getCurrentDir()

Loading…
Cancel
Save