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
master
Eduardo Bart 12 years ago
parent c0b6608453
commit 9abac474dd

@ -34,13 +34,14 @@ move up/down in lineedits
select characters in lineedits
scrolling multiline edit
mouse wheel lineedits
onMapKnown event
== OPTIMIZATIONS AND REWORKS
* game
do not redraw in MapView far zoom
map zoom rendering could be optimized using framebuffer caches
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
handle corrupt errors in dat/spr

@ -1,23 +1,23 @@
Button < UIButton
font: verdana-11px-antialised
color: #f0ad4dff
size: 106 24
size: 106 22
text-offset: 0 0
image-color: white
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
$hover !disabled:
image-source: /core_styles/styles/images/button_hover.png
image-clip: 0 20 20 20
$pressed:
image-clip: 0 40 20 20
text-offset: 1 1
image-source: /core_styles/styles/images/button_down.png
$disabled:
color: #f0ad4d88
image-color: #ffffff88
TabButton < UIButton
size: 20 20

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

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

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

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

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

@ -77,10 +77,6 @@ void Game::processConnectionError(const boost::system::error_code& error)
void Game::processDisconnect()
{
if(isOnline()) {
// only process logout event if the player is known
if(m_localPlayer->isKnown())
processLogout();
m_localPlayer = nullptr;
processGameEnd();
@ -119,7 +115,7 @@ void Game::processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, b
// synchronize fight modes with the server
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");
}
@ -134,21 +130,6 @@ void Game::processGameEnd()
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)
{
m_dead = true;
@ -1034,12 +1015,11 @@ bool Game::canPerformGameAction()
{
// we can only perform game actions if we meet these conditions:
// - the local player exists
// - the local player is known
// - the local player is not dead
// - we have a game protocol
// - the game protocol is connected
// - 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)

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

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

@ -25,11 +25,6 @@
#include <otclient/core/player.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)
{
if(accountName.empty() || accountPassword.empty()) {

@ -30,9 +30,6 @@
class ProtocolGame : public Protocol
{
public:
ProtocolGame();
public:
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);
private:
bool m_waitingLoginPacket;
Boolean<false> m_waitingLoginPacket;
std::string m_accountName;
std::string m_accountPassword;
std::string m_characterName;

@ -1270,11 +1270,8 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
creature->setEmblem(emblem);
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);
g_eventDispatcher.addEvent([] { g_game.processLogin(); });
}
}
thing = creature;

Loading…
Cancel
Save