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
size: 106 22
text-offset: 0 0
image-source: /images/button.png
image-source: /images/button_rounded.png
image-color: white
image-clip: 0 0 20 20
image-border: 2
@ -58,4 +58,4 @@ NextButton < BrowseButton
icon-source: /images/arrow_right.png
PreviousButton < BrowseButton
icon-source: /images/arrow_left.png
icon-source: /images/arrow_left.png

View File

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

View File

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

View File

@ -41,7 +41,7 @@ function UIPopupMenu:addOption(optionName, optionCallback)
self:getParent():destroy()
end
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))
end

View File

@ -91,9 +91,9 @@ function onSpellCooldown(iconId, duration)
icon:setId(spellName)
icon:setImageSource('/game_cooldown/icons/' .. SpelllistSettings[modules.game_spelllist.getSpelllistProfile()].iconFile)
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)
progressRect:setTooltip(spellName)
end

View File

@ -93,7 +93,7 @@ function show()
gameRootPanel:show()
gameRootPanel:focus()
gameMapPanel:followCreature(g_game.getLocalPlayer())
updateStretchShrink()
updateStretchShrink()
end
function hide()
@ -558,4 +558,4 @@ function onLeftPanelVisibilityChange(leftPanel, visible)
children[i]:setParent(gameRightPanel)
end
end
end
end

View File

@ -130,7 +130,7 @@ function showFlagDialog(position)
flagRadioGroup:selectWidget(flagCheckbox[1])
cancelButton.onClick = function()
cancelButton.onClick = function()
flagRadioGroup:destroy()
destroyFlagWindow()
end

View File

@ -1,5 +1,3 @@
TextScrollbar < VerticalScrollBar
ChoiceListLabel < Label
font: verdana-11px-monochrome
background-color: alpha
@ -58,4 +56,4 @@ ModalDialog < MainWindow
anchors.bottom: choiceList.bottom
anchors.right: choiceList.right
step: 14
pixels-scroll: true
pixels-scroll: true

View File

@ -71,7 +71,7 @@ function addVip()
destroyAddWindow()
end
function onAddVip(id, name, online)
function onAddVip(id, name, state)
local vipList = vipWindow:getChildById('contentsPanel')
local label = g_ui.createWidget('VipListLabel')
@ -79,13 +79,15 @@ function onAddVip(id, name, online)
label:setId('vip' .. id)
label:setText(name)
if online then
if state == VipState.Online then
label:setColor('#00ff00')
elseif state == VipState.Pending then
label:setColor('#ffca38')
else
label:setColor('#ff0000')
end
label.vipOnline = online
label.vipState = state
label:setPhantom(false)
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
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)
return
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 length = math.min(childText:len(), nameLower:len())
@ -118,13 +121,13 @@ function onAddVip(id, name, online)
vipList:insertChild(childrenCount+1, label)
end
function onVipStateChange(id, online)
function onVipStateChange(id, state)
local vipList = vipWindow:getChildById('contentsPanel')
local label = vipList:getChildById('vip' .. id)
local text = label:getText()
label:destroy()
onAddVip(id, text, online)
onAddVip(id, text, state)
end
function onVipListMousePress(widget, mousePos, mouseButton)

View File

@ -160,18 +160,24 @@ OsTypes = {
}
PathFindResults = {
Ok = 0,
Position = 1,
Impossipble = 2,
TooFar = 3,
NoWay = 4
Ok = 0,
Position = 1,
Impossipble = 2,
TooFar = 3,
NoWay = 4
}
PathFindFlags = {
AllowNullTiles = 1,
AllowCreatures = 2,
AllowNonPathable = 4,
AllowNonWalkable = 8
AllowNullTiles = 1,
AllowCreatures = 2,
AllowNonPathable = 4,
AllowNonWalkable = 8
}
VipState = {
Offline = 0,
Online = 1,
Pending = 2
}
-- @}