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

7
BUGS
View File

@ -13,3 +13,10 @@ numpad on windows doesn't work correctly
skulls is rendering outside map bounds
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
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
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
@ -25,8 +37,8 @@ Low priority TODO
review directories loading search
load modules from zip packages
create a class for reading binary files
rework lua/c++ logger
ake protocol class compatible with old tibia protocols
rework lua/c++ logger
== Graphics
use CoordsBuffer in font

View File

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

View File

@ -25,45 +25,13 @@ GameTopButton < UIButton
icon-color: #ffffffff
image-border: 3
$hover:
$on:
image-clip: 0 0 26 26
image-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
$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
$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
id: topMenu
@ -77,7 +45,11 @@ TopPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 150
layout:
type: horizontalBox
spacing: 4
fit-children: true
padding: 6 4
Panel
id: gameButtonsPanel
@ -85,13 +57,21 @@ TopPanel
anchors.bottom: parent.bottom
anchors.left: prev.right
anchors.right: next.left
layout:
type: horizontalBox
spacing: 4
padding: 6 4
Panel
id: rightButtonsPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 70
layout:
type: horizontalBox
spacing: 4
fit-children: true
padding: 6 4
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
local pos = self.position
local count = 1 -- todo make a window for it
local count = widget.currentDragThing:getData()
Game.move(widget.currentDragThing, pos, count)
return true

View File

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

View File

@ -1,7 +1,7 @@
Skills = {}
-- private variables
local skillWindow
local skillsWindow
local skillsButton
-- private functions
@ -19,7 +19,7 @@ local function getNumberString(number)
end
local function setSkillValue(id, value)
local skill = skillWindow:recursiveGetChildById(id)
local skill = skillsWindow:recursiveGetChildById(id)
if skill then
local widget = skill:getChildById('value')
@ -28,7 +28,7 @@ local function setSkillValue(id, value)
end
local function setSkillPercent(id, percent, tooltip)
local skill = skillWindow:recursiveGetChildById(id)
local skill = skillsWindow:recursiveGetChildById(id)
if skill then
local widget = skill:getChildById('percent')
@ -42,19 +42,22 @@ end
-- public functions
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)
end
function Skills.destroy()
--skillsButton:destroy()
--skillsButton = nil
skillWindow:destroy()
skillWindow = nil
skillsButton:destroy()
skillsButton = nil
skillsWindow:destroy()
skillsWindow = nil
end
function Skills.toggle()
local visible = not skillsWindow:isExplicitlyVisible()
skillsWindow:setVisible(visible)
skillsButton:setOn(visible)
end
function Skills.onSkillButtonClick(button)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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