change in topmenu and some fixes

This commit is contained in:
Eduardo Bart 2012-01-23 11:47:15 -02:00
parent e3096c1648
commit d500de9aa0
18 changed files with 93 additions and 59 deletions

9
BUGS
View File

@ -12,4 +12,11 @@ some animated hits are displayed as 2 hits instead of one
numpad on windows doesn't work correctly numpad on windows doesn't work correctly
skulls is rendering outside map bounds skulls is rendering outside map bounds
these are some issues when skill progressbar is 0% or 100% these are some issues when skill progressbar is 0% or 100%
paste on x11 platform does not work correctly when doing ctrl+c in google chrome paste on x11 platform does not work correctly when doing ctrl+c in google chrome
walk animation doesnt reset when leaving invisible
non tiles are no black
drop items in container background
can view ocean in underground floors
render closets -> http://i.imgur.com/yooxD.jpg

14
TODO
View File

@ -17,6 +17,18 @@ move items
use with use with
move count itens
open/close vip/skills
move windows, go back in containers
open private chat
reopen channels
fix use with
move windows
let windows open while playing
fix auto repeats in lineedit
trade
battlelist
offer window
==================================================== ====================================================
Low priority TODO Low priority TODO
@ -25,8 +37,8 @@ Low priority TODO
review directories loading search review directories loading search
load modules from zip packages load modules from zip packages
create a class for reading binary files create a class for reading binary files
rework lua/c++ logger
ake protocol class compatible with old tibia protocols ake protocol class compatible with old tibia protocols
rework lua/c++ logger
== Graphics == Graphics
use CoordsBuffer in font use CoordsBuffer in font

View File

@ -80,6 +80,14 @@ function TopMenu.removeButton(param)
button:destroy() button:destroy()
end end
function TopMenu.hideGameButtons()
gameButtonsPanel:hide()
end
function TopMenu.showGameButtons()
gameButtonsPanel:show()
end
function TopMenu.getButton(id) function TopMenu.getButton(id)
return topMenu:recursiveGetChildById(id) return topMenu:recursiveGetChildById(id)
end end
@ -87,3 +95,7 @@ end
function TopMenu:getLogoutButton(id) function TopMenu:getLogoutButton(id)
return TopMenu.getButton('logoutButton') return TopMenu.getButton('logoutButton')
end end
connect(Game, { onLogin = TopMenu.showGameButtons,
onLogout = TopMenu.hideGameButtons})

View File

@ -25,45 +25,13 @@ GameTopButton < UIButton
icon-color: #ffffffff icon-color: #ffffffff
image-border: 3 image-border: 3
$hover: $on:
image-clip: 0 0 26 26 image-clip: 0 0 26 26
image-color: #ffffffff image-color: #ffffffff
icon-color: #ffffffff icon-color: #ffffffff
$first:
anchors.top: parent.top
anchors.left: parent.left
margin-top: 4
margin-left: 6
$!first:
anchors.top: prev.top
anchors.left: prev.right
margin-left: 6
TopLeftButton < TopButton TopLeftButton < TopButton
$first:
anchors.top: parent.top
anchors.left: parent.left
margin-top: 4
margin-left: 6
$!first:
anchors.top: prev.top
anchors.left: prev.right
margin-left: 6
TopRightButton < TopButton TopRightButton < TopButton
$first:
anchors.top: parent.top
anchors.right: parent.right
margin-top: 4
margin-right: 6
$!first:
anchors.top: prev.top
anchors.right: prev.left
margin-right: 6
TopPanel TopPanel
id: topMenu id: topMenu
@ -77,7 +45,11 @@ TopPanel
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
width: 150 layout:
type: horizontalBox
spacing: 4
fit-children: true
padding: 6 4
Panel Panel
id: gameButtonsPanel id: gameButtonsPanel
@ -85,13 +57,21 @@ TopPanel
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: prev.right anchors.left: prev.right
anchors.right: next.left anchors.right: next.left
layout:
type: horizontalBox
spacing: 4
padding: 6 4
Panel Panel
id: rightButtonsPanel id: rightButtonsPanel
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
width: 70 layout:
type: horizontalBox
spacing: 4
fit-children: true
padding: 6 4
FrameCounter FrameCounter
id: frameCounter id: frameCounter

View File

@ -21,7 +21,7 @@ function UIItem:onDrop(widget, mousePos)
if not widget or not widget.currentDragThing then return false end if not widget or not widget.currentDragThing then return false end
local pos = self.position local pos = self.position
local count = 1 -- todo make a window for it local count = widget.currentDragThing:getData()
Game.move(widget.currentDragThing, pos, count) Game.move(widget.currentDragThing, pos, count)
return true return true

View File

@ -7,9 +7,9 @@ Module
dependencies: dependencies:
- game_healthbar - game_healthbar
- game_inventory - game_inventory
//- game_skills - game_skills
- game_textmessage - game_textmessage
//- game_viplist - game_viplist
- game_console - game_console
- game_outfit - game_outfit
- game_containers - game_containers

View File

@ -1,7 +1,7 @@
Skills = {} Skills = {}
-- private variables -- private variables
local skillWindow local skillsWindow
local skillsButton local skillsButton
-- private functions -- private functions
@ -19,7 +19,7 @@ local function getNumberString(number)
end end
local function setSkillValue(id, value) local function setSkillValue(id, value)
local skill = skillWindow:recursiveGetChildById(id) local skill = skillsWindow:recursiveGetChildById(id)
if skill then if skill then
local widget = skill:getChildById('value') local widget = skill:getChildById('value')
@ -28,7 +28,7 @@ local function setSkillValue(id, value)
end end
local function setSkillPercent(id, percent, tooltip) local function setSkillPercent(id, percent, tooltip)
local skill = skillWindow:recursiveGetChildById(id) local skill = skillsWindow:recursiveGetChildById(id)
if skill then if skill then
local widget = skill:getChildById('percent') local widget = skill:getChildById('percent')
@ -42,19 +42,22 @@ end
-- public functions -- public functions
function Skills.create() function Skills.create()
skillWindow = displayUI('skills.otui', { parent = Game.gameRightPanel }) skillsWindow = displayUI('skills.otui', { parent = Game.gameRightPanel })
skillsWindow:hide()
skillsButton = TopMenu.addGameButton('skillsButton', 'Skills (Ctrl+S)', '/core_styles/icons/skills.png', Skills.toggle) skillsButton = TopMenu.addGameButton('skillsButton', 'Skills (Ctrl+S)', '/core_styles/icons/skills.png', Skills.toggle)
end end
function Skills.destroy() function Skills.destroy()
--skillsButton:destroy() skillsButton:destroy()
--skillsButton = nil skillsButton = nil
skillWindow:destroy() skillsWindow:destroy()
skillWindow = nil skillsWindow = nil
end end
function Skills.toggle() function Skills.toggle()
local visible = not skillsWindow:isExplicitlyVisible()
skillsWindow:setVisible(visible)
skillsButton:setOn(visible)
end end
function Skills.onSkillButtonClick(button) function Skills.onSkillButtonClick(button)

View File

@ -33,7 +33,7 @@ SkillPercentPanel < ProgressBar
MiniWindow MiniWindow
id: skillWindow id: skillWindow
text: Skills text: Skills
size: 200 350 height: 350
Panel Panel
id: skillPanel id: skillPanel

View File

@ -1,19 +1,28 @@
VipList = {} VipList = {}
-- private variables -- private variables
local vipWindow = nil local vipWindow
local addVipWindow = nil local vipButton
local addVipWindow
-- public functions -- public functions
function VipList.create() function VipList.create()
vipWindow = displayUI('viplist.otui', { parent = Game.gameRightPanel }) vipWindow = displayUI('viplist.otui', { parent = Game.gameRightPanel })
--vipWindow:hide() vipWindow:hide()
TopMenu.addGameButton('vipListButton', 'VIP list', '/core_styles/icons/viplist.png', VipList.toggle) vipButton = TopMenu.addGameButton('vipListButton', 'VIP list', '/core_styles/icons/viplist.png', VipList.toggle)
end end
function VipList.destroy() function VipList.destroy()
vipWindow:destroy() vipWindow:destroy()
vipWindow = nil vipWindow = nil
vipButton:destroy()
vipButton = nil
end
function VipList.toggle()
local visible = not vipWindow:isExplicitlyVisible()
vipWindow:setVisible(visible)
vipButton:setOn(visible)
end end
function VipList.createAddWindow() function VipList.createAddWindow()

View File

@ -84,6 +84,9 @@ void UIAnchorLayout::removeWidget(const UIWidgetPtr& widget)
void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anchorGroup) void UIAnchorLayout::updateWidget(const UIWidgetPtr& widget, UIAnchorGroup& anchorGroup)
{ {
UIWidgetPtr parentWidget = getParentWidget(); UIWidgetPtr parentWidget = getParentWidget();
if(!parentWidget)
return;
Rect newRect = widget->getRect(); Rect newRect = widget->getRect();
bool verticalMoved = false; bool verticalMoved = false;
bool horizontalMoved = false; bool horizontalMoved = false;

View File

@ -38,6 +38,8 @@ void UIHorizontalLayout::applyStyle(const OTMLNodePtr& styleNode)
void UIHorizontalLayout::internalUpdate() void UIHorizontalLayout::internalUpdate()
{ {
UIWidgetPtr parentWidget = getParentWidget(); UIWidgetPtr parentWidget = getParentWidget();
if(!parentWidget)
return;
UIWidgetList widgets = parentWidget->getChildren(); UIWidgetList widgets = parentWidget->getChildren();
if(m_alignRight) if(m_alignRight)

View File

@ -37,6 +37,9 @@ void UIVerticalLayout::applyStyle(const OTMLNodePtr& styleNode)
void UIVerticalLayout::internalUpdate() void UIVerticalLayout::internalUpdate()
{ {
UIWidgetPtr parentWidget = getParentWidget(); UIWidgetPtr parentWidget = getParentWidget();
if(!parentWidget)
return;
UIWidgetList widgets = parentWidget->getChildren(); UIWidgetList widgets = parentWidget->getChildren();
if(m_alignBottom) if(m_alignBottom)

View File

@ -639,6 +639,9 @@ void UIWidget::setVisible(bool visible)
parent->focusPreviousChild(Fw::ActiveFocusReason); parent->focusPreviousChild(Fw::ActiveFocusReason);
} }
// visibility can change can change parent layout
updateParentLayout();
updateState(Fw::ActiveState); updateState(Fw::ActiveState);
updateState(Fw::HoverState); updateState(Fw::HoverState);
} }

View File

@ -29,6 +29,7 @@ char Fw::utf8CharToLatin1(uchar *utf8, int *read)
{ {
char c = '?'; char c = '?';
uchar opt1 = utf8[0]; uchar opt1 = utf8[0];
*read = 1;
if(opt1 == 0xc3) { if(opt1 == 0xc3) {
*read = 2; *read = 2;
uchar opt2 = utf8[1]; uchar opt2 = utf8[1];
@ -39,7 +40,6 @@ char Fw::utf8CharToLatin1(uchar *utf8, int *read)
if(opt2 > 0xa1 && opt2 < 0xbb) if(opt2 > 0xa1 && opt2 < 0xbb)
c = opt2; c = opt2;
} else if(opt1 < 0xc2) { } else if(opt1 < 0xc2) {
*read = 1;
c = opt1; c = opt1;
} }
return c; return c;
@ -49,7 +49,7 @@ std::string Fw::utf8StringToLatin1(uchar *utf8) {
std::string out; std::string out;
int len = strlen((char*)utf8); int len = strlen((char*)utf8);
for(int i=0; i<len;) { for(int i=0; i<len;) {
int read; int read = 0;
uchar *utf8char = &utf8[i]; uchar *utf8char = &utf8[i];
out += Fw::utf8CharToLatin1(utf8char, &read); out += Fw::utf8CharToLatin1(utf8char, &read);
i += read; i += read;

View File

@ -385,7 +385,6 @@ int Game::getThingStackpos(const ThingPtr& thing)
{ {
// thing is at map // thing is at map
if(thing->getPos().x != 65535) { if(thing->getPos().x != 65535) {
dump << thing->getPos();
TilePtr tile = g_map.getTile(thing->getPos()); TilePtr tile = g_map.getTile(thing->getPos());
if(tile) if(tile)
return tile->getThingStackpos(thing); return tile->getThingStackpos(thing);

View File

@ -29,7 +29,7 @@
Item::Item() : Thing() Item::Item() : Thing()
{ {
m_data = 0; m_data = 1;
} }
ItemPtr Item::create(int id) ItemPtr Item::create(int id)

View File

@ -37,7 +37,7 @@ public:
MAP_SIZE_Z = 8, MAP_SIZE_Z = 8,
MAX_WIDTH = 24, MAX_WIDTH = 24,
MAX_HEIGHT = 24, MAX_HEIGHT = 24,
MAX_Z = 15, MAX_Z = 16,
NUM_TILE_PIXELS = 32 NUM_TILE_PIXELS = 32
}; };

View File

@ -133,6 +133,7 @@ void OTClient::registerLuaFunctions()
g_lua.registerClass<Item, Thing>(); g_lua.registerClass<Item, Thing>();
g_lua.bindClassStaticFunction<Item>("create", &Item::create); g_lua.bindClassStaticFunction<Item>("create", &Item::create);
g_lua.bindClassMemberFunction<Item>("getData", &Item::getData);
g_lua.registerClass<Effect, Thing>(); g_lua.registerClass<Effect, Thing>();
g_lua.registerClass<Missile, Thing>(); g_lua.registerClass<Missile, Thing>();