亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? frame.lua

?? 魔獸世界月光寶盒 感覺挺好
?? LUA
字號:
?--[[
	BagnonFrame
		A container frame for categories, tabs, bags, money, and purchasing bags

	Each frame contains its own list of slots, index by what bag and what slot it is in
	The index, bag slot 0 is used to store size information about each bag.
--]]

BagnonFrame = CreateFrame('Frame')
local Frame_mt = {__index = BagnonFrame}
local L = BAGNON_LOCALS

local DEFAULT_COLS = 8
local DEFAULT_SPACING = 1
local DEFAULT_STRATA = 'HIGH'
local ITEM_SIZE = BagnonItem.SIZE

local currentPlayer = UnitName('player')
local lastCreated = 0
local util = BagnonUtil


--[[ utility functions ]]--

local function ToIndex(bag, slot)
	if bag < 0 then
		return bag * 100 - slot
	else
		return bag * 100 + slot
	end
end

local function NormalSort(a, b)
	return a ~= -2 and (b == -2 or a < b)
end

local function ReverseSort(a, b)
	return a ~= -2 and (b == -2 or a > b)
end

local function HideAttachedMenus(frame)
	if BagnonMenu:GetAnchor() == frame then
		BagnonMenu:Hide()
	end
	
	if BagnonSpot:GetAnchor() == frame then
		BagnonSpot:Hide()
	end

	if BagnonDBUICharacterList and BagnonDBUICharacterList.frame == frame then
		BagnonDBUICharacterList:Hide()
	end
end


--[[ stuff for creating a new frame ]]--

local function CreateTitle(parent)
	local title = CreateFrame('Button', parent:GetName() .. 'Title', parent)

	local text = title:CreateFontString()
	text:SetAllPoints(title)
	text:SetJustifyH('LEFT')
	text:SetFontObject('GameFontNormal')
	title:SetFontString(text)

	title:SetHighlightTextColor(1, 1, 1)
	title:SetTextColor(1, 0.82, 0)
	title:RegisterForClicks('LeftButtonUp', 'LeftButtonDown', 'RightButtonUp', 'RightButtonDown')

	title:SetScript('OnClick', function(self, arg1) self:GetParent():OnClick(arg1) end)
	title:SetScript('OnDoubleClick', function(self, arg1) self:GetParent():OnDoubleClick(arg1) end)
	title:SetScript('OnEnter', function(self) self:GetParent():OnEnter(this) end)
	title:SetScript('OnLeave', function(self) self:GetParent():OnLeave(this) end)
	title:SetScript('OnMouseUp', function(self) self:GetParent():OnMouseUp() end)
	title:SetScript('OnMouseDown', function(self) self:GetParent():OnMouseDown() end)

	return title
end

local function Frame_Create()
	local name = format('BagnonFrame%d', lastCreated)
	local frame = CreateFrame('Frame', name, UIParent)
	setmetatable(frame, Frame_mt)

	frame.slots = {}

	frame:SetClampedToScreen(true)
	frame:SetMovable(true)
	frame:SetBackdrop({
	  bgFile = 'Interface\\ChatFrame\\ChatFrameBackground',
	  edgeFile = 'Interface\\Tooltips\\UI-Tooltip-Border',
	  edgeSize = 16,
	  tile = true, tileSize = 16,
	  insets = {left = 4, right = 4, top = 4, bottom = 4}
	})
	frame.borderSize = 16

	local close = CreateFrame('Button', name .. 'Close', frame, 'UIPanelCloseButton')
	close:SetPoint('TOPRIGHT', frame, 'TOPRIGHT', 6 - frame.borderSize/2, 6 - frame.borderSize/2)

	if BagnonDB then
		local playerDropdown = CreateFrame('Button', name .. 'DropDown', frame, 'BagnonDBUIDropDownButton')
		playerDropdown:SetPoint('TOPLEFT', frame, 'TOPLEFT', frame.borderSize/2 -2, -6)
	end

	local title = CreateTitle(frame)
	if BagnonDB then
		title:SetPoint('TOPLEFT', frame, 'TOPLEFT', 26 + frame.borderSize/2, -10)
	else
		title:SetPoint('TOPLEFT', frame, 'TOPLEFT', 6 + frame.borderSize/2, -10)
	end
	title:SetPoint('BOTTOMRIGHT', frame, 'TOPRIGHT', -24, -16 - frame.borderSize/2)
	frame.paddingY = 24

	frame:Hide()

	lastCreated = lastCreated + 1

	return frame
end

local function LoadSettings(frame, sets)
	frame.sets  = sets

	local r,g,b,a = frame:GetBackgroundColor()
	frame:SetBackdropColor(r, g, b, a)
	frame:SetBackdropBorderColor(1, 1, 1, a)

	frame:SetAlpha(sets.alpha or 1)
	frame:SetScale(sets.scale or 1)

	frame:SetToplevel(sets.topLevel)
	frame:SetFrameStrata(sets.strata or DEFAULT_STRATA)
	frame:Reposition()
end

local function PlaceAndUpdate(frame)
	if not frame:IsUserPlaced() then
		frame:SetPoint('CENTER', UIParent)
	end

	frame:SortBags()

	if not frame:IsShown() then
		frame:Show()
	else
		frame:Regenerate()
	end
end


--[[ usable functions ]]--

function BagnonFrame.New(name, sets, bags, isBank)
	local frame = Frame_Create()
	frame:SetParent(UIParent)

	LoadSettings(frame, sets)

	frame.showBags = sets.showBags
	frame.shownBags = sets.bags
	frame.bags = bags
	frame.isBank = isBank

	frame.bagFrame = BagnonBagFrame.New(frame, bags, isBank, sets.showBags)
	frame.moneyFrame = BagnonMoney.New(frame)

	frame:SetTitleText(name)

	frame:SetScript('OnShow', function() frame:OnShow() end)
	frame:SetScript('OnHide', function() frame:OnHide() end)
	frame:SetScript('OnEvent', function() frame:OnEvent() end)

	frame:RegisterEvent('BAG_UPDATE')
	frame:RegisterEvent('ITEM_LOCK_CHANGED')
	frame:RegisterEvent('BAG_UPDATE_COOLDOWN')
	if isBank then
		frame:RegisterEvent('PLAYERBANKSLOTS_CHANGED')
	end

	PlaceAndUpdate(frame)

	return frame
end


--[[ frame events ]]--

function BagnonFrame:OnEvent()
	if self:IsShown() and not self:IsCached() then
		if event == 'BAG_UPDATE' then
			self:OnBagUpdate(arg1)
		elseif event == 'ITEM_LOCK_CHANGED' then
			self:UpdateLockedSlots()
		elseif event == 'BAG_UPDATE_COOLDOWN' then
			self:UpdateSlotsOnCooldown()
		elseif event == 'PLAYERBANKSLOTS_CHANGED' then
			self:OnBagUpdate(-1)
		end
	end
end

function BagnonFrame:OnClick(button)
	if button == 'RightButton' then
		BagnonMenu:Show(self)
	end
end

function BagnonFrame:OnDoubleClick(button)
	if button == 'LeftButton' then
		BagnonSpot:Show(self)
	end
end

function BagnonFrame:OnMouseDown()
	if not self:IsLocked() then
		self:StartMoving()
	end
end

function BagnonFrame:OnMouseUp()
	self:StopMovingOrSizing()
	self:SavePosition()
end

function BagnonFrame:OnEnter(title)
	util:AnchorTooltip(title)

	GameTooltip:SetText(self:GetTitleText(), 1, 1, 1)
	GameTooltip:AddLine(L.TipShowMenu)
	GameTooltip:AddLine(L.TipShowSearch)
	GameTooltip:Show()
end

function BagnonFrame:OnLeave()
	GameTooltip:Hide()
end

function BagnonFrame:OnShow()
	self:Regenerate()
end

function BagnonFrame:OnHide()
	HideAttachedMenus(self)

	if self:GetPlayer() ~= currentPlayer then
		self:SetPlayer(currentPlayer)
	end
end


--[[ bag updating ]]--

function BagnonFrame:ShowBag(bag, enable)
	if enable then
		if not self:ShowingBag(bag) then
			local bags = self:GetVisibleBags()
			table.insert(bags, bag)
			self:SortBags()

			self:AddBag(bag, true)
		end
	else
		local index = self:ShowingBag(bag)
		if index then
			local bags = self:GetVisibleBags()
			table.remove(bags, index)
			self:SortBags()

			self:RemoveBag(bag)
		end
	end
end

function BagnonFrame:ShowingBag(bag)
	for i, visibleBag in pairs(self:GetVisibleBags()) do
		if visibleBag == bag then
			return i
		end
	end
end

function BagnonFrame:GetBags()
	return self.bags
end

function BagnonFrame:GetVisibleBags()
	return self.shownBags
end


--[[ item updating ]]--

function BagnonFrame:AddItem(bag, slot)
	local item = BagnonItem.Get(self, bag, slot)
	self.slots[ToIndex(bag, slot)] = item
	item:Update()
end

function BagnonFrame:RemoveItem(bag, slot)
	local item = self.slots[ToIndex(bag, slot)]
	self.slots[ToIndex(bag, slot)] = nil
	item:Release()
end


--[[ Frame Updating ]]--

--add any added slots, removed any removed slots, update the rest of the slots held by the bag
function BagnonFrame:Regenerate()
	self.bagFrame:Update()

	local sizeChanged = false
	local slots = self.slots
	
	for _, bag in ipairs(self.shownBags) do
		local prevSize = slots[bag*100] or 0
		local size = util:GetBagSize(bag, self:GetPlayer())
		slots[bag * 100] = size

		for slot = 1, min(prevSize, size) do
			local item = self.slots[ToIndex(bag, slot)]
			item:Update()
		end

		if size > prevSize then
			for slot = prevSize + 1, size do
				self:AddItem(bag, slot)
			end
			sizeChanged = true
		elseif size < prevSize then
			for slot = size + 1, prevSize do
				self:RemoveItem(bag, slot)
			end
			sizeChanged = true
		end
	end

	if sizeChanged then self:Layout() end
end

--add any added slots, removed any removed slots, update all the slots of the bag being updated
function BagnonFrame:OnBagUpdate(updatedBag)
	local sizeChanged = false
	local slots = self.slots

	for _, bag in ipairs(self.shownBags) do
		local prevSize = slots[bag*100] or 0
		local size = util:GetBagSize(bag, self:GetPlayer())
		slots[bag * 100] = size

		if bag == updatedBag then
			for slot = 1, min(prevSize, size) do
				local item = self.slots[ToIndex(bag, slot)]
				item:Update()
			end
		end

		if size > prevSize then
			for slot = prevSize + 1, size do
				self:AddItem(bag, slot)
			end
			sizeChanged = true
		elseif size < prevSize then
			for slot = size + 1, prevSize do
				self:RemoveItem(bag, slot)
			end
			sizeChanged = true
		end
	end

	if sizeChanged then self:Layout() end
end

function BagnonFrame:AddBag(bag)
	local prevSize = self.slots[bag * 100] or 0
	local size = util:GetBagSize(bag, self:GetPlayer())
	self.slots[bag * 100] = size

	for slot = 1, size do
		self:AddItem(bag, slot)
	end
	self:Layout()
end

function BagnonFrame:RemoveBag(bag)
	for slot = 1, util:GetBagSize(bag, self:GetPlayer()) do
		self:RemoveItem(bag, slot)
	end
	self:Layout()
end

function BagnonFrame:UpdateLockedSlots()
	for _, item in pairs(self.slots) do
		if not tonumber(item) then
			item:UpdateLock()
		end
	end
end

function BagnonFrame:UpdateSlotsOnCooldown()
	for bag = 0, 4 do
		for slot = 1, util:GetBagSize(bag) do
			local item = self.slots[ToIndex(bag,slot)]
			if item then
				item:UpdateCooldown()
			end
		end
	end
end


--[[ spot searching ]]--

function BagnonFrame:UpdateSearch()
	for _, item in pairs(self.slots) do
		if not tonumber(item) then
			item:UpdateSearch()
		end
	end
end


--[[ cached data viewing ]]--

function BagnonFrame:SetPlayer(player)
	self.player = player

	self:UpdateTitleText()
	self.bagFrame:Update()
	self.moneyFrame:Update()
	if self:IsShown() then
		self:Regenerate()
	end
end

function BagnonFrame:GetPlayer()
	return self.player or currentPlayer
end

function BagnonFrame:IsCached()
	return (self:GetPlayer() ~= currentPlayer) or (self.isBank and not util:AtBank())
end


--[[ layout ]]--

function BagnonFrame:Layout(cols, space)
	cols = cols or self.sets.cols or DEFAULT_COLS
	space = space or self.sets.space or DEFAULT_SPACING
	self.sets.cols = cols
	self.sets.space = space

	local borderSize = self.borderSize or 0
	local paddingY = self.paddingY or 0

	local width, height = self:LayoutItems(cols, space, borderSize/2, borderSize/2 + paddingY)

	local bags = self.bagFrame
	local money = self.moneyFrame

	bags:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', borderSize/2, borderSize/2)
	money:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderSize/2 - 2, borderSize/2)

	height = height + max(bags:GetHeight(), money:GetHeight())
	if bags.shown then
		height = height + 8
	end
	width = max(width, (money:GetWidth() + bags:GetToggleWidth() - 8), bags:GetWidth())

	width = max(width + borderSize, 48)
	height = max(height + borderSize + paddingY, 48)

	self:SetHeight(height); self:SetWidth(width)
end

function BagnonFrame:LayoutItems(cols, space, offX, offY)
	if not next(self.slots) then return 0, 0 end

	local itemSize = ITEM_SIZE + space
	local slots = self.slots
	local player = self:GetPlayer()

	local i = 0
	for _,bag in ipairs(self.shownBags) do
		for slot = 1, util:GetBagSize(bag, player) do
			local item = slots[ToIndex(bag, slot)]
			if item then
				i = i + 1
				local row = mod(i - 1, cols)
				local col = ceil(i / cols) - 1
				item:SetPoint('TOPLEFT', self, 'TOPLEFT', itemSize * row + offX, -(itemSize * col + offY))
			end
		end
	end

	return itemSize * min(cols, i) - space, itemSize * ceil(i / cols) - space
end

function BagnonFrame:GetLayout()
	return self.sets.cols, self.sets.space
end


--[[ positioning ]]--

function BagnonFrame:Lock(enable)
	if enable then
		self.sets.lock = true
	else
		self.sets.lock = nil
	end
end

function BagnonFrame:IsLocked()
	return self.sets.lock
end

function BagnonFrame:Reposition()
	local x, y, scale, parentScale = self:GetPosition()

	if x and y then
		local parent = self:GetParent()

		local ratio
		if parentScale then
			ratio = parentScale / parent:GetScale()
		else
			ratio = 1
		end

		self:ClearAllPoints()
		self:SetScale(scale)
		self:SetPoint('TOPLEFT', parent, 'BOTTOMLEFT', x * ratio, y * ratio)
		self:SetUserPlaced(true)
	end
end

function BagnonFrame:SavePosition()
	local sets = self.sets
	if sets then
		sets.x = self:GetLeft()
		sets.y = self:GetTop()
		sets.scale = self:GetScale()
		sets.parentScale = self:GetParent():GetScale()
	end
end

function BagnonFrame:GetPosition()
	local sets = self.sets
	if sets then
		return sets.x, sets.y, sets.scale, sets.parentScale
	end
end


--[[ coloring ]]--

function BagnonFrame:GetBackgroundColor()
	local sets = self.sets
	if sets then
		local bg = sets.bg
		return bg.r, bg.g, bg.b, bg.a
	end
end


--[[ title ]]--

function BagnonFrame:SetTitleText(text)
	self.titleText = text
	self:UpdateTitleText()
end

function BagnonFrame:UpdateTitleText()
	getglobal(self:GetName() .. 'Title'):SetText(self:GetTitleText())
end

function BagnonFrame:GetTitleText()
	return format(self.titleText or self:GetName(), self:GetPlayer())
end

--[[ Sorting ]]--

function BagnonFrame:SortBags()
	if self.sets.reverseSort then
		table.sort(self.sets.bags, ReverseSort)
	else
		table.sort(self.sets.bags, NormalSort)
	end
end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久久免费丝袜| 日本韩国一区二区三区| 日韩欧美在线影院| 日韩福利视频网| 欧美成人video| 国产精品一线二线三线精华| 国产丝袜美腿一区二区三区| 粉嫩aⅴ一区二区三区四区五区| 国产精品久久久久久久久动漫 | 国产精品久久久久久久久搜平片| 成人性生交大片免费看中文| 亚洲三级电影网站| 欧美精品在线观看一区二区| 免费久久99精品国产| 久久久av毛片精品| 91丨porny丨最新| 视频在线在亚洲| 久久精品亚洲乱码伦伦中文| av一二三不卡影片| 丝袜美腿亚洲一区| 国产日韩精品一区二区三区| 91免费在线看| 麻豆91免费看| 最好看的中文字幕久久| 777久久久精品| 成人免费三级在线| 性久久久久久久久| 国产欧美精品国产国产专区| 91极品美女在线| 国产一区视频网站| 国产69精品久久久久毛片| 亚洲精品久久7777| 精品国产一区二区亚洲人成毛片| heyzo一本久久综合| 亚欧色一区w666天堂| 欧美国产一区在线| 在线成人高清不卡| 99久久综合狠狠综合久久| 日韩精品一级二级 | 国产精品久久久久久久久搜平片| 欧美亚洲图片小说| 国产成人福利片| 秋霞成人午夜伦在线观看| 中文字幕在线不卡视频| 日韩欧美久久久| 在线观看网站黄不卡| 韩国精品主播一区二区在线观看 | 精品国产免费一区二区三区香蕉 | 精品视频色一区| 北岛玲一区二区三区四区 | 极品少妇xxxx偷拍精品少妇| 亚洲乱码国产乱码精品精小说| 精品国产91乱码一区二区三区 | 国产精品一卡二卡在线观看| 亚洲午夜在线观看视频在线| 国产精品免费久久| 久久久久青草大香线综合精品| 欧美日韩视频不卡| 色婷婷综合久久| 99re在线精品| 成av人片一区二区| 国产成人av电影免费在线观看| 男人操女人的视频在线观看欧美| 亚洲永久精品国产| 亚洲精品久久嫩草网站秘色| 国产精品灌醉下药二区| 国产婷婷精品av在线| 久久蜜桃一区二区| 精品成人在线观看| 精品粉嫩aⅴ一区二区三区四区| 91精品国产麻豆国产自产在线 | 91国偷自产一区二区三区成为亚洲经典 | 亚洲午夜在线电影| 亚洲激情av在线| 亚洲欧美一区二区三区极速播放 | 不卡在线视频中文字幕| 高清不卡在线观看| 国产精品99久久久久久久女警| 国产一区二区主播在线| 国产剧情一区在线| 国产福利一区二区三区| 国产成人午夜99999| 国产不卡视频在线播放| 国产精品66部| av中文字幕在线不卡| 99久久er热在这里只有精品66| proumb性欧美在线观看| 色综合久久综合网97色综合| 色综合久久久久久久久| 91精品1区2区| 91精品婷婷国产综合久久性色| 日韩一区二区三区av| 精品电影一区二区三区| 亚洲国产高清aⅴ视频| 中文字幕在线一区免费| 一级特黄大欧美久久久| 三级久久三级久久| 久久精品国产网站| 丁香网亚洲国际| 一本大道久久a久久综合| 色88888久久久久久影院野外| 欧美熟乱第一页| 欧美videossexotv100| 国产拍揄自揄精品视频麻豆| 国产精品久久久久影院亚瑟| 一区二区欧美精品| 久久99久久99| 成人av综合在线| 欧美日韩在线一区二区| 亚洲精品一区二区三区福利| 国产精品超碰97尤物18| 天天综合天天综合色| 国产在线精品一区在线观看麻豆| www.日韩精品| 欧美一区二区三区在线| 国产欧美精品在线观看| 亚洲国产另类av| 国产精品一二三四| 欧美日韩国产免费| 国产欧美日韩久久| 偷拍与自拍一区| 成人a级免费电影| 欧美一级一区二区| 高清不卡在线观看| 欧美日韩在线精品一区二区三区激情| 精品精品国产高清一毛片一天堂| 中文字幕一区二区三区在线播放 | 九色|91porny| 色婷婷国产精品| 久久香蕉国产线看观看99| 一区二区三区在线观看视频| 国内一区二区在线| 欧美日韩免费一区二区三区| 欧美国产精品中文字幕| 石原莉奈在线亚洲二区| av色综合久久天堂av综合| 欧美一区二区三区免费视频| 最新热久久免费视频| 国产精品996| 日韩欧美国产一区二区三区| 玉米视频成人免费看| 国产成人综合精品三级| 91精品国产入口在线| 一区二区三区不卡视频| 99综合电影在线视频| 久久精品网站免费观看| 久久97超碰国产精品超碰| 欧美日韩国产高清一区| 最新国产精品久久精品| 国产成人亚洲综合色影视| 日韩欧美国产一区二区在线播放 | 日本亚洲最大的色成网站www| 91视频在线看| 国产精品久久777777| 国产精品亚洲一区二区三区在线| 欧美一级二级在线观看| 亚洲成人精品一区二区| 色噜噜狠狠成人中文综合 | 亚洲一区二区三区三| 91一区在线观看| 亚洲国产成人在线| 国产成人自拍网| 国产免费久久精品| 国产成人综合视频| 国产亚洲人成网站| 国产麻豆日韩欧美久久| 精品国产1区2区3区| 男女性色大片免费观看一区二区| 欧美猛男gaygay网站| 亚洲第一狼人社区| 欧美日本国产一区| 亚洲777理论| 欧美成人欧美edvon| 韩国毛片一区二区三区| 国产日产欧美一区二区视频| 国产成人综合亚洲网站| 中文字幕精品在线不卡| www.欧美日韩| 一区二区激情小说| 欧美肥胖老妇做爰| 久久99精品久久久久久国产越南| 欧美不卡一二三| 国产成人免费在线观看不卡| 中文字幕第一区| 欧美中文字幕一区二区三区 | 欧美日韩国产高清一区二区| 日韩高清一级片| 久久综合久久综合久久综合| 国产精品自在欧美一区| 国产精品护士白丝一区av| 91色婷婷久久久久合中文| 亚洲国产精品久久人人爱蜜臀| 6080午夜不卡| 国产精品白丝jk白祙喷水网站 | 精品人伦一区二区色婷婷| 国内精品嫩模私拍在线| 中文字幕亚洲综合久久菠萝蜜| 91成人在线免费观看| 久久精品国产久精国产| 久久精品久久久精品美女|