X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/61f22e20f0d3f6dfc9d46d47575bb14ba6e1f987..35c82f135359357cf4046c3f3252c93a1d20219d:/OmaTMW/TirnaHelper.lua diff --git a/OmaTMW/TirnaHelper.lua b/OmaTMW/TirnaHelper.lua index dc5192f..77bffbb 100644 --- a/OmaTMW/TirnaHelper.lua +++ b/OmaTMW/TirnaHelper.lua @@ -3,6 +3,7 @@ local _; local frame = CreateFrame("Frame", "OmaTirna", UIParent); local function init() + local frames = {}; frame:UnregisterAllEvents(); frame:SetPoint("TOP", UIParent, "TOP", -300, -250); frame:SetWidth(1); @@ -11,18 +12,69 @@ local function init() for j = 0,3 do local button = CreateFrame("CheckButton", "OmaTirna"..i..j, frame); button:SetPoint("TOPLEFT", frame, "TOPLEFT", i*52, j*42); - button:SetWidth(50); - button:SetHeight(40); - button.normal = button:CreateTexture(nil, "BACKGROUND"); - button.normal:SetAllPoints(); - button.normal:SetColorTexture(0.4, 0.4, 0.4); + button:SetWidth(52); + button:SetHeight(42); + button.bg = button:CreateTexture(nil, "BACKGROUND"); + button.bg:SetAllPoints(); + button.bg:SetColorTexture(1, 1, 1); + button.bg:SetVertexColor(0.2, 0.2, 0.2, 0.3); + button.normal = button:CreateTexture(nil, "BORDER"); + button.normal:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2); + button.normal:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2); + button.normal:SetColorTexture(0.5, 0.5, 0.5); button:SetNormalTexture(button.normal); - button.check = button:CreateTexture(nil, "BACKGROUND"); - button.check:SetAllPoints(); + button.check = button:CreateTexture(nil, "BORDER"); + button.check:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2); + button.check:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2); button.check:SetColorTexture(0.9, 0.9, 0.9); button:SetCheckedTexture(button.check); + button:SetScript("OnClick", function(self) + for i = 0,2 do + local x = 0; + local check, notcheck; + for j = 0,3 do + local f = frames[i*4+j+1]; + f.bg:SetVertexColor(0.2, 0.2, 0.2, 0.3); + if f:GetChecked() then + x = x + 1; + check = f; + else + notcheck = f; + end + end + if x == 1 then + check.bg:SetVertexColor(1, 0.2, 0.1, 0.9); + elseif x == 3 then + notcheck.bg:SetVertexColor(1, 0.2, 0.1, 0.9); + end + end + end); + frames[i*4+j+1] = button; end end + local button = CreateFrame("Button", "OmaTirnaReset", frame); + button:SetPoint("TOPRIGHT", frame, "TOPLEFT", -2, 0); + button:SetWidth(52); + button:SetHeight(42); + button.normal = button:CreateTexture(nil, "BACKGROUND"); + button.normal:SetAllPoints(); + button.normal:SetColorTexture(0.4, 0.4, 0.4); + button:SetNormalTexture(button.normal); + button:SetScript("OnClick", function() + for _, f in ipairs(frames) do + f:SetChecked(false); + f.bg:SetVertexColor(0.2, 0.2, 0.2, 0.3); + end + end); + frame.leaf = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight"); + frame.leaf:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 0, 42*3); + frame.leaf:SetText("Lehti"); + frame.fill = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight"); + frame.fill:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 52, 42*3); + frame.fill:SetText("Täysi"); + frame.circle = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight"); + frame.circle:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 104, 42*3); + frame.circle:SetText("Kehä"); frame:Hide(); end