from retail

This commit is contained in:
NoM0Re
2025-01-23 19:40:40 +01:00
parent e1e0744ecf
commit 4ed4d4159b
15 changed files with 118 additions and 27 deletions
+59 -7
View File
@@ -11,6 +11,7 @@ local default = {
iconSource = -1,
progressSource = {-1, "" },
texture = "Blizzard",
textureSource = "LSM",
width = 200,
height = 15,
orientation = "HORIZONTAL",
@@ -45,6 +46,25 @@ Private.regionPrototype.AddAlphaToDefault(default);
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
local properties = {
textureSource = {
display = {L["Bar Texture"], L["Selection Mode"]},
setter = "SetStatusBarTextureMode",
type = "list",
values = {
LSM = L["LibSharedMedia"],
Picker = L["Texture Picker"]
}
},
textureInput = {
display = {L["Bar Texture"], L["Texture Picker"]},
setter = "SetStatusBarTextureInput",
type = "texture",
},
texture = {
display = {L["Bar Texture"], L["LibSharedMedia"]},
setter = "SetStatusBarTextureLSM",
type = "textureLSM",
},
barColor = {
display = L["Bar Color"],
setter = "Color",
@@ -896,6 +916,40 @@ local funcs = {
end
end,
SetStatusBarTextureMode = function(self, mode)
if self.textureSource == mode then
return
end
self.textureSource = mode
self:UpdateStatusBarTexture()
end,
SetStatusBarTextureInput = function(self, texture)
if self.textureInput == texture then
return
end
self.textureInput = texture
self:UpdateStatusBarTexture()
end,
SetStatusBarTextureLSM = function(self, texture)
if self.texture == texture then
return
end
self.texture = texture
self:UpdateStatusBarTexture()
end,
UpdateStatusBarTexture = function(self)
local texturePath
if self.textureSource == "Picker" then
texturePath = self.textureInput or ""
else
texturePath = SharedMedia:Fetch("statusbar", self.texture) or ""
end
self.bar:SetStatusBarTexture(texturePath)
end,
SetIconVisible = function(self, iconVisible)
if (self.iconVisible == iconVisible) then
return
@@ -1125,13 +1179,11 @@ local function modify(parent, region, data)
end
-- Update texture settings
local texturePath
if data.textureSource == "Picker" then
texturePath = data.textureInput or ""
else
texturePath = SharedMedia:Fetch("statusbar", data.texture) or "";
end
bar:SetStatusBarTexture(texturePath);
region.textureSource = data.textureSource
region.texture = data.texture
region.textureInput = data.textureInput
region:UpdateStatusBarTexture();
bar:SetBackgroundColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]);
-- Update spark settings
bar.spark:SetTexture(data.sparkTexture);
+18 -4
View File
@@ -27,6 +27,11 @@ Private.regionPrototype.AddAlphaToDefault(default);
local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20;
local properties = {
texture = {
display = L["Texture"],
setter = "SetTexture",
type = "texture",
},
color = {
display = L["Color"],
setter = "Color",
@@ -82,7 +87,6 @@ end
local function modify(parent, region, data)
Private.regionPrototype.modify(parent, region, data);
region.texture:SetTexture(data.texture);
region.texture:SetDesaturated(data.desaturate)
region:SetWidth(data.width);
region:SetHeight(data.height);
@@ -178,12 +182,22 @@ local function modify(parent, region, data)
end
function region:Update()
if region.state.texture then
region.texture:SetTexture(region.state.texture);
if self.state.texture then
self:SetTexture(self.state.texture)
end
region:UpdateProgress()
self:UpdateProgress()
end
function region:SetTexture(texture)
if self.textureName == texture then
return
end
self.textureName = texture
self.texture:SetTexture(self.textureName);
DoTexCoord()
end
region:SetTexture(data.texture)
function region:Color(r, g, b, a)
region.color_r = r;
region.color_g = g;