Go to most recent revision |
Compare with Previous |
Blame |
View Log
import "Deusdictum.UI.Dragbar"
SortButton={}
SortButton.Window=Turbine.UI.Window()
SortButton.Window:SetVisible(true)
SortButton.Window.DragBar = Deusdictum.UI.DragBar( SortButton.Window,"Sort")
SortButton.Window:SetPosition(SortButtonData.X,SortButtonData.Y)
SortButton.Window:SetSize(32,32)
SortButton.Window:SetOpacity(1)
SortButton.Window:SetMouseVisible(true)
SortButton.Window:SetBackground(0x41007ecf)
SortButton.Window:SetStretchMode(1)
SortButton.Window:SetSize(32*SortButtonData.Scale,32*SortButtonData.Scale)
SortButton.Window:SetVisible(not(SortButtonData.Hide))
function SortButton.Window:GetWidth()
return 32*SortButtonData.Scale
end
function SortButton.Window:GetHeight()
return 32*SortButtonData.Scale
end
function SortButton.Window:GetSize()
return 32*SortButtonData.Scale ,32*SortButtonData.Scale
end
SortButton.Window.DragBar:Refresh()
SortButton.Window.MouseDown=function(sender,args)
if SortButton.Window.DragBar:IsVisible() then
moving=true
else
if ( args.Button == Turbine.UI.MouseButton.Left ) then
if SB.LeftClick~="bag" then
Sort()
else
if SortBag.Window:IsVisible() then SortBag.Window:Close() else openbag() end
end
else
--Context menu
local contextMenu = Turbine.UI.ContextMenu()
contextMenu.items = contextMenu:GetItems()
local option1 = Turbine.UI.MenuItem("On left click..")
contextMenu.SubMenuItems = option1:GetItems()
local suboption1={}
suboption1[1] = Turbine.UI.MenuItem("Sort the pack",true,SB.LeftClick~="bag")
suboption1[1].Click = function () SB.LeftClick="sort" end
contextMenu.SubMenuItems:Add(suboption1[1])
suboption1[2] = Turbine.UI.MenuItem("Open the SortBag",true,SB.LeftClick=="bag")
suboption1[2].Click = function () SB.LeftClick="bag" end
contextMenu.SubMenuItems:Add(suboption1[2])
local txt
if SB.LeftClick~="bag" then txt="Open the SortBag" else txt="Sort the backpack" end
local option2=Turbine.UI.MenuItem(txt,true)
option2.Click = function () if SB.LeftClick=="bag" then Sort() else openbag() end end
local option3=Turbine.UI.MenuItem("Override default bags",true,SB.override)
option3.Click = function () SB.override=not(SB.override) SBOverride() end
local option4=Turbine.UI.MenuItem("Open the sort order panel",true)
option4.Click = function () import"JackdawPlugins.SortPack.ListOption" ShowListOption() end
contextMenu.items:Add(option1)
contextMenu.items:Add(option2)
contextMenu.items:Add(option3)
contextMenu.items:Add(option4)
contextMenu:ShowMenu()
end
end
end
SortButton.Window.MouseUp=function(sender,args)
moving=false
end
SortButton.Window.MouseMove=function(sender,args)
if moving then
local x,y=SortButton.Window:GetMousePosition()
SortButtonData.Scale=math.max(x,y)/32
if SortButtonData.Scale<0.25 then SortButtonData.Scale=0.25 end
SortButton.Window:SetSize(32*SortButtonData.Scale,32*SortButtonData.Scale)
SortButton.Window.DragBar:Refresh()
end
end
Go to most recent revision |
Compare with Previous |
Blame
All times are GMT -5. The time now is 06:32 PM.