enable skills and vip window on right panel

master
Eduardo Bart 13 years ago
parent 101f608d40
commit 14ce1c8183

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

@ -21,6 +21,12 @@ InterfacePanel < Panel
source: /core_styles/images/interface_panel.png
border: 4
InterfacePanel2 < Panel
focusable: false
border-image:
source: /core_styles/images/interface_panel2.png
border: 4
MapPanel < UIMap
map margin: 4
border-image:

@ -5,6 +5,7 @@ Window < UIWindow
background-color: white
head height: 20
head text align: center
free move: true
border-image:
source: /core_styles/images/window.png
border: 4
@ -13,5 +14,20 @@ Window < UIWindow
state.pressed:
opacity: 192
MiniWindow < UIWindow
font: verdana-11px-antialised
size: 192 200
head height: 25
head text align: center
margin.top: 6
margin.left: 6
margin.right: 6
margin.bottom: 6
free move: true
border-image:
source: /core_styles/images/mini_window.png
border: 4
border.top: 25
MainWindow < Window
anchors.centerIn: parent

@ -17,7 +17,8 @@ end
-- public functions
function Game.create()
Game.gameUi = loadUI('/game/ui/gameinterface.otui', UI.root)
Game.gameMapUi = Game.gameUi:getChildById('gameMap')
Game.gameMapPanel = Game.gameUi:getChildById('mapPanel')
Game.gameRightPanel = Game.gameUi:getChildById('rightPanel')
Game.gameUi.onKeyPress = onGameKeyPress
TextMessage.create()
@ -33,7 +34,7 @@ end
function Game.show()
Game.gameUi:show()
Game.gameUi:focus()
Game.gameMapUi:focus()
Game.gameMapPanel:focus()
end
function Game.hide()

@ -22,10 +22,10 @@ local messageTypes = {
-- public functions
function TextMessage.create()
bottomLabelWidget = UILabel.create()
Game.gameMapUi:addChild(bottomLabelWidget)
Game.gameMapPanel:addChild(bottomLabelWidget)
centerLabelWidget = UILabel.create()
Game.gameMapUi:addChild(centerLabelWidget)
Game.gameMapPanel:addChild(centerLabelWidget)
end
-- hooked events

@ -6,11 +6,12 @@ UIWidget
InterfacePanel
id: rightPanel
width: 200
layout: verticalBox
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
InterfacePanel
InterfacePanel2
id: bottomPanel
height: 140
anchors.left: parent.left
@ -18,7 +19,7 @@ UIWidget
anchors.bottom: parent.bottom
MapPanel
id: gameMap
id: mapPanel
anchors.left: parent.left
anchors.right: rightPanel.left
anchors.top: parent.top

@ -11,6 +11,7 @@ BottomLabel < Label
font: verdana-11px-rounded
height: 16
align: center
margin.bottom: 2
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right

@ -1,9 +1,12 @@
skillWindow = nil
Skills = {}
-- private variables
local skillWindow = nil
local skills = {"Fist Fighting", "Club Fighting", "Sword Fighting", "Axe Fighting", "Distance Fighting", "Shielding", "Fishing"}
function csw()
skillWindow = loadUI("/game/ui/skillwindow.otui", UI.root)
-- public functions
function Skills.create()
skillWindow = loadUI("/skills/skills.otui", Game.gameRightPanel)
local skillPanel = skillWindow:getChildById('skillPanel')
@ -31,6 +34,12 @@ function csw()
end
end
function Skills.destroy()
skillWindow:destroy()
skillWindow = nil
end
-- hooked events
function Game.setSkill(id, level, percent)
local skillPanel = skillWindow:getChildById('skillPanel')
local levelLabel = skillPanel:getChildById('skillLevel' .. id)

@ -0,0 +1,18 @@
Module
name: skills
description: Manage skills window
author: OTClient team
website: https://github.com/edubart/otclient
autoLoad: true
dependencies:
- game
onLoad: |
require 'skills'
Skills.create()
return true
onUnload:
Skills.destroy()

@ -33,15 +33,15 @@ SkillPercentPanel < UIWidget
anchors.left: parent.left
anchors.right: parent.right
Window
MiniWindow
id: skillWindow
title: Skills
size: 200 200
size: 200 185
Panel
id: skillPanel
anchors.fill: parent
margin.top: 19
margin.top: 26
margin.bottom: 3
margin.left: 3
margin.right: 3

@ -9,7 +9,7 @@ TopPanel
id: settingsButton
anchors.top: parent.top
anchors.left: parent.left
margin.top: 3
margin.top: 4
margin.left: 6
onClick: Options.create()
@ -39,7 +39,7 @@ TopPanel
TopButton
anchors.top: parent.top
anchors.right: parent.right
margin.top: 3
margin.top: 4
margin.right: 6
onClick: |
if Game.isOnline() then
@ -57,7 +57,7 @@ TopPanel
TopButton
anchors.top: parent.top
anchors.right: prev.left
margin.top: 3
margin.top: 4
margin.right: 6
onClick: About.create()

@ -1,9 +1,19 @@
vipWindow = nil
VipList = {}
function createVipWindow()
vipWindow = loadUI("/game/ui/vipwindow.otui", Game.gameUi)
-- private variables
local vipWindow = nil
-- public functions
function VipList.create()
vipWindow = loadUI("/viplist/viplist.otui", Game.gameRightPanel)
end
function VipList.destroy()
vipWindow:destroy()
vipWindow = nil
end
-- hooked events
function Game.onAddVip(id, name, online)
local vipList = vipWindow:getChildById('vipList')

@ -0,0 +1,18 @@
Module
name: viplist
description: Manage vip list window
author: OTClient team
website: https://github.com/edubart/otclient
autoLoad: true
dependencies:
- game
onLoad: |
require 'viplist'
VipList.create()
return true
onUnload:
VipList.destroy()

@ -1,16 +1,15 @@
VipListLabel < Label
font: verdana-11px-monochrome
margin.left: 30
margin.left: 5
Window
MiniWindow
id: vipWindow
title: VIP
size: 200 200
title: VIP List
TextList
id: vipList
anchors.fill: parent
margin.top: 19
margin.bottom: 3
margin.left: 3
margin.right: 3
margin.top: 26
margin.bottom: 6
margin.left: 6
margin.right: 6

@ -30,6 +30,7 @@ void UIWindow::setup()
{
UIWidget::setup();
m_moving = false;
m_freeMove = false;
m_headHeight = 0;
m_titleAlign = Fw::AlignCenter;
}
@ -69,6 +70,8 @@ void UIWindow::onStyleApply(const OTMLNodePtr& styleNode)
setTitle(node->value());
else if(node->tag() == "head text align")
m_titleAlign = Fw::translateAlignment(node->value());
else if(node->tag() == "free move")
m_freeMove = node->value<bool>();
else if(node->tag() == "onEnter") {
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
luaSetField(node->tag());
@ -112,10 +115,12 @@ void UIWindow::onFocusChange(bool focused, Fw::FocusReason reason)
bool UIWindow::onMousePress(const Point& mousePos, Fw::MouseButton button)
{
UIWidgetPtr clickedChild = getChildByPos(mousePos);
if(!clickedChild || clickedChild->isPhantom()) {
m_moving = true;
m_movingReference = mousePos - getRect().topLeft();
if(m_freeMove) {
UIWidgetPtr clickedChild = getChildByPos(mousePos);
if(!clickedChild || clickedChild->isPhantom()) {
m_moving = true;
m_movingReference = mousePos - getRect().topLeft();
}
}
return UIWidget::onMousePress(mousePos, button);
}

@ -46,6 +46,7 @@ protected:
private:
std::string m_title;
bool m_moving;
bool m_freeMove;
Point m_movingReference;
// styling

Loading…
Cancel
Save