Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yanivkalfa committed Mar 1, 2017
0 parents commit 37d157e
Show file tree
Hide file tree
Showing 77 changed files with 3,914 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
95 changes: 95 additions & 0 deletions Actions/EventActions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
LFG.Actions.Event = {};
local tableUtils = LFG.Utils.Table;
local eventUtils = LFG.Utils.Events;

function LFG.Actions.Event.search()
if(LFG.EventScrollFrames.searchBouncer) then
Timer.clearTimer(LFG.EventScrollFrames.searchBouncer);
end

local text = strlower(LFGEventsViewSearch:GetText());
if(strlen(text) <= 0) then
LFG.Actions.Event.clearSearch();
return false;
end

DEFAULT_CHAT_FRAME:AddMessage("text: "..text);

LFG.EventScrollFrames.searchBouncer = Timer.setTimeout(1, function()
DEFAULT_CHAT_FRAME:AddMessage("executing searchBouncer: ");
if ( type(LFG.EventScrollFrames.eventListBackup) == "table" ) then
LFG.EventScrollFrames.eventList = LFG.EventScrollFrames.eventListBackup;
end
LFG.EventScrollFrames.eventListBackup = LFG.EventScrollFrames.eventList;
LFG.EventScrollFrames.eventList = table.filter(LFG.EventScrollFrames.eventList, function(index, value)
DEFAULT_CHAT_FRAME:AddMessage("in filter: "..index);
local title = strlower(value.TT);
local description = strlower(value.DC);
local queueTo = strlower(LFG.Constants.EVENT_LIST[value.QT].name);

local inTitle = string.find(title, text) or title == text;
local inDescription = string.find(description, text) or description == text;
local inQueueTo = string.find(queueTo, text) or queueTo == text;
local InLevel = string.find(value.ML, text) or value.ML == text;

DEFAULT_CHAT_FRAME:AddMessage("inTitle, inDescription, inQueueTo, InLevel: "..tostring(inTitle)..", "..tostring(inDescription)..", "..tostring(inQueueTo)..", "..tostring(InLevel));
if(not inTitle and not inDescription and not inQueueTo and not InLevel ) then
return true;
end
return false;
end)
LFG.EventScrollFrames.updateLFGEvent();
end)
DEFAULT_CHAT_FRAME:AddMessage("LFG.EventScrollFrames.searchBouncer: "..LFG.EventScrollFrames.searchBouncer);
end

function LFG.Actions.Event.clearSearch()
if ( type(LFG.EventScrollFrames.eventListBackup) == "table" ) then
LFG.EventScrollFrames.eventList = LFG.EventScrollFrames.eventListBackup;
LFG.EventScrollFrames.eventListBackup = nil;
LFG.EventScrollFrames.updateLFGEvent();
LFGEventsViewSearch:SetText("");
end
end

function LFG.Actions.Event.fetch()
LFG.Outgoing:send(LFG.Constants.EVENTS.ERQ, nil, {});
end

function LFG.Actions.Event.show(request)
end

function LFG.Actions.Event.create()
local event = LFG.Utils.Event.createEvent();
LFG.Outgoing:send(LFG.Constants.EVENTS.ECRS, nil, event);
LFG.QueueScrollFrames.queueList = {};
LFG.QueueScrollFrames.updateLFGQueue();
LFG_Settings.event = event;
LFG.Tabs.select("events.viewQueues");
DEFAULT_CHAT_FRAME:AddMessage("Create");
end

function LFG.Actions.Event.update(request)
local event = LFG.Utils.Event.createEvent();
DEFAULT_CHAT_FRAME:AddMessage("event.I: ".. tostring(event.I));
LFG.Outgoing:send(LFG.Constants.EVENTS.EURS, nil, event);
LFG_Settings.event = event;
LFG.Tabs.select("events.viewQueues");
end

function LFG.Actions.Event.delete(request)
LFG.Outgoing:send(LFG.Constants.EVENTS.EDRQ, nil, {});
LFG.QueueScrollFrames.queueList = {};
LFG.QueueScrollFrames.updateLFGQueue();
LFG_Settings.event = nil;
LFG.Tabs.select("events.view");
end

function LFG.Actions.Event.eventQueueIndex(request)
end

function LFG.Actions.Event.eventQueueCreate(request)
end

function LFG.Actions.Event.eventQueueDelete(request)
end
33 changes: 33 additions & 0 deletions Actions/QueueActions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
LFG.Actions.Queue = {};
local tableUtils = LFG.Utils.Table;
local eventUtils = LFG.Utils.Events;

-- add to local queue list
--

function LFG.Actions.Queue.get(request)
end

function LFG.Actions.Queue.create(request)
end

function LFG.Actions.Queue.cancel(name, index)
local event = LFG.EventScrollFrames.eventList[index];
event.QTE = nil;
-- send server cancel request
LFG.EventScrollFrames.LFGEventItemUpdateButton(name, index)
end

function LFG.Actions.Queue.acceptQueue(name, index)
local queue = LFG.QueueScrollFrames.queueList[index];
queue.INV = true;
--send server cancel request
LFG.QueueScrollFrames.LFGQueueItemUpdateButton(name, index)
end

function LFG.Actions.Queue.declineQueue(name, index)
--local queue = LFG.QueueScrollFrames.queueList[index];
--queue.INV = nil;
-- send server cancel request
--LFG.QueueScrollFrames.LFGQueueItemUpdateButton(name, index)
end
40 changes: 40 additions & 0 deletions Components/LFG_EventDropDown.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
LFG.EventDropDownMenu = {};

function LFG.EventDropDownMenu.OnClick()
--DEFAULT_CHAT_FRAME:AddMessage("UIDROPDOWNMENU_MENU_VALUE".. UIDROPDOWNMENU_MENU_VALUE);
local id = this:GetID();
local name = LFG.EventScrollFrames.eventDropDownFocus.name;
local index = LFG.EventScrollFrames.eventDropDownFocus.index;

if ( id == 1 ) then
if(this.arg1 == "signup") then
LFG.RolePicker.Show(name, index);

elseif(this.arg1 == "cancel") then
LFG.Actions.Queue.cancel(name, index);
end
end
end

function LFG.EventDropDownMenu.Initialize()
local index = LFG.EventScrollFrames.eventDropDownFocus.index;
local event = LFG.EventScrollFrames.eventList[index];

local info = {};
info.func = LFG.EventDropDownMenu.OnClick;
if(not event or not event.QTE) then
info.text = "Sign Up";
info.arg1 = "signup";
UIDropDownMenu_AddButton(info);
end

if(event and event.QTE) then
info.text = "Cancel";
info.arg1 = "cancel";
UIDropDownMenu_AddButton(info);
end
end

function LFG.EventDropDownMenu.OnLoad()
UIDropDownMenu_Initialize(this, LFG.EventDropDownMenu.Initialize, "MENU");
end
150 changes: 150 additions & 0 deletions Components/LFG_EventScrollFrames.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
LFG.EventScrollFrames = {
eventSelected = { index=0, name='' },
eventDropDownFocus = { index=0, name='' },
eventList = {},
eventListBackup = nil,
searchBouncer = nil,
fatchedInitially = nil
};

function LFG.EventScrollFrames.LFGEventQueueToEvent(name, index)

end

function LFG.EventScrollFrames.LFGEventUnQueueToEvent(name, index)

end


function LFG.EventScrollFrames.LFGEventResetSelected()
for line=1,LFG.Constants.MAX_PAGE_SIZE do
getglobal("LFGEventItem"..line):SetButtonState("NORMAL");
end
end

function LFG.EventScrollFrames.LFGEventOnClick(button)
--DEFAULT_CHAT_FRAME:AddMessage("aaaaaaa".. self.GetName());
-- if left we select the row
if ( button == "LeftButton") then
LFG.EventScrollFrames.LFGEventResetSelected()
LFG.EventScrollFrames.eventSelected = { index=this.eventIndex, name=this:GetName() };
if(not LFG.EventScrollFrames.eventList[this.eventIndex].QTE) then
this:SetButtonState("PUSHED", true);
end
else
CloseDropDownMenus()
LFG.EventScrollFrames.eventDropDownFocus = { index=this.eventIndex, name=this:GetName() };
ToggleDropDownMenu(1, nil, LFGEventDropDownMenu, "cursor")
end
end

function LFG.EventScrollFrames.LFGEventCreateToolTip(index)
local Owner = LFG.EventScrollFrames.eventList[index].OR;
local title = LFG.EventScrollFrames.eventList[index].TT or "";
local description = LFG.EventScrollFrames.eventList[index].DC or "";
local minLevel = LFG.EventScrollFrames.eventList[index].ML;
local timeStamp = LFG.EventScrollFrames.eventList[index].TS;
local queueTo = LFG.Constants.EVENT_LIST[LFG.EventScrollFrames.eventList[index].QT].name or "";
local PIE = LFG.EventScrollFrames.eventList[index].PIE or 0;
local toolTop = HIGHLIGHT_FONT_COLOR_CODE..title..FONT_COLOR_CODE_CLOSE.."\n";
toolTop = toolTop..NORMAL_FONT_COLOR_CODE..queueTo..FONT_COLOR_CODE_CLOSE.."\n";
toolTop = toolTop..GRAY_FONT_COLOR_CODE.."\""..description.."\""..FONT_COLOR_CODE_CLOSE.."\n\n";
toolTop = toolTop..NORMAL_FONT_COLOR_CODE.."Minimum Level Required: "..FONT_COLOR_CODE_CLOSE..HIGHLIGHT_FONT_COLOR_CODE..minLevel..FONT_COLOR_CODE_CLOSE.."\n\n";

toolTop = toolTop..NORMAL_FONT_COLOR_CODE.."Creator: "..FONT_COLOR_CODE_CLOSE..HIGHLIGHT_FONT_COLOR_CODE..Owner..FONT_COLOR_CODE_CLOSE.."\n";
toolTop = toolTop..NORMAL_FONT_COLOR_CODE.."Created: "..FONT_COLOR_CODE_CLOSE..HIGHLIGHT_FONT_COLOR_CODE..LFG.Utils.String.getTimeString(timeStamp)..FONT_COLOR_CODE_CLOSE.."\n\n";

toolTop = toolTop..NORMAL_FONT_COLOR_CODE.."Members: "..FONT_COLOR_CODE_CLOSE..HIGHLIGHT_FONT_COLOR_CODE..PIE..FONT_COLOR_CODE_CLOSE.."\n\n";

return toolTop
end

function LFG.EventScrollFrames.LFGEventOnEnter()
local toolTip = LFG.EventScrollFrames.LFGEventCreateToolTip(this.eventIndex);
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
GameTooltip:SetText(toolTip);
end

--[[
function LFG.EventScrollFrames.LFGEventOnLoad()
for i=1,53 do
LFG.EventScrollFrames.eventList[i] = {
I=i,
OR="Zeeclienth",
TT="Some Title_"..i,
DC="Some Description_"..i,
F="H",
ML="25",
QT="ONY",
TS=1485898756 + i*20,
PIQ={ T=1, H=1, D=3, TT=5 }
};
if(i == 13 or i==11 or i ==20) then
LFG.EventScrollFrames.eventList[i].QTE = true;
end
end
LFGEventScrollFrame:Show()
end
]]--

function LFG.EventScrollFrames.LFGEventItemUpdateButton(LFGEventItemName, index)
local LFGEventItemButton, LFGEventItemButton_Title, LFGEventItemButton_QueueTo,
LFGEventItemButton_EventMembersCount, LFGEventItemButton_PendingText,
LFGEventItemButton_PendingTexture, LFGEventItemButton_PendingCancel;

LFGEventItemButton = getglobal(LFGEventItemName);
LFGEventItemButton_Title = getglobal(LFGEventItemName.."Title");
LFGEventItemButton_QueueTo = getglobal(LFGEventItemName.."QueueTo");
LFGEventItemButton_EventMembersCount = getglobal(LFGEventItemName.."EventMembersCount");
LFGEventItemButton_PendingText = getglobal(LFGEventItemName.."PendingText");
LFGEventItemButton_PendingTexture = getglobal(LFGEventItemName.."PendingTexture");
LFGEventItemButton_PendingCancel = getglobal(LFGEventItemName.."PendingCancel");

if(LFG.EventScrollFrames.eventList[index].QTE) then
LFGEventItemButton_EventMembersCount:Hide();
LFGEventItemButton_PendingText:Show();
LFGEventItemButton_PendingTexture:Show();
LFGEventItemButton_PendingCancel:Show();
LFGEventItemButton:SetButtonState("NORMAL");
else
LFGEventItemButton_EventMembersCount:Show();
LFGEventItemButton_PendingText:Hide();
LFGEventItemButton_PendingTexture:Hide();
LFGEventItemButton_PendingCancel:Hide();
if (LFGEventItemButton.eventIndex == LFG.EventScrollFrames.eventSelected.index) then
LFGEventItemButton:SetButtonState("PUSHED", true);
else
LFGEventItemButton:SetButtonState("NORMAL");
end
end

LFGEventItemButton_Title:SetText(LFG.EventScrollFrames.eventList[index].TT);
LFGEventItemButton_QueueTo:SetText(LFG.Constants.EVENT_LIST[LFG.EventScrollFrames.eventList[index].QT].name);
LFGEventItemButton_EventMembersCount:SetText(LFG.EventScrollFrames.eventList[index].PIE);
end

function LFG.EventScrollFrames.updateLFGEvent()
-- 1 through 5 of our window to scroll , an index into our data calculated from the scroll offset
local line, index, LFGEventItemButton, LFGEventItemName, totalResults;
totalResults = table.getn(LFG.EventScrollFrames.eventList);

-- hiding tooltips to avoid incorrect data
GameTooltip:Hide();

FauxScrollFrame_Update(LFGEventScrollFrame, totalResults, LFG.Constants.MAX_PAGE_SIZE, LFG.Constants.EVENT_ITEM_HEIGHT);
for line=1,LFG.Constants.MAX_PAGE_SIZE do
index = line + FauxScrollFrame_GetOffset(LFGEventScrollFrame);
LFGEventItemName = "LFGEventItem"..line;
LFGEventItemButton = getglobal(LFGEventItemName);

if (index <= totalResults) then
LFGEventItemButton:Show();
LFGEventItemButton.eventIndex = index;
LFG.EventScrollFrames.LFGEventItemUpdateButton(LFGEventItemName, index);
else
LFGEventItemButton.eventIndex = nil;
LFGEventItemButton:Hide();
end
end
end

Loading

0 comments on commit 37d157e

Please sign in to comment.