WoWInterface SVN UrbanAchiever

[/] [trunk/] [Options.lua] - Rev 55

Go to most recent revision | Compare with Previous | Blame | View Log

function UrbanAchiever:CreateOptions()
        local panel = CreateFrame("Frame")
        panel.name = "Urban Achiever"
        
        local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
        title:SetPoint("TOPLEFT", 15, -16)
        title:SetText("Urban Achiever")
        title:SetJustifyH("LEFT")
        title:SetJustifyV("TOP")
        
        local subText = panel:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
        subText:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
        subText:SetText("Replacement Achievement Frame")
        subText:SetNonSpaceWrap(true)
        subText:SetJustifyH("LEFT")
        subText:SetJustifyV("TOP")
        
        local trackerTitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        trackerTitle:SetText("Tracker")
        trackerTitle:SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -10)
        
        local reset = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
        reset:SetPoint("TOPLEFT", trackerTitle, "BOTTOMLEFT", 0, -10)
        reset:SetWidth(120)
        reset:SetHeight(24)
        reset.text = reset:GetRegions()
        reset.text:SetText("Reset Tracker")
        reset:SetScript("OnClick", function()
                UASVPC.tracker.x = UIParent:GetWidth()/2
                UASVPC.tracker.y = UIParent:GetHeight()/2
                UrbanAchiever.tracker:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", UASVPC.tracker.x, UASVPC.tracker.y)
                UrbanAchiever.tracker.header:Show()             
        end)
        
        local move = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
        move:SetPoint("TOPLEFT", reset, "TOPRIGHT", 5, 0)
        move:SetWidth(120)
        move:SetHeight(24)
        move.text = move:GetRegions()
        move.text:SetText("Move Tracker")
        move:SetScript("OnClick", function()
                UrbanAchiever.tracker.header:Show()     
        end)
        
        local scale = CreateFrame("Slider", nil, panel, "OptionsSliderTemplate")
        scale:SetPoint("TOPLEFT", reset, "BOTTOMLEFT", 3, -13)
        scale.text = select(10, scale:GetRegions())
        scale.text:SetText(format("Scale: %.2f", UASVPC.tracker.scale or 1))
        scale.low = select(11, scale:GetRegions())
        scale.low:SetText(0.5)
        scale.high = select(12, scale:GetRegions())
        scale.high:SetText(2)
        scale:SetMinMaxValues(0.5, 2)
        scale:SetValueStep(0.05)
        scale:SetValue(UASVPC.tracker.scale or 1)
        scale:SetScript("OnValueChanged", function(self)
                UASVPC.tracker.scale = self:GetValue()
                scale.text:SetText(format("Scale: %.2f", UASVPC.tracker.scale or 1))
                UrbanAchiever:ScaleTracker()
        end)
        
        local statTitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        statTitle:SetText("Options")
        statTitle:SetPoint("TOPLEFT", scale, "BOTTOMLEFT", 0, -15)
        
        local sC = CreateFrame("CheckButton", "UACB", panel, "OptionsCheckButtonTemplate")
        sC:SetPoint("TOPLEFT", statTitle, "BOTTOMLEFT", 0, -10)
        sC.text = getglobal(sC:GetName() .. "Text")
        sC.text:SetText("Display Statistic Criteria")
        sC.tooltipText = "It's ultimately useless, but can sometimes show you what you've used from a list."
        sC:SetChecked(UASVPC.statCriteria)
        sC:SetScript("OnClick", function()
                if sC:GetChecked() then
                        PlaySound("igMainMenuOptionCheckBoxOn")
                else
                        PlaySound("igMainMenuOptionCheckBoxOff")
                end
                UASVPC.statCriteria = not UASVPC.statCriteria 
                sC:SetChecked(UASVPC.statCriteria)
        end)
        
        local mC = CreateFrame("CheckButton", "UACB2", panel, "OptionsCheckButtonTemplate")
        mC:SetPoint("TOPLEFT", sC, "BOTTOMLEFT", 0, -10)
        mC.text = getglobal(mC:GetName() .. "Text")
        mC.text:SetText("Color Money")
        mC.tooltipText = "Show money as |cffffd70012|r.|cffc7c7cf34|r.|cffeda55f56|r instead of  12|TInterface\\MoneyFrame\\UI-GoldIcon:14:14:2:0|t 34|TInterface\\MoneyFrame\\UI-SilverIcon:14:14:2:0|t 56|TInterface\\MoneyFrame\\UI-CopperIcon:14:14:2:0|t"
        mC:SetChecked(UASVPC.moneyAsColor)
        mC:SetScript("OnClick", function()
                if mC:GetChecked() then
                        PlaySound("igMainMenuOptionCheckBoxOn")
                else
                        PlaySound("igMainMenuOptionCheckBoxOff")
                end
                UASVPC.moneyAsColor = not UASVPC.moneyAsColor
                mC:SetChecked(UASVPC.moneyAsColor)
        end)
        
        InterfaceOptions_AddCategory(panel)
        UrbanAchiever:AddHelpPanel()
end

function UrbanAchiever:AddHelpPanel()
        local panel = CreateFrame("Frame")
        panel.name = "Help"
        panel.parent = "Urban Achiever"
        
        local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
        title:SetPoint("TOPLEFT", 15, -16)
        title:SetText("Urban Achiever - Help")
        title:SetJustifyH("LEFT")
        title:SetJustifyV("TOP")
        
        local subText = panel:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
        subText:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
        subText:SetText("OMG I'm so confused!")
        subText:SetNonSpaceWrap(true)
        subText:SetJustifyH("LEFT")
        subText:SetJustifyV("TOP")
        
        local iconTitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        iconTitle:SetText("Icons")
        iconTitle:SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -10)
        
        local iconIcons = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        iconIcons:SetTextColor(1,1,1)
        iconIcons:SetPoint("TOPLEFT", iconTitle, "BOTTOMLEFT")
        iconIcons:SetText("|cffff0000!|r\n" ..
                "|cff00ff00T|r\n" .. 
                "+/-\n"
        )
        
        local iconBody = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        iconBody:SetJustifyH("LEFT")
        iconBody:SetWidth(370)
        iconBody:SetTextColor(1,1,1)
        iconBody:SetText("- There's a reward for completing this achievement.\n" ..
                "- This achievement is currently being tracked.\n" .. 
                "- There are more achievements associated with this one. click to show/hide them."
        )
        iconBody:SetPoint("TOPLEFT", iconIcons, "TOPRIGHT", 0, -6)
        
        local trackerTitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        trackerTitle:SetText("Tracker")
        trackerTitle:SetPoint("TOPLEFT", iconIcons, "BOTTOMLEFT", 0, -15)
        
        local trackerBody = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal")
        trackerBody:SetJustifyH("LEFT")
        trackerBody:SetWidth(390)
        trackerBody:SetTextColor(1,1,1)
        trackerBody:SetText("|cff00ff00Shift-Click|r an achievement to add/remove it from the tracker.\n" .. 
                "|cff00ff00LeftClick|r an achievement title in the tracker to open it in the achievement frame.\n" ..
                "|cff00ff00Alt-Click|r an achievement in the tracker to remove it.\n")
        trackerBody:SetPoint("TOPLEFT", trackerTitle, "BOTTOMLEFT")
        
        InterfaceOptions_AddCategory(panel)
end

Go to most recent revision | Compare with Previous | Blame