WoWInterface SVN oUF_Industrial

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 36 to Rev 37
    Reverse comparison

Rev 36 → Rev 37

branches/layout_change_1/Addon.lua
5,22 → 5,22
 
local frame_name = 'oUF_Industrial_'
 
local padding = 0
local padding = 1
local spacing = 0
local margin = 0
local margin = 1
local translucency = 1
 
local bar_width = 359 - padding * 2
local bar_width = 200 - padding * 2
local bar_texture = [[Interface\AddOns\oUF_Industrial\media\textures\statusbar]]
 
local health_width = bar_width
local health_height = 25
local health_height = 15
local health_texture = bar_texture
--local health_color = {0.25, 0.25, 0.25, translucency + translucency/2}
local health_color = {0.5, 0.5, 0.5, translucency + translucency / 2}
 
local power_width = bar_width
local power_height = 3
local power_height = 4
local power_texture = bar_texture
--local power_color = {128/255, 255/255, 0, translucency + translucency/2}
local power_color = {0.25, 0.5, 1, translucency + translucency / 2}
46,6 → 46,7
WARRIOR = 'WR',
}
 
local format_value
local show_menu
local unit_class
local unit_level
59,6 → 60,17
local create_party_unitframe
local target_onupdate
 
function format_value (v)
if type(v) == 'number' then
if v > 1000 then
return ('%.1f'):format(v / 1000)
else
return v
end
end
return ''
end
 
function show_menu (frame)
local unit = frame.unit:sub(1, -2)
local cunit = frame.unit:gsub("(.)", string.upper, 1)
78,12 → 90,14
end
 
function unit_level (unit)
local color = GetDifficultyColor(UnitLevel(unit))
return color and ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, UnitLevel(unit))
--[[local color = GetDifficultyColor(UnitLevel(unit))
return color and ('|cff%02X%02X%02X%s|r'):format(color.r*255, color.g*255, color.b*255, UnitLevel(unit))]]
return UnitLevel(unit)
end
 
function unit_name (unit)
return ('|cff%s%s|r'):format(UnitIsFriend(unit, 'player') == 1 and '00ff00' or 'ff0000', UnitName(unit))
--return ('|cff%s%s|r'):format(UnitIsFriend(unit, 'player') == 1 and '00ff00' or 'ff0000', UnitName(unit))
return UnitName(unit)
end
 
function unit_tapped (unit)
110,12 → 124,17
end
 
function update_health (frame, event, unit, bar, min, max)
bar.value:SetText(min)
bar.value:SetText(format_value(min))
update_name(frame)
end
 
function update_power (frame, event, unit, bar, min, max)
bar.value:SetText(min > 0 and min or '')
unit_class = select(2, UnitClass(unit))
colors = _G.RAID_CLASS_COLORS[unit_class]
if colors then
bar:SetStatusBarColor(colors.r, colors.g, colors.b)
end
bar.value:SetText(format_value(min > 0 and min or ''))
update_name(frame)
end
 
123,9 → 142,8
local unit = frame.unit
if not UnitExists(unit) then return end
 
frame.Name:SetText(('%s %s %s%s %s'):format(
frame.Name:SetText(('%s %s%s %s'):format(
unit_level(unit),
unit_class(unit),
unit_name(unit),
unit_tapped(unit),
unit_threat(unit)
139,9 → 157,9
local buffs = CreateFrame('Frame', nil, frame)
local debuffs = CreateFrame('Frame', nil, frame)
local rlicon = health:CreateTexture(nil, 'OVERLAY')
local ricon = health:CreateTexture()
local mlicon = health:CreateTexture()
local threat = health:CreateTexture()
local ricon = health:CreateTexture(nil, 'OVERLAY')
local mlicon = health:CreateTexture(nil, 'OVERLAY')
local threat = health:CreateTexture(nil, 'OVERLAY')
local castbar = CreateFrame('StatusBar', nil, health)
health.info = health:CreateFontString(nil, 'OVERLAY')
health.value = health:CreateFontString(nil, 'OVERLAY')
157,14 → 175,14
health:SetStatusBarTexture(health_texture)
health:SetStatusBarColor(unpack(health_color))
 
health.info:SetPoint(ML, health, ML, text_inset, 0)
health.info:SetPoint(ML, health, ML, text_inset, 1)
health.info:SetJustifyH('LEFT')
health.info:SetFont(text_font, 10)
health.info:SetTextColor(unpack(text_color))
health.info:SetShadowColor(0, 0, 0)
health.info:SetShadowOffset(1, -1)
 
health.value:SetPoint(MR, health, MR, -text_inset, 0)
health.value:SetPoint(MR, health, MR, -text_inset, 1)
health.value:SetJustifyH('RIGHT')
health.value:SetFont(text_font, 10)
health.value:SetTextColor(unpack(text_color))
178,7 → 196,7
power:SetStatusBarTexture(power_texture)
power:SetStatusBarColor(unpack(power_color))
 
power.info:SetPoint(ML, power, ML, text_inset, 0)
power.info:SetPoint(ML, power, ML, text_inset, 1)
power.info:SetJustifyH('LEFT')
power.info:SetFont(text_font, 10)
power.info:SetTextColor(unpack(text_color))
199,11 → 217,10
castbar:SetStatusBarColor(unpack(cast_color))
 
-- buffs
local size = 16
local height = health_height + spacing + power_height
local height = padding + health_height + spacing + power_height + padding
local width = health_width
local number = math.floor(width / height)
buffs:SetPoint(TR, frame, TL, -padding / 2, -padding)
buffs:SetPoint(TR, frame, TL, -padding / 2, 0)
buffs:SetWidth(width)
buffs:SetHeight(height)
buffs.size = height
212,7 → 229,7
buffs['growth-x'] = 'LEFT'
buffs['growth-y'] = 'DOWN'
 
debuffs:SetPoint(ML, frame, MR, padding / 2, -padding)
debuffs:SetPoint(ML, frame, MR, padding / 2, 0)
debuffs:SetWidth(width)
debuffs:SetHeight(height)
debuffs.size = height
244,8 → 261,8
-- frame
frame:RegisterForClicks('anyup')
frame:SetAttribute('type2', 'menu')
frame:SetAttribute('initial-width', health_width + padding * 2)
frame:SetAttribute('initial-height', health_height + power_height + padding * 2 + spacing)
frame:SetAttribute('initial-width', health:GetWidth() + padding * 2)
frame:SetAttribute('initial-height', health:GetHeight() + power:GetHeight() + padding * 2 + spacing)
 
background:SetAllPoints(frame)
background:SetTexture(0, 0, 0, translucency)
307,7 → 324,6
 
oUF:RegisterStyle('Industrial', create_unitframe)
oUF:RegisterStyle('Industrial-pet', create_pet_unitframe)
--oUF:RegisterStyle('Industrial-party', create_party_unitframe)
 
oUF:SetActiveStyle('Industrial-pet')
local pet = oUF:Spawn('pet', frame_name..'pet')
315,11 → 331,6
local player = oUF:Spawn('player', frame_name..'player')
local target = oUF:Spawn('target', frame_name..'target')
local targettarget = oUF:Spawn('targettarget', frame_name..'targettarget')
--oUF:SetActiveStyle('Industrial-party')
--local party1 = oUF:Spawn('party1', frame_name..'party1')
--local party2 = oUF:Spawn('party2', frame_name..'party2')
--local party3 = oUF:Spawn('party3', frame_name..'party3')
--local party4 = oUF:Spawn('party4', frame_name..'party4')
 
targettarget:SetScript('OnUpdate', target_onupdate)
 
328,8 → 339,5
target:SetPoint(BC, player, TC, 0, margin)
targettarget:SetPoint(BC, target, TC, 0, margin)
 
--party1:SetPoint(ML, UIParent, ML)
--party2:SetPoint(TC, party1, BC, 0, -18)
--party3:SetPoint(TC, party2, BC, 0, -18)
--party4:SetPoint(TC, party3, BC, 0, -18)
RuneFrame:Hide()