mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 07:26:49 +01:00
change in topmenu and some fixes
This commit is contained in:
@@ -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})
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -33,7 +33,7 @@ SkillPercentPanel < ProgressBar
|
||||
MiniWindow
|
||||
id: skillWindow
|
||||
text: Skills
|
||||
size: 200 350
|
||||
height: 350
|
||||
|
||||
Panel
|
||||
id: skillPanel
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user