/src/ChorusUnitBackgroundTemplate.lua (ebe07983288d45481f2c7869ac4eb4295f465d28) (2167 bytes) (mode 100644) (type blob)
--[[--
@submodule chorus
]]
local UnitExists = Chorus.test.UnitExists or UnitExists
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit
local function unitBackgroundEventProcessor(unitBackground)
assert(unitBackground ~= nil)
local u = SecureButton_GetUnit(unitBackground) or 'none'
if UnitExists(u) then
unitBackground:Show()
else
unitBackground:Hide()
return
end
local textureEnemy = unitBackground.textureEnemy
assert(textureEnemy ~= nil)
local textureFriend = unitBackground.textureFriend
assert(textureFriend ~= nil)
local textureNeutral = unitBackground.textureNeutral
assert(textureNeutral ~= nil)
if UnitIsFriend('player', u) then
textureFriend:Show()
textureEnemy:Hide()
textureNeutral:Hide()
elseif UnitIsEnemy('player', u) then
textureFriend:Show()
textureEnemy:Show()
textureNeutral:Hide()
elseif UnitIsTapped(u) then
textureFriend:Show()
textureEnemy:Show()
textureNeutral:Hide()
else
textureFriend:Hide()
textureEnemy:Hide()
textureNeutral:Show()
end
end
--[[--
Frame with simple texture that is toggled with the corresponding unit.
This frame is composed with unit frames and unit buttons.
@function unitBackgroundMain
@tparam frame unitBackground this unit background
]]
local function unitBackgroundMain(unitBackground)
assert(unitBackground ~= nil)
local n = unitBackground:GetName() or ''
unitBackground.textureFriend = _G[string.format('%sTexture1', n)]
unitBackground.textureEnemy = _G[string.format('%sTexture2', n)]
unitBackground.textureNeutral = _G[string.format('%sTexture3', n)]
unitBackground:RegisterEvent('ADDON_LOADED')
unitBackground:RegisterEvent('PARTY_CONVERTED_TO_RAID')
unitBackground:RegisterEvent('PARTY_MEMBERS_CHANGED')
unitBackground:RegisterEvent('PLAYER_FOCUS_CHANGED')
unitBackground:RegisterEvent('PLAYER_LOGIN')
unitBackground:RegisterEvent('PLAYER_TARGET_CHANGED')
unitBackground:RegisterEvent('RAID_ROSTER_UPDATE')
unitBackground:RegisterEvent('ZONE_CHANGED')
unitBackground:SetScript('OnEvent', unitBackgroundEventProcessor)
end
Chorus.unitBackgroundMain = function(...)
return unitBackgroundMain(...)
end
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
35 |
5c40e6e2862d70b5c51c326a13073a4012ac05c7 |
.gitignore |
100644 |
blob |
3606 |
f73da473168d1897963fd2e32d89841ca0461ec0 |
README.adoc |
040000 |
tree |
- |
271296b4bafcaa151458a0192fd313641ca9b409 |
bin |
100644 |
blob |
228 |
c7dd24afa7d5c2375ff60a91c73623a304b808f9 |
chorus.toc |
040000 |
tree |
- |
99c99c3cbc641f8954a5be291e61681cb5e74629 |
conf |
040000 |
tree |
- |
efa7258757edf7b888ea13c215e14b497fef8a16 |
doc |
100644 |
blob |
2391 |
1b0ca1bc25f74a34476360e5a8f14e28767b204e |
makefile |
040000 |
tree |
- |
f16576d6b030728a6fd22869589b1fbc2fa5bef6 |
src |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/chorus
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/chorus
Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/chorus
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main