File src/Chorus.xml changed (mode: 100644) (index 3acb861..5b13834) |
31 |
31 |
<!-- Frames (concrete classes, interface implementations, object instances). --> |
<!-- Frames (concrete classes, interface implementations, object instances). --> |
32 |
32 |
<Include file="ChorusPartyFrame.xml"/> |
<Include file="ChorusPartyFrame.xml"/> |
33 |
33 |
<Include file="ChorusRaidFrame.xml"/> |
<Include file="ChorusRaidFrame.xml"/> |
34 |
|
<Include file="ChorusGroupFrame.xml"/> |
|
35 |
34 |
<Include file="ChorusPlayerFrame.xml"/> |
<Include file="ChorusPlayerFrame.xml"/> |
36 |
35 |
<Include file="ChorusTargetFrame.xml"/> |
<Include file="ChorusTargetFrame.xml"/> |
37 |
36 |
<Include file="ChorusFocusFrame.xml"/> |
<Include file="ChorusFocusFrame.xml"/> |
|
37 |
|
<!-- |
|
38 |
|
The load order is critically important, especially for |
|
39 |
|
`ChorusGroupFrame`. Critical runtime errors may occurr. |
|
40 |
|
--> |
|
41 |
|
<Include file="ChorusGroupFrame.xml"/> |
38 |
42 |
<Include file="ChorusFrame.xml"/> |
<Include file="ChorusFrame.xml"/> |
39 |
43 |
</Ui> |
</Ui> |
File src/ChorusGroupFrame.lua changed (mode: 100644) (index 1eec3bd..df0621a) |
1 |
|
local GetNumPartyMembers = Chorus.test.GetNumPartyMembers or GetNumPartyMembers |
|
2 |
|
local UnitInParty = Chorus.test.UnitInParty or UnitInParty |
|
3 |
|
local UnitInRaid = Chorus.test.UnitInRaid or UnitInRaid |
|
4 |
|
|
|
5 |
1 |
local Chorus = Chorus |
local Chorus = Chorus |
6 |
2 |
local ChorusPartyFrame = ChorusPartyFrame |
local ChorusPartyFrame = ChorusPartyFrame |
7 |
3 |
local ChorusRaidFrame = ChorusRaidFrame |
local ChorusRaidFrame = ChorusRaidFrame |
8 |
4 |
|
|
9 |
|
local function groupFrameEventProcessor(self) |
|
|
5 |
|
function Chorus.groupFrameMain(self) |
10 |
6 |
assert(self ~= nil) |
assert(self ~= nil) |
11 |
7 |
|
|
12 |
|
if IsActiveBattlefieldArena() then |
|
13 |
|
--[[ TODO Implement separate or additional arena unit group frame. ]]-- |
|
14 |
|
self:Show() |
|
15 |
|
ChorusPartyFrame:Show() |
|
16 |
|
ChorusRaidFrame:Hide() |
|
17 |
|
elseif UnitInRaid('player') then |
|
18 |
|
self:Show() |
|
19 |
|
ChorusPartyFrame:Hide() |
|
20 |
|
--[[ TODO Implement separate raid profiles for 10, 25 and 40 men raids. ]]-- |
|
21 |
|
ChorusRaidFrame:Show() |
|
22 |
|
elseif UnitInParty('player') and GetNumPartyMembers() >= 1 then |
|
23 |
|
self:Show() |
|
24 |
|
ChorusPartyFrame:Show() |
|
25 |
|
ChorusRaidFrame:Hide() |
|
26 |
|
else |
|
27 |
|
self:Hide() |
|
28 |
|
ChorusPartyFrame:Hide() |
|
29 |
|
ChorusRaidFrame:Hide() |
|
30 |
|
end |
|
31 |
|
end |
|
|
8 |
|
local secureHandler = ChorusGroupSecureHandler |
|
9 |
|
assert(secureHandler ~= nil) |
32 |
10 |
|
|
33 |
|
function Chorus.groupFrameMain(self) |
|
34 |
|
assert(self ~= nil) |
|
|
11 |
|
assert(ChorusPartyFrame ~= nil) |
|
12 |
|
assert(ChorusPlayerFrame ~= nil) |
|
13 |
|
assert(ChorusRaidFrame ~= nil) |
|
14 |
|
|
|
15 |
|
secureHandler:SetFrameRef('ChorusPartyFrame', ChorusPartyFrame) |
|
16 |
|
secureHandler:SetFrameRef('ChorusPlayerFrame', ChorusPlayerFrame) |
|
17 |
|
secureHandler:SetFrameRef('ChorusRaidFrame', ChorusRaidFrame) |
|
18 |
|
|
|
19 |
|
--[[ TODO Add line `[@raid11,exists] ChorusRaid25Frame;` for 25 men raid, etc. ]]-- |
|
20 |
|
--[[ TODO Replace the arena conditional with actual arena frame, when implemented. ]]-- |
|
21 |
|
RegisterStateDriver(secureHandler, 'group', [[ |
|
22 |
|
[@arena1,exists] ChorusPartyFrame; |
|
23 |
|
[@raid1,exists] ChorusRaidFrame; |
|
24 |
|
[@party1,exists] ChorusPartyFrame; |
|
25 |
|
ChorusPlayerFrame; |
|
26 |
|
]]) |
|
27 |
|
|
|
28 |
|
--[[ TODO Implement separate or additional arena unit group frame. ]]-- |
|
29 |
|
--[[ TODO Implement separate raid profiles for 10, 25 and 40 men raids. ]]-- |
|
30 |
|
secureHandler:WrapScript(secureHandler, 'OnAttributeChanged', [[ |
|
31 |
|
if name ~= 'state-group' then |
|
32 |
|
return |
|
33 |
|
end |
|
34 |
|
value = strtrim(value) |
|
35 |
|
|
|
36 |
|
local currentGroupFrame = self:GetFrameRef(value) |
|
37 |
|
|
|
38 |
|
if currentGroupFrame then |
|
39 |
|
currentGroupFrame:Show() |
|
40 |
|
end |
|
41 |
|
|
|
42 |
|
local t = newtable() |
|
43 |
|
table.insert(t, 'ChorusArenaFrame') |
|
44 |
|
table.insert(t, 'ChorusPartyFrame') |
|
45 |
|
table.insert(t, 'ChorusPlayerFrame') |
|
46 |
|
table.insert(t, 'ChorusRaidFrame') |
|
47 |
|
table.insert(t, 'ChorusRaid10Frame') |
|
48 |
|
table.insert(t, 'ChorusRaid25Frame') |
|
49 |
|
table.insert(t, 'ChorusRaid40Frame') |
|
50 |
|
|
|
51 |
|
local i = 0 |
|
52 |
|
while(i < #t) do |
|
53 |
|
i = i + 1 |
35 |
54 |
|
|
36 |
|
self:SetScript('OnEvent', groupFrameEventProcessor) |
|
37 |
|
|
|
38 |
|
self:RegisterEvent('BATTLEFIELDS_CLOSED'); |
|
39 |
|
self:RegisterEvent('BATTLEFIELDS_SHOW'); |
|
40 |
|
self:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
|
41 |
|
self:RegisterEvent('PARTY_LEADER_CHANGED'); |
|
42 |
|
self:RegisterEvent('PARTY_MEMBERS_CHANGED') |
|
43 |
|
self:RegisterEvent('PARTY_MEMBER_DISABLE') |
|
44 |
|
self:RegisterEvent('PARTY_MEMBER_ENABLE') |
|
45 |
|
self:RegisterEvent('PLAYER_ALIVE'); |
|
46 |
|
self:RegisterEvent('PLAYER_LOGIN') |
|
47 |
|
self:RegisterEvent('RAID_ROSTER_UPDATE') |
|
48 |
|
self:RegisterEvent('UPDATE_BATTLEFIELD_STATUS'); |
|
|
55 |
|
local f = self:GetFrameRef(t[i]) |
|
56 |
|
if f and f ~= currentGroupFrame then |
|
57 |
|
f:Hide() |
|
58 |
|
end |
|
59 |
|
end |
|
60 |
|
]]) |
49 |
61 |
end |
end |