enable skills and vip window on right panel
This commit is contained in:
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
|
source: /core_styles/images/interface_panel.png
|
||||||
border: 4
|
border: 4
|
||||||
|
|
||||||
|
InterfacePanel2 < Panel
|
||||||
|
focusable: false
|
||||||
|
border-image:
|
||||||
|
source: /core_styles/images/interface_panel2.png
|
||||||
|
border: 4
|
||||||
|
|
||||||
MapPanel < UIMap
|
MapPanel < UIMap
|
||||||
map margin: 4
|
map margin: 4
|
||||||
border-image:
|
border-image:
|
||||||
|
|
|
@ -5,6 +5,7 @@ Window < UIWindow
|
||||||
background-color: white
|
background-color: white
|
||||||
head height: 20
|
head height: 20
|
||||||
head text align: center
|
head text align: center
|
||||||
|
free move: true
|
||||||
border-image:
|
border-image:
|
||||||
source: /core_styles/images/window.png
|
source: /core_styles/images/window.png
|
||||||
border: 4
|
border: 4
|
||||||
|
@ -13,5 +14,20 @@ Window < UIWindow
|
||||||
state.pressed:
|
state.pressed:
|
||||||
opacity: 192
|
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
|
MainWindow < Window
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
|
@ -17,7 +17,8 @@ end
|
||||||
-- public functions
|
-- public functions
|
||||||
function Game.create()
|
function Game.create()
|
||||||
Game.gameUi = loadUI('/game/ui/gameinterface.otui', UI.root)
|
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
|
Game.gameUi.onKeyPress = onGameKeyPress
|
||||||
|
|
||||||
TextMessage.create()
|
TextMessage.create()
|
||||||
|
@ -33,7 +34,7 @@ end
|
||||||
function Game.show()
|
function Game.show()
|
||||||
Game.gameUi:show()
|
Game.gameUi:show()
|
||||||
Game.gameUi:focus()
|
Game.gameUi:focus()
|
||||||
Game.gameMapUi:focus()
|
Game.gameMapPanel:focus()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Game.hide()
|
function Game.hide()
|
||||||
|
|
|
@ -22,10 +22,10 @@ local messageTypes = {
|
||||||
-- public functions
|
-- public functions
|
||||||
function TextMessage.create()
|
function TextMessage.create()
|
||||||
bottomLabelWidget = UILabel.create()
|
bottomLabelWidget = UILabel.create()
|
||||||
Game.gameMapUi:addChild(bottomLabelWidget)
|
Game.gameMapPanel:addChild(bottomLabelWidget)
|
||||||
|
|
||||||
centerLabelWidget = UILabel.create()
|
centerLabelWidget = UILabel.create()
|
||||||
Game.gameMapUi:addChild(centerLabelWidget)
|
Game.gameMapPanel:addChild(centerLabelWidget)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hooked events
|
-- hooked events
|
||||||
|
|
|
@ -6,11 +6,12 @@ UIWidget
|
||||||
InterfacePanel
|
InterfacePanel
|
||||||
id: rightPanel
|
id: rightPanel
|
||||||
width: 200
|
width: 200
|
||||||
|
layout: verticalBox
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
InterfacePanel
|
InterfacePanel2
|
||||||
id: bottomPanel
|
id: bottomPanel
|
||||||
height: 140
|
height: 140
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -18,7 +19,7 @@ UIWidget
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
MapPanel
|
MapPanel
|
||||||
id: gameMap
|
id: mapPanel
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: rightPanel.left
|
anchors.right: rightPanel.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
|
@ -11,6 +11,7 @@ BottomLabel < Label
|
||||||
font: verdana-11px-rounded
|
font: verdana-11px-rounded
|
||||||
height: 16
|
height: 16
|
||||||
align: center
|
align: center
|
||||||
|
margin.bottom: 2
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
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"}
|
local skills = {"Fist Fighting", "Club Fighting", "Sword Fighting", "Axe Fighting", "Distance Fighting", "Shielding", "Fishing"}
|
||||||
|
|
||||||
function csw()
|
-- public functions
|
||||||
skillWindow = loadUI("/game/ui/skillwindow.otui", UI.root)
|
function Skills.create()
|
||||||
|
skillWindow = loadUI("/skills/skills.otui", Game.gameRightPanel)
|
||||||
|
|
||||||
local skillPanel = skillWindow:getChildById('skillPanel')
|
local skillPanel = skillWindow:getChildById('skillPanel')
|
||||||
|
|
||||||
|
@ -31,6 +34,12 @@ function csw()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Skills.destroy()
|
||||||
|
skillWindow:destroy()
|
||||||
|
skillWindow = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hooked events
|
||||||
function Game.setSkill(id, level, percent)
|
function Game.setSkill(id, level, percent)
|
||||||
local skillPanel = skillWindow:getChildById('skillPanel')
|
local skillPanel = skillWindow:getChildById('skillPanel')
|
||||||
local levelLabel = skillPanel:getChildById('skillLevel' .. id)
|
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.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
Window
|
MiniWindow
|
||||||
id: skillWindow
|
id: skillWindow
|
||||||
title: Skills
|
title: Skills
|
||||||
size: 200 200
|
size: 200 185
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
id: skillPanel
|
id: skillPanel
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
margin.top: 19
|
margin.top: 26
|
||||||
margin.bottom: 3
|
margin.bottom: 3
|
||||||
margin.left: 3
|
margin.left: 3
|
||||||
margin.right: 3
|
margin.right: 3
|
|
@ -9,7 +9,7 @@ TopPanel
|
||||||
id: settingsButton
|
id: settingsButton
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
margin.top: 3
|
margin.top: 4
|
||||||
margin.left: 6
|
margin.left: 6
|
||||||
onClick: Options.create()
|
onClick: Options.create()
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ TopPanel
|
||||||
TopButton
|
TopButton
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
margin.top: 3
|
margin.top: 4
|
||||||
margin.right: 6
|
margin.right: 6
|
||||||
onClick: |
|
onClick: |
|
||||||
if Game.isOnline() then
|
if Game.isOnline() then
|
||||||
|
@ -57,7 +57,7 @@ TopPanel
|
||||||
TopButton
|
TopButton
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: prev.left
|
anchors.right: prev.left
|
||||||
margin.top: 3
|
margin.top: 4
|
||||||
margin.right: 6
|
margin.right: 6
|
||||||
onClick: About.create()
|
onClick: About.create()
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
vipWindow = nil
|
VipList = {}
|
||||||
|
|
||||||
function createVipWindow()
|
-- private variables
|
||||||
vipWindow = loadUI("/game/ui/vipwindow.otui", Game.gameUi)
|
local vipWindow = nil
|
||||||
|
|
||||||
|
-- public functions
|
||||||
|
function VipList.create()
|
||||||
|
vipWindow = loadUI("/viplist/viplist.otui", Game.gameRightPanel)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function VipList.destroy()
|
||||||
|
vipWindow:destroy()
|
||||||
|
vipWindow = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hooked events
|
||||||
function Game.onAddVip(id, name, online)
|
function Game.onAddVip(id, name, online)
|
||||||
local vipList = vipWindow:getChildById('vipList')
|
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
|
VipListLabel < Label
|
||||||
font: verdana-11px-monochrome
|
font: verdana-11px-monochrome
|
||||||
margin.left: 30
|
margin.left: 5
|
||||||
|
|
||||||
Window
|
MiniWindow
|
||||||
id: vipWindow
|
id: vipWindow
|
||||||
title: VIP
|
title: VIP List
|
||||||
size: 200 200
|
|
||||||
|
|
||||||
TextList
|
TextList
|
||||||
id: vipList
|
id: vipList
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
margin.top: 19
|
margin.top: 26
|
||||||
margin.bottom: 3
|
margin.bottom: 6
|
||||||
margin.left: 3
|
margin.left: 6
|
||||||
margin.right: 3
|
margin.right: 6
|
||||||
|
|
|
@ -30,6 +30,7 @@ void UIWindow::setup()
|
||||||
{
|
{
|
||||||
UIWidget::setup();
|
UIWidget::setup();
|
||||||
m_moving = false;
|
m_moving = false;
|
||||||
|
m_freeMove = false;
|
||||||
m_headHeight = 0;
|
m_headHeight = 0;
|
||||||
m_titleAlign = Fw::AlignCenter;
|
m_titleAlign = Fw::AlignCenter;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +70,8 @@ void UIWindow::onStyleApply(const OTMLNodePtr& styleNode)
|
||||||
setTitle(node->value());
|
setTitle(node->value());
|
||||||
else if(node->tag() == "head text align")
|
else if(node->tag() == "head text align")
|
||||||
m_titleAlign = Fw::translateAlignment(node->value());
|
m_titleAlign = Fw::translateAlignment(node->value());
|
||||||
|
else if(node->tag() == "free move")
|
||||||
|
m_freeMove = node->value<bool>();
|
||||||
else if(node->tag() == "onEnter") {
|
else if(node->tag() == "onEnter") {
|
||||||
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
|
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
|
||||||
luaSetField(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)
|
bool UIWindow::onMousePress(const Point& mousePos, Fw::MouseButton button)
|
||||||
{
|
{
|
||||||
UIWidgetPtr clickedChild = getChildByPos(mousePos);
|
if(m_freeMove) {
|
||||||
if(!clickedChild || clickedChild->isPhantom()) {
|
UIWidgetPtr clickedChild = getChildByPos(mousePos);
|
||||||
m_moving = true;
|
if(!clickedChild || clickedChild->isPhantom()) {
|
||||||
m_movingReference = mousePos - getRect().topLeft();
|
m_moving = true;
|
||||||
|
m_movingReference = mousePos - getRect().topLeft();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return UIWidget::onMousePress(mousePos, button);
|
return UIWidget::onMousePress(mousePos, button);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
std::string m_title;
|
std::string m_title;
|
||||||
bool m_moving;
|
bool m_moving;
|
||||||
|
bool m_freeMove;
|
||||||
Point m_movingReference;
|
Point m_movingReference;
|
||||||
|
|
||||||
// styling
|
// styling
|
||||||
|
|
Loading…
Reference in New Issue