Quantcast
WoWInterface: SVN - oUF_Industrial - Path Comparison - / Rev 37 and / Rev 38

WoWInterface SVN oUF_Industrial

Compare Revisions

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

Rev 37 → Rev 38

branches/layout_change_1/Addon.lua
5,25 → 5,28
 
local frame_name = 'oUF_Industrial_'
 
local padding = 1
local padding = 0
local spacing = 0
local margin = 1
local translucency = 1
 
local offset_x = 0
local offset_y = -350
 
local buff_margin = margin / 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 = 15
local health_height = 20
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 = 4
local power_height = 20
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}
local power_color = {0.5, 1, 0, translucency + translucency / 2}
 
local cast_color = {1, 1, 0, translucency + translucency / 2}
 
54,7 → 57,7
local unit_tapped
local update_health
local update_power
local update_name
local update_info
local create_unitframe
local create_pet_unitframe
local create_party_unitframe
125,7 → 128,7
 
function update_health (frame, event, unit, bar, min, max)
bar.value:SetText(format_value(min))
update_name(frame)
update_info(frame)
end
 
function update_power (frame, event, unit, bar, min, max)
135,19 → 138,15
bar:SetStatusBarColor(colors.r, colors.g, colors.b)
end
bar.value:SetText(format_value(min > 0 and min or ''))
update_name(frame)
update_info(frame)
end
 
function update_name (frame)
function update_info (frame)
local unit = frame.unit
if not UnitExists(unit) then return end
 
frame.Name:SetText(('%s %s%s %s'):format(
unit_level(unit),
unit_name(unit),
unit_tapped(unit),
unit_threat(unit)
))
frame.Name:SetText(('%s%s'):format(unit_name(unit), unit_tapped(unit)))
frame.Info:SetText(('%s %s'):format(unit_level(unit), unit_threat(unit)))
end
 
function create_unitframe (frame, unit)
203,7 → 202,7
power.info:SetShadowColor(0, 0, 0)
power.info:SetShadowOffset(1, -1)
 
power.value:SetPoint(MR, health.value, ML, -text_inset, 0)
power.value:SetPoint(MR, power, MR, -text_inset, 0)
power.value:SetJustifyH('RIGHT')
power.value:SetFont(text_font, 10)
power.value:SetTextColor(unpack(text_color))
217,19 → 216,19
castbar:SetStatusBarColor(unpack(cast_color))
 
-- buffs
local height = padding + health_height + spacing + power_height + padding
local height = padding + health_height + spacing / 2
local width = health_width
local number = math.floor(width / height)
buffs:SetPoint(TR, frame, TL, -padding / 2, 0)
local number = math.floor(width / height) * 2
buffs:SetPoint(BL, frame, TL, 0, buff_margin)
buffs:SetWidth(width)
buffs:SetHeight(height)
buffs.size = height
buffs.num = number
buffs.initialAnchor = TR
buffs['growth-x'] = 'LEFT'
buffs['growth-y'] = 'DOWN'
buffs.initialAnchor = BL
buffs['growth-x'] = 'RIGHT'
buffs['growth-y'] = 'UP'
 
debuffs:SetPoint(ML, frame, MR, padding / 2, 0)
debuffs:SetPoint(TL, frame, BL, 0, -buff_margin)
debuffs:SetWidth(width)
debuffs:SetHeight(height)
debuffs.size = height
282,62 → 281,92
frame.Threat = threat
end
 
function create_pet_unitframe(frame, unit)
function create_player_unitframe (frame, unit)
create_unitframe(frame, unit)
 
local happiness = frame.Health:CreateTexture()
happiness:SetPoint(MC, frame, BR)
happiness:SetWidth(16)
happiness:SetHeight(16)
frame.Buffs:ClearAllPoints()
frame.Buffs:SetPoint(TR, frame, TL, -buff_margin, 0)
frame.Buffs.initialAnchor = TR
frame.Buffs['growth-x'] = 'LEFT'
frame.Buffs['growth-y'] = 'DOWN'
end
 
frame.Happiness = happiness
function create_target_unitframe (frame, unit)
create_unitframe(frame, unit)
 
frame.Buffs:ClearAllPoints()
frame.Buffs:SetPoint(TL, frame, TR, buff_margin, 0)
frame.Buffs.initialAnchor = TL
frame.Buffs['growth-x'] = 'RIGHT'
frame.Buffs['growth-y'] = 'DOWN'
 
frame.Debuffs:ClearAllPoints()
frame.Debuffs:SetPoint(TL, frame, BL, 0, -buff_margin)
frame.Debuffs.initialAnchor = TL
frame.Debuffs['growth-x'] = 'RIGHT'
frame.Debuffs['growth-y'] = 'DOWN'
end
 
function create_party_unitframe (frame, unit)
function create_targettarget_unitframe (frame, unit)
create_unitframe(frame, unit)
 
-- out of range fading
frame.Range = true
frame.inRangeAlpha = 1
frame.outsideRangeAlpha = 0.5
frame.Power:SetHeight(0)
 
local buffs = frame.Buffs
frame:SetAttribute('initial-height', frame.Health:GetHeight() + padding)
 
local size = 16
local width = power_width
local height = size
local number = math.floor(width / size)
buffs:SetPoint(TL, frame, BL, 0, -padding / 2)
buffs:SetWidth(width)
buffs:SetHeight(height)
buffs.size = size
buffs.num = number
buffs.initialAnchor = TL
buffs['growth-x'] = 'RIGHT'
buffs['growth-y'] = 'BOTTOM'
frame.Power = nil
frame.PostUpdatePower = nil
frame.Buffs = nil
frame.Debuffs = nil
end
 
function create_pet_unitframe(frame, unit)
create_unitframe(frame, unit)
 
frame.Power:SetHeight(0)
 
frame:SetAttribute('initial-height', frame.Health:GetHeight() + padding)
 
local happiness = frame.Health:CreateTexture(nil, 'OVERLAY')
happiness:SetPoint(MC, frame, TL)
happiness:SetWidth(16)
happiness:SetHeight(16)
 
frame.Power = nil
frame.PostUpdatePower = nil
frame.Buffs = nil
frame.Debuffs = nil
frame.Happiness = happiness
end
 
function target_onupdate (frame)
-- the default ouf .+target updating is .5 seconds, I'd like it instant
frame:PLAYER_ENTERING_WORLD('OnTargetUpdate')
end
 
oUF:RegisterStyle('Industrial', create_unitframe)
oUF:RegisterStyle('Industrial-player', create_player_unitframe)
oUF:RegisterStyle('Industrial-target', create_target_unitframe)
oUF:RegisterStyle('Industrial-targettarget', create_targettarget_unitframe)
oUF:RegisterStyle('Industrial-pet', create_pet_unitframe)
 
oUF:SetActiveStyle('Industrial-pet')
local pet = oUF:Spawn('pet', frame_name..'pet')
oUF:SetActiveStyle('Industrial')
oUF:SetActiveStyle('Industrial-player')
local player = oUF:Spawn('player', frame_name..'player')
 
oUF:SetActiveStyle('Industrial-target')
local target = oUF:Spawn('target', frame_name..'target')
 
oUF:SetActiveStyle('Industrial-targettarget')
local targettarget = oUF:Spawn('targettarget', frame_name..'targettarget')
 
oUF:SetActiveStyle('Industrial-pet')
local pet = oUF:Spawn('pet', frame_name..'pet')
 
targettarget:SetScript('OnUpdate', target_onupdate)
 
pet:SetPoint(MC, UIParent, MC, 0, -305)
player:SetPoint(BC, pet, TC, 0, margin)
target:SetPoint(BC, player, TC, 0, margin)
targettarget:SetPoint(BC, target, TC, 0, margin)
player:SetPoint(MR, UIParent, MC, -offset_x - margin / 2, offset_y)
target:SetPoint(ML, UIParent, MC, offset_x + margin / 2, offset_y)
targettarget:SetPoint(BL, target, TL, 0, margin)
pet:SetPoint(BL, player, TL, 0, margin)
 
RuneFrame:Hide()