完成多出修改
修复拾取界面点击无效问题 修复宠物训练界面不显示训练点问题 新增天赋分享到聊天界面 修复飞行界面无法关闭问题 修复术士宠物的显示问题 为天赋界面添加默认数据库支持 框架现在也可自主选择是否启用 玩家框架和目标框架可取消显示3D头像以及透明度修改 背包和银行也添加透明度自定义支持 优化tooltip性能和背包物品显示方式 修复布局模式在ui缩放后不能正常定位的问题 添加硬核模式危险和死亡的工会通报 添加拾取和已拾取的框体 等等
This commit is contained in:
297
Minimap.lua
297
Minimap.lua
@@ -19,6 +19,28 @@ local MAP_STYLES = {
|
||||
{ key = "ss", tex = "Interface\\AddOns\\Nanami-UI\\img\\ss", label = "术士", plateY = -6, textColor = {1, 1, 1} },
|
||||
{ key = "dly", tex = "Interface\\AddOns\\Nanami-UI\\img\\dly", label = "德鲁伊", plateY = -6, textColor = {0.22, 0.13, 0.07} },
|
||||
}
|
||||
local SQUARE_STYLES = {
|
||||
{
|
||||
key = "square1",
|
||||
label = "方形·金",
|
||||
tex = "Interface\\AddOns\\Nanami-UI\\img\\map_f_1",
|
||||
texSize = 512,
|
||||
mapX = 9, mapY = 9, mapW = 486, mapH = 486,
|
||||
zoneOverlay = true,
|
||||
textColor = {0.85, 0.75, 0.55},
|
||||
},
|
||||
{
|
||||
key = "square2",
|
||||
label = "方形·暗",
|
||||
tex = "Interface\\AddOns\\Nanami-UI\\img\\map_f_2",
|
||||
texSize = 512,
|
||||
mapX = 52, mapY = 61, mapW = 418, mapH = 418,
|
||||
zonePlateX = 104, zonePlateY = 18, zonePlateW = 302, zonePlateH = 45,
|
||||
textColor = {0.8, 0.8, 0.8},
|
||||
},
|
||||
}
|
||||
local SQUARE_MASK = "Interface\\BUTTONS\\WHITE8X8"
|
||||
|
||||
local TEX_SIZE = 512
|
||||
local CIRCLE_CX = 256
|
||||
local CIRCLE_CY = 256
|
||||
@@ -47,6 +69,7 @@ local DEFAULTS = {
|
||||
showClock = true,
|
||||
showCoords = true,
|
||||
mapStyle = "auto",
|
||||
mapShape = "square1",
|
||||
posX = -5,
|
||||
posY = -5,
|
||||
mailIconX = nil,
|
||||
@@ -54,7 +77,7 @@ local DEFAULTS = {
|
||||
}
|
||||
|
||||
local container, overlayFrame, overlayTex
|
||||
local zoneFs, clockFs, clockBg, coordFs
|
||||
local zoneFs, clockFs, clockBg, coordFs, zoneBg
|
||||
local built = false
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -93,6 +116,19 @@ local function GetMapTexture()
|
||||
return GetCurrentStyle().tex
|
||||
end
|
||||
|
||||
local function IsSquareShape()
|
||||
local shape = GetDB().mapShape or "square1"
|
||||
return shape == "square1" or shape == "square2"
|
||||
end
|
||||
|
||||
local function GetSquareStyle()
|
||||
local shape = GetDB().mapShape or "square1"
|
||||
for _, s in ipairs(SQUARE_STYLES) do
|
||||
if s.key == shape then return s end
|
||||
end
|
||||
return SQUARE_STYLES[1]
|
||||
end
|
||||
|
||||
local function S(texPx, frameSize)
|
||||
return texPx / TEX_SIZE * frameSize
|
||||
end
|
||||
@@ -103,11 +139,17 @@ end
|
||||
|
||||
local function ApplyPosition()
|
||||
if not container then return end
|
||||
local db = GetDB()
|
||||
local x = tonumber(db.posX) or -5
|
||||
local y = tonumber(db.posY) or -5
|
||||
container:ClearAllPoints()
|
||||
container:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", x, y)
|
||||
local pos = SFramesDB and SFramesDB.Positions and SFramesDB.Positions["Minimap"]
|
||||
if pos and pos.point and pos.relativePoint then
|
||||
container:ClearAllPoints()
|
||||
container:SetPoint(pos.point, UIParent, pos.relativePoint, pos.xOfs or 0, pos.yOfs or 0)
|
||||
else
|
||||
local db = GetDB()
|
||||
local x = tonumber(db.posX) or -5
|
||||
local y = tonumber(db.posY) or -5
|
||||
container:ClearAllPoints()
|
||||
container:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", x, y)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -178,7 +220,7 @@ local function BuildFrame()
|
||||
built = true
|
||||
|
||||
local fs = FrameSize()
|
||||
local mapDiam = math.floor(S((CIRCLE_R + 8) * 2, fs))
|
||||
local isSquare = IsSquareShape()
|
||||
|
||||
-- Main container
|
||||
container = CreateFrame("Frame", "SFramesMinimapContainer", UIParent)
|
||||
@@ -192,19 +234,35 @@ local function BuildFrame()
|
||||
-- Reparent the actual minimap into our container
|
||||
Minimap:SetParent(container)
|
||||
Minimap:ClearAllPoints()
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT",
|
||||
S(CIRCLE_CX, fs), -S(CIRCLE_CY, fs))
|
||||
Minimap:SetWidth(mapDiam)
|
||||
Minimap:SetHeight(mapDiam)
|
||||
if isSquare then
|
||||
local sq = GetSquareStyle()
|
||||
local mapW = sq.mapW / sq.texSize * fs
|
||||
local mapH = sq.mapH / sq.texSize * fs
|
||||
local cx = (sq.mapX + sq.mapW / 2) / sq.texSize * fs
|
||||
local cy = (sq.mapY + sq.mapH / 2) / sq.texSize * fs
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT", cx, -cy)
|
||||
Minimap:SetWidth(mapW)
|
||||
Minimap:SetHeight(mapH)
|
||||
else
|
||||
local mapDiam = math.floor(S((CIRCLE_R + 8) * 2, fs))
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT",
|
||||
S(CIRCLE_CX, fs), -S(CIRCLE_CY, fs))
|
||||
Minimap:SetWidth(mapDiam)
|
||||
Minimap:SetHeight(mapDiam)
|
||||
end
|
||||
Minimap:SetFrameStrata("LOW")
|
||||
Minimap:SetFrameLevel(2)
|
||||
Minimap:Show()
|
||||
|
||||
if Minimap.SetMaskTexture then
|
||||
Minimap:SetMaskTexture("Textures\\MinimapMask")
|
||||
if isSquare then
|
||||
Minimap:SetMaskTexture(SQUARE_MASK)
|
||||
else
|
||||
Minimap:SetMaskTexture("Textures\\MinimapMask")
|
||||
end
|
||||
end
|
||||
|
||||
-- Decorative overlay (map.tga with transparent circle)
|
||||
-- Decorative overlay (frame texture)
|
||||
overlayFrame = CreateFrame("Frame", nil, container)
|
||||
overlayFrame:SetAllPoints(container)
|
||||
overlayFrame:SetFrameStrata("LOW")
|
||||
@@ -212,22 +270,58 @@ local function BuildFrame()
|
||||
overlayFrame:EnableMouse(false)
|
||||
|
||||
overlayTex = overlayFrame:CreateTexture(nil, "ARTWORK")
|
||||
overlayTex:SetTexture(GetMapTexture())
|
||||
if isSquare then
|
||||
overlayTex:SetTexture(GetSquareStyle().tex)
|
||||
else
|
||||
overlayTex:SetTexture(GetMapTexture())
|
||||
end
|
||||
overlayTex:SetAllPoints(overlayFrame)
|
||||
|
||||
-- Zone name on the scroll plate (horizontally centered on frame)
|
||||
local style = GetCurrentStyle()
|
||||
local pcy = S(PLATE_Y + PLATE_H / 2 + (style.plateY or -6), fs)
|
||||
-- Zone name background (semi-transparent strip for square styles)
|
||||
zoneBg = CreateFrame("Frame", nil, overlayFrame)
|
||||
zoneBg:SetFrameLevel(overlayFrame:GetFrameLevel() - 1)
|
||||
zoneBg:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
})
|
||||
zoneBg:SetBackdropColor(0, 0, 0, 0.5)
|
||||
zoneBg:Hide()
|
||||
|
||||
-- Zone name
|
||||
zoneFs = overlayFrame:CreateFontString(nil, "OVERLAY")
|
||||
zoneFs:SetFont(SFrames:GetFont(), 11, "")
|
||||
zoneFs:SetPoint("CENTER", container, "TOP", 0, -pcy)
|
||||
zoneFs:SetWidth(S(PLATE_W + 60, fs))
|
||||
zoneFs:SetHeight(S(PLATE_H, fs))
|
||||
zoneFs:SetJustifyH("CENTER")
|
||||
zoneFs:SetJustifyV("MIDDLE")
|
||||
local tc = style.textColor or {0.22, 0.13, 0.07}
|
||||
zoneFs:SetTextColor(tc[1], tc[2], tc[3])
|
||||
|
||||
if isSquare then
|
||||
local sq = GetSquareStyle()
|
||||
zoneFs:SetFont(SFrames:GetFont(), 11, "OUTLINE")
|
||||
if sq.zonePlateX then
|
||||
local px = (sq.zonePlateX + sq.zonePlateW / 2) / sq.texSize * fs
|
||||
local py = (sq.zonePlateY + sq.zonePlateH / 2) / sq.texSize * fs
|
||||
zoneFs:SetPoint("CENTER", container, "TOPLEFT", px, -py)
|
||||
zoneFs:SetWidth(sq.zonePlateW / sq.texSize * fs)
|
||||
zoneFs:SetHeight(sq.zonePlateH / sq.texSize * fs)
|
||||
else
|
||||
zoneFs:SetPoint("TOP", Minimap, "TOP", 0, -3)
|
||||
zoneFs:SetWidth(Minimap:GetWidth() * 0.7)
|
||||
zoneFs:SetHeight(18)
|
||||
zoneBg:ClearAllPoints()
|
||||
zoneBg:SetPoint("TOP", Minimap, "TOP", 0, 0)
|
||||
zoneBg:SetWidth(Minimap:GetWidth())
|
||||
zoneBg:SetHeight(20)
|
||||
zoneBg:Show()
|
||||
end
|
||||
local tc = sq.textColor or {1, 1, 1}
|
||||
zoneFs:SetTextColor(tc[1], tc[2], tc[3])
|
||||
else
|
||||
local style = GetCurrentStyle()
|
||||
zoneFs:SetFont(SFrames:GetFont(), 11, "")
|
||||
local pcy = S(PLATE_Y + PLATE_H / 2 + (style.plateY or -6), fs)
|
||||
zoneFs:SetPoint("CENTER", container, "TOP", 0, -pcy)
|
||||
zoneFs:SetWidth(S(PLATE_W + 60, fs))
|
||||
zoneFs:SetHeight(S(PLATE_H, fs))
|
||||
local tc = style.textColor or {0.22, 0.13, 0.07}
|
||||
zoneFs:SetTextColor(tc[1], tc[2], tc[3])
|
||||
end
|
||||
|
||||
-- Clock background (semi-transparent rounded)
|
||||
clockBg = CreateFrame("Frame", nil, overlayFrame)
|
||||
@@ -244,8 +338,12 @@ local function BuildFrame()
|
||||
clockBg:SetBackdropBorderColor(_clkBd[1], _clkBd[2], _clkBd[3], _clkBd[4])
|
||||
clockBg:SetWidth(46)
|
||||
clockBg:SetHeight(18)
|
||||
clockBg:SetPoint("CENTER", container, "BOTTOM", 0,
|
||||
S((TEX_SIZE - CIRCLE_CY - CIRCLE_R) / 2, fs))
|
||||
if isSquare then
|
||||
clockBg:SetPoint("TOP", Minimap, "BOTTOM", 0, -2)
|
||||
else
|
||||
clockBg:SetPoint("CENTER", container, "BOTTOM", 0,
|
||||
S((TEX_SIZE - CIRCLE_CY - CIRCLE_R) / 2, fs))
|
||||
end
|
||||
|
||||
-- Clock text
|
||||
clockFs = clockBg:CreateFontString(nil, "OVERLAY")
|
||||
@@ -255,7 +353,7 @@ local function BuildFrame()
|
||||
local _clkTxt = _A.clockText or { 0.92, 0.84, 0.72 }
|
||||
clockFs:SetTextColor(_clkTxt[1], _clkTxt[2], _clkTxt[3])
|
||||
|
||||
-- Coordinates (inside circle, near bottom)
|
||||
-- Coordinates (inside map area, near bottom)
|
||||
coordFs = overlayFrame:CreateFontString(nil, "OVERLAY")
|
||||
coordFs:SetFont(SFrames:GetFont(), 9, "OUTLINE")
|
||||
coordFs:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 8)
|
||||
@@ -430,47 +528,114 @@ function MM:Refresh()
|
||||
if not container then return end
|
||||
|
||||
local fs = FrameSize()
|
||||
local mapDiam = math.floor(S((CIRCLE_R + 8) * 2, fs))
|
||||
local isSquare = IsSquareShape()
|
||||
|
||||
container:SetWidth(fs)
|
||||
container:SetHeight(fs)
|
||||
|
||||
Minimap:ClearAllPoints()
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT",
|
||||
S(CIRCLE_CX, fs), -S(CIRCLE_CY, fs))
|
||||
Minimap:SetWidth(mapDiam)
|
||||
Minimap:SetHeight(mapDiam)
|
||||
|
||||
if zoneFs then
|
||||
local style = GetCurrentStyle()
|
||||
local pcy = S(PLATE_Y + PLATE_H / 2 + (style.plateY or -6), fs)
|
||||
zoneFs:ClearAllPoints()
|
||||
zoneFs:SetPoint("CENTER", container, "TOP", 0, -pcy)
|
||||
zoneFs:SetWidth(S(PLATE_W + 60, fs))
|
||||
local tc = style.textColor or {0.22, 0.13, 0.07}
|
||||
zoneFs:SetTextColor(tc[1], tc[2], tc[3])
|
||||
-- Apply mask
|
||||
if Minimap.SetMaskTexture then
|
||||
if isSquare then
|
||||
Minimap:SetMaskTexture(SQUARE_MASK)
|
||||
else
|
||||
Minimap:SetMaskTexture("Textures\\MinimapMask")
|
||||
end
|
||||
end
|
||||
|
||||
-- Position and size minimap
|
||||
Minimap:ClearAllPoints()
|
||||
if isSquare then
|
||||
local sq = GetSquareStyle()
|
||||
local mapW = sq.mapW / sq.texSize * fs
|
||||
local mapH = sq.mapH / sq.texSize * fs
|
||||
local cx = (sq.mapX + sq.mapW / 2) / sq.texSize * fs
|
||||
local cy = (sq.mapY + sq.mapH / 2) / sq.texSize * fs
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT", cx, -cy)
|
||||
Minimap:SetWidth(mapW)
|
||||
Minimap:SetHeight(mapH)
|
||||
else
|
||||
local mapDiam = math.floor(S((CIRCLE_R + 8) * 2, fs))
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT",
|
||||
S(CIRCLE_CX, fs), -S(CIRCLE_CY, fs))
|
||||
Minimap:SetWidth(mapDiam)
|
||||
Minimap:SetHeight(mapDiam)
|
||||
end
|
||||
|
||||
-- Update overlay texture
|
||||
if overlayTex then
|
||||
if isSquare then
|
||||
overlayTex:SetTexture(GetSquareStyle().tex)
|
||||
else
|
||||
overlayTex:SetTexture(GetMapTexture())
|
||||
end
|
||||
end
|
||||
|
||||
-- Update zone text
|
||||
if zoneFs then
|
||||
zoneFs:ClearAllPoints()
|
||||
if isSquare then
|
||||
local sq = GetSquareStyle()
|
||||
zoneFs:SetFont(SFrames:GetFont(), 11, "OUTLINE")
|
||||
if sq.zonePlateX then
|
||||
local px = (sq.zonePlateX + sq.zonePlateW / 2) / sq.texSize * fs
|
||||
local py = (sq.zonePlateY + sq.zonePlateH / 2) / sq.texSize * fs
|
||||
zoneFs:SetPoint("CENTER", container, "TOPLEFT", px, -py)
|
||||
zoneFs:SetWidth(sq.zonePlateW / sq.texSize * fs)
|
||||
zoneFs:SetHeight(sq.zonePlateH / sq.texSize * fs)
|
||||
else
|
||||
zoneFs:SetPoint("TOP", Minimap, "TOP", 0, -3)
|
||||
zoneFs:SetWidth(Minimap:GetWidth() * 0.7)
|
||||
zoneFs:SetHeight(18)
|
||||
end
|
||||
local tc = sq.textColor or {1, 1, 1}
|
||||
zoneFs:SetTextColor(tc[1], tc[2], tc[3])
|
||||
else
|
||||
zoneFs:SetFont(SFrames:GetFont(), 11, "")
|
||||
local style = GetCurrentStyle()
|
||||
local pcy = S(PLATE_Y + PLATE_H / 2 + (style.plateY or -6), fs)
|
||||
zoneFs:SetPoint("CENTER", container, "TOP", 0, -pcy)
|
||||
zoneFs:SetWidth(S(PLATE_W + 60, fs))
|
||||
local tc = style.textColor or {0.22, 0.13, 0.07}
|
||||
zoneFs:SetTextColor(tc[1], tc[2], tc[3])
|
||||
end
|
||||
end
|
||||
|
||||
-- Zone background (semi-transparent strip, only for square styles with zoneOverlay)
|
||||
if zoneBg then
|
||||
if isSquare and GetSquareStyle().zoneOverlay then
|
||||
zoneBg:ClearAllPoints()
|
||||
zoneBg:SetPoint("TOP", Minimap, "TOP", 0, 0)
|
||||
zoneBg:SetWidth(Minimap:GetWidth())
|
||||
zoneBg:SetHeight(20)
|
||||
zoneBg:Show()
|
||||
else
|
||||
zoneBg:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
-- Clock
|
||||
if clockBg then
|
||||
clockBg:ClearAllPoints()
|
||||
clockBg:SetPoint("CENTER", container, "BOTTOM", 0,
|
||||
S((TEX_SIZE - CIRCLE_CY - CIRCLE_R) / 2, fs))
|
||||
if isSquare then
|
||||
clockBg:SetPoint("TOP", Minimap, "BOTTOM", 0, -2)
|
||||
else
|
||||
clockBg:SetPoint("CENTER", container, "BOTTOM", 0,
|
||||
S((TEX_SIZE - CIRCLE_CY - CIRCLE_R) / 2, fs))
|
||||
end
|
||||
end
|
||||
|
||||
-- Coords
|
||||
if coordFs then
|
||||
coordFs:ClearAllPoints()
|
||||
coordFs:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 8)
|
||||
end
|
||||
|
||||
if overlayTex then
|
||||
overlayTex:SetTexture(GetMapTexture())
|
||||
end
|
||||
|
||||
UpdateZoneText()
|
||||
RepositionIcons()
|
||||
end
|
||||
|
||||
MM.MAP_STYLES = MAP_STYLES
|
||||
MM.SQUARE_STYLES = SQUARE_STYLES
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Shield: re-apply our skin after other addons (ShaguTweaks etc.) touch Minimap
|
||||
@@ -481,24 +646,40 @@ local function ShieldMinimap()
|
||||
if shielded then return end
|
||||
shielded = true
|
||||
|
||||
-- Override any external changes to Minimap parent / position / size
|
||||
if Minimap:GetParent() ~= container then
|
||||
Minimap:SetParent(container)
|
||||
end
|
||||
|
||||
local fs = FrameSize()
|
||||
local mapDiam = math.floor(S((CIRCLE_R + 8) * 2, fs))
|
||||
local isSquare = IsSquareShape()
|
||||
|
||||
Minimap:ClearAllPoints()
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT",
|
||||
S(CIRCLE_CX, fs), -S(CIRCLE_CY, fs))
|
||||
Minimap:SetWidth(mapDiam)
|
||||
Minimap:SetHeight(mapDiam)
|
||||
if isSquare then
|
||||
local sq = GetSquareStyle()
|
||||
local mapW = sq.mapW / sq.texSize * fs
|
||||
local mapH = sq.mapH / sq.texSize * fs
|
||||
local cx = (sq.mapX + sq.mapW / 2) / sq.texSize * fs
|
||||
local cy = (sq.mapY + sq.mapH / 2) / sq.texSize * fs
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT", cx, -cy)
|
||||
Minimap:SetWidth(mapW)
|
||||
Minimap:SetHeight(mapH)
|
||||
else
|
||||
local mapDiam = math.floor(S((CIRCLE_R + 8) * 2, fs))
|
||||
Minimap:SetPoint("CENTER", container, "TOPLEFT",
|
||||
S(CIRCLE_CX, fs), -S(CIRCLE_CY, fs))
|
||||
Minimap:SetWidth(mapDiam)
|
||||
Minimap:SetHeight(mapDiam)
|
||||
end
|
||||
Minimap:SetFrameStrata("LOW")
|
||||
Minimap:SetFrameLevel(2)
|
||||
Minimap:Show()
|
||||
|
||||
if Minimap.SetMaskTexture then
|
||||
Minimap:SetMaskTexture("Textures\\MinimapMask")
|
||||
if isSquare then
|
||||
Minimap:SetMaskTexture(SQUARE_MASK)
|
||||
else
|
||||
Minimap:SetMaskTexture("Textures\\MinimapMask")
|
||||
end
|
||||
end
|
||||
|
||||
HideDefaultElements()
|
||||
@@ -587,4 +768,12 @@ function MM:Initialize()
|
||||
if not ok then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444Nanami-UI Minimap error: " .. tostring(err) .. "|r")
|
||||
end
|
||||
|
||||
if SFrames.Movers and SFrames.Movers.RegisterMover and container then
|
||||
SFrames.Movers:RegisterMover("Minimap", container, "小地图",
|
||||
"TOPRIGHT", "UIParent", "TOPRIGHT", db.posX or -5, db.posY or -5,
|
||||
function()
|
||||
pcall(RepositionIcons)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user