style adjustment and fixes

* style adjustments, now window and button style
* fix bug when logging on a tile with too many creatures
* remove deprecated onLogin and onLogout events
This commit is contained in:
Eduardo Bart 2012-05-10 10:06:06 -03:00
parent c0b6608453
commit 9abac474dd
19 changed files with 30 additions and 63 deletions

3
TODO
View File

@ -34,13 +34,14 @@ move up/down in lineedits
select characters in lineedits select characters in lineedits
scrolling multiline edit scrolling multiline edit
mouse wheel lineedits mouse wheel lineedits
onMapKnown event
== OPTIMIZATIONS AND REWORKS == OPTIMIZATIONS AND REWORKS
* game * game
do not redraw in MapView far zoom do not redraw in MapView far zoom
map zoom rendering could be optimized using framebuffer caches map zoom rendering could be optimized using framebuffer caches
multisample option in map view multisample option in map view
move redering of creatures names, skulls, etc to UI and scripts move rendering of creatures names, skulls, etc to UI and scripts
clean sprites cache periodically clean sprites cache periodically
handle corrupt errors in dat/spr handle corrupt errors in dat/spr

View File

@ -1,23 +1,23 @@
Button < UIButton Button < UIButton
font: verdana-11px-antialised font: verdana-11px-antialised
color: #f0ad4dff color: #f0ad4dff
size: 106 24 size: 106 22
text-offset: 0 0 text-offset: 0 0
image-color: white
image-source: /core_styles/styles/images/button.png image-source: /core_styles/styles/images/button.png
image-border: 5 image-color: white
image-clip: 0 0 20 20
image-border: 2
padding: 5 10 5 10 padding: 5 10 5 10
$hover !disabled: $hover !disabled:
image-source: /core_styles/styles/images/button_hover.png image-clip: 0 20 20 20
$pressed: $pressed:
image-clip: 0 40 20 20
text-offset: 1 1 text-offset: 1 1
image-source: /core_styles/styles/images/button_down.png
$disabled: $disabled:
color: #f0ad4d88 color: #f0ad4d88
image-color: #ffffff88
TabButton < UIButton TabButton < UIButton
size: 20 20 size: 20 20

View File

@ -40,20 +40,21 @@ ColorBox < UICheckBox
ButtonBox < UICheckBox ButtonBox < UICheckBox
font: verdana-11px-antialised font: verdana-11px-antialised
color: #f0ad4dff color: #ffffffff
size: 106 24 size: 106 22
text-offset: 0 0 text-offset: 0 0
text-align: center text-align: center
image-source: /core_styles/styles/images/button.png image-source: /core_styles/styles/images/tabbutton.png
image-color: white image-color: white
image-border: 5 image-clip: 0 0 20 20
image-border: 2
$hover !disabled: $hover !disabled:
image-source: /core_styles/styles/images/button_hover.png image-clip: 0 20 20 20
$checked: $checked:
text-offset: 1 1 image-clip: 0 40 20 20
image-source: /core_styles/styles/images/button_down.png color: #80c7f8
$disabled: $disabled:
color: #f0ad4d88 color: #f0ad4d88

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -3,13 +3,13 @@ Window < UIWindow
size: 200 200 size: 200 200
opacity: 1 opacity: 1
color: white color: white
text-offset: 0 2 text-offset: 0 4
text-align: top text-align: top
image-source: /core_styles/styles/images/window.png image-source: /core_styles/styles/images/window.png
image-border: 4 image-border: 5
image-border-top: 20 image-border-top: 22
opacity: 1 opacity: 1
padding-top: 28 padding-top: 30
padding-left: 16 padding-left: 16
padding-right: 16 padding-right: 16
padding-bottom: 16 padding-bottom: 16

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 763 B

View File

@ -8,7 +8,6 @@ MiniWindow < UIMiniWindow
image-source: /game/images/miniwindow.png image-source: /game/images/miniwindow.png
image-border: 4 image-border: 4
image-border-top: 23 image-border-top: 23
image-border-left: 23
image-border-bottom: 4 image-border-bottom: 4
focusable: false focusable: false
&minimizedHeight: 24 &minimizedHeight: 24

View File

@ -31,7 +31,7 @@ end
-- public functions -- public functions
function Minimap.init() function Minimap.init()
connect(g_game, { onLogin = Minimap.reset }) connect(g_game, { onGameStart = Minimap.reset })
Keyboard.bindKeyDown('Ctrl+M', Minimap.toggle) Keyboard.bindKeyDown('Ctrl+M', Minimap.toggle)
minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle) minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle)
@ -46,7 +46,7 @@ function Minimap.init()
end end
function Minimap.terminate() function Minimap.terminate()
disconnect(g_game, { onLogin = Minimap.reset }) disconnect(g_game, { onGameStart = Minimap.reset })
Keyboard.unbindKeyDown('Ctrl+M') Keyboard.unbindKeyDown('Ctrl+M')
minimapWidget:destroy() minimapWidget:destroy()

View File

@ -57,7 +57,7 @@ function RuleViolation.loadReasons()
end end
function RuleViolation.init() function RuleViolation.init()
connect(g_game, { onLogin = RuleViolation.loadReasons }) connect(g_game, { onGMActions = RuleViolation.loadReasons })
ruleViolationWindow = displayUI('ruleviolation.otui') ruleViolationWindow = displayUI('ruleviolation.otui')
ruleViolationWindow:setVisible(false) ruleViolationWindow:setVisible(false)
@ -73,7 +73,7 @@ function RuleViolation.init()
end end
function RuleViolation.terminate() function RuleViolation.terminate()
disconnect(g_game, { onLogin = RuleViolation.loadReasons }) disconnect(g_game, { onGMActions = RuleViolation.loadReasons })
ruleViolationWindow:destroy() ruleViolationWindow:destroy()
ruleViolationWindow = nil ruleViolationWindow = nil

View File

@ -77,10 +77,6 @@ void Game::processConnectionError(const boost::system::error_code& error)
void Game::processDisconnect() void Game::processDisconnect()
{ {
if(isOnline()) { if(isOnline()) {
// only process logout event if the player is known
if(m_localPlayer->isKnown())
processLogout();
m_localPlayer = nullptr; m_localPlayer = nullptr;
processGameEnd(); processGameEnd();
@ -119,7 +115,7 @@ void Game::processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, b
// synchronize fight modes with the server // synchronize fight modes with the server
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight); m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
// NOTE: the entire map description and local player informations is not known yet // NOTE: the entire map description and local player information is not known yet
g_lua.callGlobalField("g_game", "onGameStart"); g_lua.callGlobalField("g_game", "onGameStart");
} }
@ -134,21 +130,6 @@ void Game::processGameEnd()
g_map.cleanDynamicThings(); g_map.cleanDynamicThings();
} }
void Game::processLogin()
{
// the game could be offline if the login was canceled
if(!isOnline())
return;
// by now the local player must be known
g_lua.callGlobalField("g_game", "onLogin", m_localPlayer);
}
void Game::processLogout()
{
g_lua.callGlobalField("g_game", "onLogout", m_localPlayer);
}
void Game::processDeath(int penality) void Game::processDeath(int penality)
{ {
m_dead = true; m_dead = true;
@ -1034,12 +1015,11 @@ bool Game::canPerformGameAction()
{ {
// we can only perform game actions if we meet these conditions: // we can only perform game actions if we meet these conditions:
// - the local player exists // - the local player exists
// - the local player is known
// - the local player is not dead // - the local player is not dead
// - we have a game protocol // - we have a game protocol
// - the game protocol is connected // - the game protocol is connected
// - its not a bot action // - its not a bot action
return m_localPlayer && m_localPlayer->isKnown() && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection(); return m_localPlayer && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection();
} }
void Game::setAttackingCreature(const CreaturePtr& creature) void Game::setAttackingCreature(const CreaturePtr& creature)

View File

@ -48,9 +48,6 @@ protected:
void processLoginAdvice(const std::string& message); void processLoginAdvice(const std::string& message);
void processLoginWait(const std::string& message, int time); void processLoginWait(const std::string& message, int time);
void processLogin();
void processLogout();
void processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, bool canReportBugs); void processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, bool canReportBugs);
void processGameEnd(); void processGameEnd();
void processDeath(int penality); void processDeath(int penality);

View File

@ -304,8 +304,8 @@ void Map::setCentralPosition(const Position& centralPosition)
LocalPlayerPtr localPlayer = g_game.getLocalPlayer(); LocalPlayerPtr localPlayer = g_game.getLocalPlayer();
if(!localPlayer || localPlayer->getPosition() == m_centralPosition) if(!localPlayer || localPlayer->getPosition() == m_centralPosition)
return; return;
TilePtr tile = getTile(localPlayer->getPosition()); TilePtr tile = localPlayer->getTile();
if(!tile || tile->hasThing(localPlayer)) if(tile && tile->hasThing(localPlayer))
return; return;
localPlayer->setPosition(m_centralPosition); localPlayer->setPosition(m_centralPosition);
}); });

View File

@ -25,11 +25,6 @@
#include <otclient/core/player.h> #include <otclient/core/player.h>
#include <otclient/core/item.h> #include <otclient/core/item.h>
ProtocolGame::ProtocolGame()
{
m_waitingLoginPacket = false;
}
void ProtocolGame::login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName) void ProtocolGame::login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName)
{ {
if(accountName.empty() || accountPassword.empty()) { if(accountName.empty() || accountPassword.empty()) {

View File

@ -30,9 +30,6 @@
class ProtocolGame : public Protocol class ProtocolGame : public Protocol
{ {
public:
ProtocolGame();
public: public:
void login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName); void login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName);
@ -198,7 +195,7 @@ private:
Position parsePosition(InputMessage& msg); Position parsePosition(InputMessage& msg);
private: private:
bool m_waitingLoginPacket; Boolean<false> m_waitingLoginPacket;
std::string m_accountName; std::string m_accountName;
std::string m_accountPassword; std::string m_accountPassword;
std::string m_characterName; std::string m_characterName;

View File

@ -1270,11 +1270,8 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
creature->setEmblem(emblem); creature->setEmblem(emblem);
creature->setPassable(passable); creature->setPassable(passable);
// now that the local player is known, we can schedule login event if(creature == m_localPlayer && !m_localPlayer->isKnown())
if(creature == m_localPlayer && !m_localPlayer->isKnown()) {
m_localPlayer->setKnown(true); m_localPlayer->setKnown(true);
g_eventDispatcher.addEvent([] { g_game.processLogin(); });
}
} }
thing = creature; thing = creature;