Some fixes and design tweaks:

* Fixed the game_viplist module to work with the latest vip protocols.
* Fixed a referencing error in the game_cooldown module
* Started editing the design of the popupmenu (needs more work).
This commit is contained in:
BeniS 2012-12-29 05:15:57 +13:00
parent 034c768994
commit 8961f4dfd4
12 changed files with 52 additions and 36 deletions

View File

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

View File

@ -3,7 +3,7 @@ Button < UIButton
color: #f0ad4dff color: #f0ad4dff
size: 106 22 size: 106 22
text-offset: 0 0 text-offset: 0 0
image-source: /images/button.png image-source: /images/button_rounded.png
image-color: white image-color: white
image-clip: 0 0 20 20 image-clip: 0 0 20 20
image-border: 2 image-border: 2

View File

@ -1,15 +1,25 @@
PopupMenuButton < UIButton PopupMenuButton < UIButton
height: 18 height: 18
margin-left: 3 margin-left: 5
margin-right: 3 margin-right: 5
margin-top: 1
margin-bottom: 1
size: 0 21
text-offset: 0 0
font: verdana-11px-antialised font: verdana-11px-antialised
image-source: /images/button_square.png
image-color: white
image-clip: 0 0 20 20
image-border: 2
color: #aaaaaa color: #aaaaaa
background-color: alpha background-color: alpha
$hover !disabled: $hover !disabled:
color: #ffffff color: #ffffff
background-color: #ffffff44 background-color: #ffffff44
image-clip: 0 40 20 20
$disabled: $disabled:
color: #555555 color: #555555
@ -17,6 +27,7 @@ PopupMenuButton < UIButton
PopupMenuSeparator < UIWidget PopupMenuSeparator < UIWidget
margin-left: 2 margin-left: 2
margin-right: 2 margin-right: 2
margin-bottom: 1
image-source: /images/menubox.png image-source: /images/menubox.png
image-border-left: 1 image-border-left: 1
image-border-right: 1 image-border-right: 1

View File

@ -35,13 +35,11 @@ function debugContainersItems()
if hovered then if hovered then
local item = self:getItem() local item = self:getItem()
if item then if item then
local text = [[ local text = "id: " ..item:getId() ..
id:]] ..item:getId() .. [[, "\n stackable: " ..tostring(item:isStackable()) ..
stackable:]] ..tostring(item:isStackable()) .. [[, "\n marketable: " ..tostring(item:isMarketable()) ..
marketable:]] ..tostring(item:isMarketable()) .. [[, "\n vocation: "..(item:getMarketData() and item:getMarketData().restrictVocation or 'none') ..
vocation:]]..(item:getMarketData() and item:getMarketData().restrictVocation or 'none') ..[[, "\n cloth slot: " ..item:getClothSlot()
cloth slot:]] ..item:getClothSlot() .. [[
]]
g_tooltip.display(text) g_tooltip.display(text)
end end
else else

View File

@ -41,7 +41,7 @@ function UIPopupMenu:addOption(optionName, optionCallback)
self:getParent():destroy() self:getParent():destroy()
end end
optionWidget:setText(optionName) optionWidget:setText(optionName)
local width = optionWidget:getTextSize().width + optionWidget:getMarginLeft() + optionWidget:getMarginRight() + 6 local width = optionWidget:getTextSize().width + optionWidget:getMarginLeft() + optionWidget:getMarginRight() + 15
self:setWidth(math.max(self:getWidth(), width)) self:setWidth(math.max(self:getWidth(), width))
end end

View File

@ -91,9 +91,9 @@ function onSpellCooldown(iconId, duration)
icon:setId(spellName) icon:setId(spellName)
icon:setImageSource('/game_cooldown/icons/' .. SpelllistSettings[modules.game_spelllist.getSpelllistProfile()].iconFile) icon:setImageSource('/game_cooldown/icons/' .. SpelllistSettings[modules.game_spelllist.getSpelllistProfile()].iconFile)
icon:setImageClip(modules.game_spelllist.getIconImageClip(otcIconId)) icon:setImageClip(modules.game_spelllist.getIconImageClip(otcIconId))
icon.event = scheduleEvent(function() icon:destroy() end, duration) icon.event = scheduleEvent(function() icon:destroy() icon = nil end, duration)
local progressRect = g_ui.createWidget('SpellProgressRect', icon) local progressRect = g_ui.createWidget('SpellProgressRect')
updateProgressRect(progressRect, duration/25, true) updateProgressRect(progressRect, duration/25, true)
progressRect:setTooltip(spellName) progressRect:setTooltip(spellName)
end end

View File

@ -1,5 +1,3 @@
TextScrollbar < VerticalScrollBar
ChoiceListLabel < Label ChoiceListLabel < Label
font: verdana-11px-monochrome font: verdana-11px-monochrome
background-color: alpha background-color: alpha

View File

@ -71,7 +71,7 @@ function addVip()
destroyAddWindow() destroyAddWindow()
end end
function onAddVip(id, name, online) function onAddVip(id, name, state)
local vipList = vipWindow:getChildById('contentsPanel') local vipList = vipWindow:getChildById('contentsPanel')
local label = g_ui.createWidget('VipListLabel') local label = g_ui.createWidget('VipListLabel')
@ -79,13 +79,15 @@ function onAddVip(id, name, online)
label:setId('vip' .. id) label:setId('vip' .. id)
label:setText(name) label:setText(name)
if online then if state == VipState.Online then
label:setColor('#00ff00') label:setColor('#00ff00')
elseif state == VipState.Pending then
label:setColor('#ffca38')
else else
label:setColor('#ff0000') label:setColor('#ff0000')
end end
label.vipOnline = online label.vipState = state
label:setPhantom(false) label:setPhantom(false)
connect(label, { onDoubleClick = function () g_game.openPrivateChannel(label:getText()) return true end } ) connect(label, { onDoubleClick = function () g_game.openPrivateChannel(label:getText()) return true end } )
@ -95,12 +97,13 @@ function onAddVip(id, name, online)
for i=1,childrenCount do for i=1,childrenCount do
local child = vipList:getChildByIndex(i) local child = vipList:getChildByIndex(i)
if online and not child.vipOnline then if state == VipState.Online and not child.vipState == VipState.Online then
vipList:insertChild(i, label) vipList:insertChild(i, label)
return return
end end
if (not online and not child.vipOnline) or (online and child.vipOnline) then if (not state == VipState.Online and not child.vipState == VipState.Online)
or (state == VipState.Online and child.vipState == VipState.Online) then
local childText = child:getText():lower() local childText = child:getText():lower()
local length = math.min(childText:len(), nameLower:len()) local length = math.min(childText:len(), nameLower:len())
@ -118,13 +121,13 @@ function onAddVip(id, name, online)
vipList:insertChild(childrenCount+1, label) vipList:insertChild(childrenCount+1, label)
end end
function onVipStateChange(id, online) function onVipStateChange(id, state)
local vipList = vipWindow:getChildById('contentsPanel') local vipList = vipWindow:getChildById('contentsPanel')
local label = vipList:getChildById('vip' .. id) local label = vipList:getChildById('vip' .. id)
local text = label:getText() local text = label:getText()
label:destroy() label:destroy()
onAddVip(id, text, online) onAddVip(id, text, state)
end end
function onVipListMousePress(widget, mousePos, mouseButton) function onVipListMousePress(widget, mousePos, mouseButton)

View File

@ -174,4 +174,10 @@ PathFindFlags = {
AllowNonWalkable = 8 AllowNonWalkable = 8
} }
VipState = {
Offline = 0,
Online = 1,
Pending = 2
}
-- @} -- @}