stoneharry

Untitled

May 16th, 2015
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.27 KB | None | 0 0
  1. function toggleSelectionFrame(data)
  2.     local frame = CreateFrame("Frame", "SelectionFrame", UIParent)
  3.     frame:SetWidth(400)
  4.     frame:SetHeight(400)
  5.     frame.texture = frame:CreateTexture()
  6.     frame.texture:SetAllPoints(frame)
  7.     frame.texture:SetTexture("Interface/FrameXML/selectionBLP")
  8.     frame:SetFrameLevel(3)
  9.    
  10.     local pos = -12
  11.    
  12.     local level = tonumber(data[2])
  13.     local position = 3
  14.    
  15.     for i=1,3 do
  16.         local texture = CreateFrame("Button", "SelectionSlot"..tostring(i), frame, nil)
  17.         texture:SetWidth(52)
  18.         texture:SetHeight(52)
  19.         texture:SetPoint("CENTER", frame, "CENTER", pos, -2)
  20.         texture:SetFrameLevel(4)
  21.         texture:SetScript("OnEnter", OnEnterFrame)
  22.         texture:SetScript("OnLeave", OnLeaveFrame)
  23.         texture:SetScript("OnClick", OnClickedFrame)
  24.        
  25.         local _type = tonumber(data[position])
  26.         local ID = tonumber(data[position + 1])
  27.         position = position + 2
  28.        
  29.         print(ID)
  30.        
  31.         local name, icon, description
  32.        
  33.         if _type == 1 then -- spell
  34.             name, _, icon, _, _, _ = GetSpellInfo(ID)
  35.             description = ""--GetSpellDescription(ID)
  36.         elseif _type == 2 then -- item
  37.             local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType,
  38.                 itemStackCount, itemEquipLoc, itemTexture, itemSellPrice =
  39.                 GetItemInfo(ID)
  40.             name = itemName
  41.             icon = itemTexture
  42.             description = itemLink
  43.         end
  44.        
  45.         print(name)
  46.         print(icon)
  47.         print(description)
  48.        
  49.         texture:SetBackdrop({bgFile = icon,
  50.                             edgeFile = "",
  51.                             tile = false, tileSize = 68, edgeSize = 16,
  52.                             insets = { left = 4, right = 4, top = 4, bottom = 4 }});
  53.        
  54.         pos = pos + 64
  55.     end
  56.    
  57.     frame:SetPoint("BOTTOM", UIParent, "TOP", 0, 10);
  58.     frame:Show();
  59.    
  60.     local y = -500;
  61.     local dur = 3;
  62.    
  63.     local group = frame:CreateAnimationGroup(frame:GetName() .. "ChainAnim");
  64.     group:SetLooping("BOUNCE");
  65.     group:SetScript("OnLoop", Chain_OnLoop);
  66.    
  67.     local p1 = group:CreateAnimation("Path");
  68.     p1:SetOrder(1);
  69.     p1:SetDuration(1);
  70.     p1:SetSmoothing("IN");
  71.     p1:CreateControlPoint():SetOffset(0, y-20);
  72.    
  73.     local p2 = group:CreateAnimation("Path");
  74.     p2:SetOrder(2);
  75.     p2:SetDuration(0.2);
  76.     p2:CreateControlPoint():SetOffset(0, 30);
  77.    
  78.     local p3 = group:CreateAnimation("Path");
  79.     p3:SetOrder(3);
  80.     p3:SetDuration(0.3);
  81.     p3:CreateControlPoint():SetOffset(0, -10);
  82.  
  83.     group:Play();
  84. end
Advertisement
Add Comment
Please, Sign In to add comment