Commit 1fb1dafb authored by Patrick Wuttke's avatar Patrick Wuttke

small relayout and invite to event option

parent 8bc22a14
......@@ -128,3 +128,12 @@ function ReGroup.CanInvitePlayer(member)
end
return true
end
function ReGroup.CanInviteToEvent(member)
if not C_Calendar.GetEventIndex() then return false end
for i = 1, C_Calendar.GetNumInvites() do
local info = C_Calendar.EventGetInvite(i)
if ReGroup.NormalizeName(info.name) == member.name then return false end
end
return true
end
......@@ -136,18 +136,29 @@
</Anchor>
</Anchors>
<Scripts>
<OnHide>
self:GetParent():StopMovingOrSizing()
</OnHide>
<OnMouseDown>
self:GetParent():StartSizing()
</OnMouseDown>
<OnMouseUp>
self:GetParent():StopMovingOrSizing()
</OnMouseUp>
<OnHide>
self:GetParent():StopMovingOrSizing()
</OnHide>
</Scripts>
<NormalTexture file="Interface\AddOns\ReGroup\images\resize"/>
</Button>
</Frames>
<Scripts>
<OnLoad>
tinsert(UISpecialFrames, self:GetName())
</OnLoad>
<OnShow>
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_OPEN)
</OnShow>
<OnHide>
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_CLOSE)
</OnHide>
</Scripts>
</Frame>
</Ui>
......@@ -72,30 +72,6 @@
</OnClick>
</Scripts>
</Button>
<Button name="ReGroupButtonRemoveMembers" inherits="OptionsButtonTemplate" text="Remove">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="ReGroupButtonAddMember" relativePoint="TOPRIGHT">
<Offset x="4" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ReGroup.StartRemoveMembers()
</OnClick>
</Scripts>
</Button>
<Button name="ReGroupButtonInviteMembers" inherits="OptionsButtonTemplate" text="Invite">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="ReGroupButtonRemoveMembers" relativePoint="TOPRIGHT">
<Offset x="12" y="0"/>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ReGroup.InviteSelectedMembers()
</OnClick>
</Scripts>
</Button>
<Button name="ReGroupButtonImportMembers" inherits="OptionsButtonTemplate" text="Import ...">
<Anchors>
<Anchor point="TOP" relativeTo="ReGroupButtonSelectAll" relativePoint="TOP"/>
......@@ -174,6 +150,9 @@
ReGroup.UpdateSortedMembers()
ReGroup.UpdateFrame()
</OnTextChanged>
<OnEscapePressed>
ReGroup_Frame:Hide()
</OnEscapePressed>
</Scripts>
<FontString inherits="ChatFontNormal" />
</EditBox>
......@@ -252,6 +231,51 @@
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</DropDownToggleButton>
<DropDownToggleButton name="ReGroup_ButtonMemberOptions" inherits="UIMenuButtonStretchTemplate" mixin="ReGroupGroupOptionsMixin">
<Size x="22" y="22"/>
<Anchors>
<Anchor point="RIGHT" relativeTo="ReGroupButtonGroupOptions" relativePoint="LEFT">
<Offset x="-100" y="0"/>
</Anchor>
<Anchor point="TOP" relativeTo="ReGroupDropDownButton" relativePoint="TOP">
<Offset x="0" y="-2"/>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK" textureSubLevel="1">
<Texture file="Interface\Buttons\SquareButtonTextures" parentKey="icon">
<Size x="12" y="12"/>
<Anchors>
<Anchor point="CENTER" x="0" y="0"/>
</Anchors>
<TexCoords left="0.45312500" right="0.64062500" top="0.20312500" bottom="0.01562500"/>
</Texture>
</Layer>
<Layer>
<FontString parentKey="Label" inherits="GameFontNormalSmall" text="Member actions">
<Anchors>
<Anchor point="RIGHT" relativeKey="$parent" relativePoint="LEFT" x="-1" y="0.5"/>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Frame parentKey="DropDown" inherits="UIDropDownMenuTemplate">
<Size x="10" y="10"/>
<Scripts>
<OnLoad>
UIDropDownMenu_Initialize(self, ReGroup.ButtonMemberOptions_Initialize, "MENU")
</OnLoad>
</Scripts>
</Frame>
</Frames>
<Scripts>
<OnLoad method="OnLoad"/>
<OnMouseDown method="OnMouseDown"/>
</Scripts>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</DropDownToggleButton>
<ScrollFrame name="ReGroupMembersScrollFrame" inherits="HybridScrollFrameTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="ReGroupDropDownButton" relativePoint="BOTTOMLEFT">
......@@ -271,9 +295,6 @@
</Frames>
<Scripts>
<OnLoad>
-- ReGroup.Init()
</OnLoad>
<OnSizeChanged>
ReGroup.Frame_OnSizeChanged()
</OnSizeChanged>
......@@ -286,6 +307,17 @@
</Scripts>
</Frame>
</Frames>
<Scripts>
<OnLoad>
tinsert(UISpecialFrames, self:GetName())
</OnLoad>
<OnShow>
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_OPEN)
</OnShow>
<OnHide>
PlaySound(SOUNDKIT.IG_CHARACTER_INFO_CLOSE)
</OnHide>
</Scripts>
</Frame>
<Frame name="ReGroup_ImportMembersFrame" hidden="true" movable="true" parent="UIParent" enableMouse="true" resizable="true" frameStrata="FULLSCREEN" inherits="ReGroup_Frame_Template">
......
......@@ -98,14 +98,6 @@ function ReGroup.UpdateFrame()
end
end
if anyoneSelected then
ReGroupButtonRemoveMembers:Enable()
ReGroupButtonInviteMembers:Enable()
else
ReGroupButtonRemoveMembers:Disable()
ReGroupButtonInviteMembers:Disable()
end
UIDropDownMenu_SetText(ReGroup_SortDropDown, ReGroup.SORT_BY_OPTIONS[ReGroupPersistent.sortBy].text)
end
......@@ -174,6 +166,7 @@ local function BuildInfo(member)
end
end
local WHITE = {r = 1.0, g = 1.0, b = 1.0, a = 1.0}
function ReGroup.UpdateMemberButton(button)
if not ReGroup.selectedGroup then return end
local index = button.index
......@@ -311,6 +304,42 @@ function ReGroupGroupOptionsMixin:OnMouseDown(button)
ToggleDropDownMenu(nil, nil, self.DropDown, self, 0, 0)
end
-----------------------------
-- member actions dropdown --
-----------------------------
function ReGroup.ButtonMemberOptions_Initialize()
local info = UIDropDownMenu_CreateInfo();
info.notCheckable = true
info.disabled = true
if ReGroup.selectedGroup then
for _, selected in pairs(ReGroup.selectedMembers) do
if selected then
info.disabled = false
break
end
end
end
info.text = "Invite"
info.func = function()
ReGroup.InviteSelectedMembers()
end
UIDropDownMenu_AddButton(info)
info.text = "Invite To Event"
info.func = function()
ReGroup.EventInviteSelectedMembers()
end
UIDropDownMenu_AddButton(info)
info.text = "Remove"
info.func = function()
ReGroup.StartRemoveMembers()
end
UIDropDownMenu_AddButton(info)
end
-------------------------------------------
-- various actions on the selected group --
-------------------------------------------
......
......@@ -13,7 +13,6 @@ end
ReGroup.DEBUG_PREFIX = "@DBG@"
ReGroup.DEBUG_CLASS_NAMES = {}
local WHITE = {r = 1.0, g = 1.0, b = 1.0, a = 1.0}
ReGroup.RACE_NAMES = {}
ReGroup.REVERSE_RACE_NAMES = {}
ReGroup.REVERSE_CLASS_NAMES = {}
......@@ -62,6 +61,7 @@ ReGroup.FLAG_RAID_ASSISTANT = "flagRaidAssistant"
ReGroup.FLAG_RAID_MAIN_TANK = "flagRaidMainTank"
ReGroup.sortedMembers = {}
ReGroup.pendingEventInvites = {}
if not ReGroupPersistent.sortBy then
ReGroupPersistent.sortBy = ReGroup.SORT_BY_ADDED
......
......@@ -73,6 +73,54 @@ function ReGroup.InviteSelectedMembers(skipSizeCheck)
ReGroup.UpdateFrame()
end
function ReGroup.EventInviteSelectedMembers()
if not ReGroup.selectedGroup then return end
if not C_Calendar.GetEventIndex() then
print("Please make sure an event is select in the calendar.")
return
end
if ReGroup.pendingEventInvites[1] then
print("Please wait until all event invites are finished.")
return
end
for _, member in ipairs(ReGroup.selectedGroup.members) do
if ReGroup.selectedMembers[member.name] then
if ReGroup.CanInviteToEvent(member) then
if ReGroup.IsDebugName(member.name) then
print("Inviting debug char to event: " .. member.name)
else
table.insert(ReGroup.pendingEventInvites, member.name)
end
end
end
end
ReGroup.totalPendingEventInvites = #ReGroup.pendingEventInvites
if ReGroup.totalPendingEventInvites > 0 then
C_Timer.After(0.1, ReGroup.ContinueInvitations)
end
-- ReGroup.NotifyMembersChanged()
-- ReGroup.UpdateFrame()
end
function ReGroup.ContinueInvitations()
if ReGroup.pendingEventInvites[1] then
if not C_Calendar.GetEventIndex() then
print("Cannot continue event invites, please leave the event frame open.")
table.wipe(ReGroup.pendingEventInvites)
return
elseif C_Calendar.CanSendInvite() then
print(("Inviting %s to event ... (%d more left)"):format(ReGroup.pendingEventInvites[1], #ReGroup.pendingEventInvites - 1))
C_Calendar.EventInvite(ReGroup.pendingEventInvites[1])
table.remove(ReGroup.pendingEventInvites, 1)
end
if ReGroup.pendingEventInvites[1] then
C_Timer.After(0.1, ReGroup.ContinueInvitations)
end
end
end
function ReGroup.StartRename()
if not ReGroup.selectedGroup then return end
StaticPopup_Show ("REGROUP_RENAME_GROUP")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment