WoWInterface SVN PetListPlus

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

Main.lua
2,6 → 2,11
 
local self = PetListPlus
 
self.selected = {
["MOUNT"] = 0,
["CRITTER"] = 0,
}
 
self:RegisterEvent("ADDON_LOADED")
 
self:SetScript("OnEvent", function(...) self:OnEvent(...) end)
34,7 → 39,7
 
self.model = CreateFrame("DressUpModel", "$parentModel", self)
self.model:SetWidth(315)
self.model:SetHeight(110)
self.model:SetHeight(100)
self.model:SetPoint("TOPLEFT", 24, -75)
 
local modelBG = self.model:CreateTexture(nil, "BACKGROUND")
72,23 → 77,39
 
function self:CreateCompanionButton(num)
local button = CreateFrame("CheckButton", "$parentButton" .. num, self, "SecureFrameTemplate")
button:EnableMouseWheel(true)
button:SetWidth(150)
button:SetHeight(32)
 
 
button.icon = button:CreateTexture("$parentIcon", "ARTWORK")
button.icon:SetWidth(32)
button.icon:SetHeight(32)
button.icon:SetTexture("Interface\\Icons\\Ability_BackStab")
button.icon:SetPoint("TOPLEFT")
 
local checkedTexture = button:CreateTexture(nil, "HIGHLIGHT")
checkedTexture:SetTexture("Interface\\Buttons\\ButtonHilight-Square")
--checkedTexture:SetTexture("Interface\\Buttons\\UI-Button-Outline")
checkedTexture:SetAllPoints(button.icon)
checkedTexture:SetBlendMode("ADD")
 
button:SetCheckedTexture(checkedTexture, "ADD")
 
button.name = button:CreateFontString("$parentName", "ARTWORK", "GameFontNormal")
button.name:SetTextColor(1,1,1)
button.name:SetJustifyH("LEFT")
button.name:SetPoint("TOPLEFT", button.icon, "TOPRIGHT", 5, -2)
button.name:SetPoint("BOTTOMRIGHT")
 
button:SetScript("OnClick", function()
self.model:SetCreature(button:GetID())
button:SetScript("OnClick", self.OnButtonClick)
--function()
--self.model:SetCreature(button:GetID())
-- self:OnButtonClick(button, arg1)
--end)
 
button:SetScript("OnMouseWheel", function(_,direction)
--Scrolls +2/-2, doesnt exceed max value
self.scrollBar:SetValue(min(self.scrollBar:GetValue() + (direction * -2), select(2, self.scrollBar:GetMinMaxValues())))
end)
 
return button
106,9 → 127,14
creatureID, creatureName, spellID, icon = GetCompanionInfo(mode, i)
if creatureID then --Not nil
self.buttons[count]:Show()
self.buttons[count]:SetID(creatureID)
self.buttons[count]:SetID(i)
self.buttons[count].icon:SetTexture(icon)
self.buttons[count].name:SetText(creatureName)
if i == self.selected[mode] then
self.buttons[count]:SetChecked(1)
else
self.buttons[count]:SetChecked(0)
end
count = count + 1
end
end
128,3 → 154,19
self.buttons[i]:Hide()
end
end
 
function self:OnButtonClick()
--this = button
--arg1 = mouseButton
self = PetListPlus
local button = this
local i = button:GetID()
local mode = PetPaperDollFrameCompanionFrame.mode
local creatureID, creatureName, spellID, icon = GetCompanionInfo(mode, i)
 
self.model:SetCreature(creatureID)
self.selected[mode] = i
 
self:UpdateButtons()
 
end