axyd

Untitled

Nov 19th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.87 KB | None | 0 0
  1. local function TogglePacksWindow()
  2.     if packsWindow == nil then
  3.         -- BIG WINDOW
  4.         local hSize = 1200
  5.         local vSize = 600
  6.        
  7.         packsWindow = CreateEmptyWindow("packsWindow", "UIParent")
  8.         packsWindow:SetExtent(hSize, vSize)
  9.         packsWindow:AddAnchor("TOPLEFT", "UIParent", 0, 0)
  10.        
  11.         -- packsWindow.colorTexture = packsWindow:CreateDrawable(thisAddonPath .. "black_carbon_fiber_texture.dds", "window","background")
  12.         -- packsWindow.colorTexture:AddAnchor("TOPLEFT", packsWindow, 0, 0)
  13.         -- packsWindow.colorTexture:AddAnchor("BOTTOMRIGHT", packsWindow, 0, 0)    
  14.  
  15.         local function OnShow()
  16.             if packsWindow.ShowProc ~= nil then
  17.                 packsWindow:ShowProc()
  18.             end
  19.        
  20.             SettingWindowSkin(packsWindow)
  21.             packsWindow:SetStartAnimation(true, true)
  22.         end
  23.         packsWindow:SetHandler("OnShow", OnShow)
  24.  
  25.         local someTitle = packsWindow:CreateChildWidget("label", "someTitle", 0, false)
  26.         someTitle:SetHeight(20)
  27.         someTitle:SetText("My BOX")
  28.         someTitle:AddAnchor("TOPLEFT", packsWindow, (hSize/2), 0)
  29.         someTitle.style:SetAlign(ALIGN_LEFT)
  30.         someTitle.style:SetColorByKey("black")
  31.         someTitle.style:SetFontSize(20)
  32.        
  33.            
  34.         --local aged_cheese_pack
  35.         local arrDescription = read_file(thisAddonPath .. "yny.csv");
  36.  
  37.         local accHeight = 40
  38.         local accWidth = 200
  39.         local fontSize = 15
  40.        
  41.         --for i, name in ipairs(arrChildrenCol) do
  42.         for col = 1, #arrDescription[1] do
  43.             --X2Chat:DispatchChatMessage(CMF_RAID, string.format("%s", arrDescription[1][col]))
  44.            
  45.             local someInfo = packsWindow:CreateChildWidget("label", "someInfo", col-1, false)
  46.             someInfo:SetHeight(accHeight)
  47.            
  48.             --pack zone is longest
  49.             if (col == 1) then
  50.                 someInfo:AddAnchor("TOPLEFT", packsWindow, accWidth, accHeight)
  51.             else           
  52.                 accWidth = accWidth + 70
  53.                 someInfo:AddAnchor("TOPLEFT", packsWindow, accWidth, accHeight)
  54.             end    
  55.                                    
  56.             someInfo:SetText(string.format("%s", arrDescription[1][col]))
  57.            
  58.             --someInfo.style:SetAlign(ALIGN_LEFT)
  59.             someInfo.style:SetColorByKey("black")
  60.             someInfo.style:SetFontSize(fontSize)
  61.            
  62.             col = col + 1
  63.         end
  64.    
  65.  
  66.  
  67. --[[
  68.         local info = X2Achievement:GetAchievementInfo(9)
  69.  
  70.         local someTitle = packsWindow:CreateChildWidget("label", "someTitle", 0, false)
  71.         someTitle:SetHeight(20)
  72.         someTitle:SetText(info.name)
  73.         someTitle:AddAnchor("TOPLEFT", packsWindow, 150, 10)
  74.         someTitle.style:SetAlign(ALIGN_LEFT)
  75.         someTitle.style:SetColorByKey("brown")
  76.  
  77.         local button = packsWindow:CreateChildWidget("button", "iconButton", 0, true)
  78.         button:AddAnchor("TOPLEFT", someTitle, 5, 20)
  79.         button:SetExtent(42, 42)
  80.         local icon = button:CreateIconDrawable("background")
  81.         icon:AddAnchor("TOPLEFT", button, 1, 1)
  82.         icon:AddAnchor("BOTTOMRIGHT", button, -1, -1)
  83.         icon:ClearAllTextures()
  84.         icon:AddTexture(info.iconPath)
  85.         button:Show(true)
  86.  
  87.         local someInfo = packsWindow:CreateChildWidget("label", "someInfo", 0, false)
  88.         someInfo:SetHeight(20)
  89.         someInfo:SetText(info.summary)
  90.         someInfo:AddAnchor("TOPLEFT", packsWindow, 20, 60)
  91.         someInfo.style:SetAlign(ALIGN_LEFT)
  92.         someInfo.style:SetColorByKey("brown")
  93.     ]]--   
  94.        
  95.         --bottom button
  96.  
  97.         local closeButton = packsWindow:CreateChildWidget("button", "closeButton", 0, true)
  98.         closeButton:SetText(X2Locale:LocalizeUiText(COMMON_TEXT, "ok"))
  99.  
  100.         local color = {}
  101.         color.normal    = UIParent:GetFontColor("btn_df")
  102.         color.highlight = UIParent:GetFontColor("btn_ov")
  103.         color.pushed    = UIParent:GetFontColor("btn_on")
  104.         color.disabled  = UIParent:GetFontColor("btn_dis")
  105.  
  106.         local buttonskin = {
  107.             drawableType = "ninePart",
  108.             path = "ui/common/default.dds",
  109.             coordsKey = "btn",
  110.             autoResize = true,
  111.             fontColor = color,
  112.             fontInset = {
  113.                 left = 11,
  114.                 right = 11,
  115.                 top = 0,
  116.                 bottom = 0,
  117.             },
  118.         }
  119.         ApplyButtonSkin(closeButton, buttonskin)
  120.         closeButton:AddAnchor("BOTTOMLEFT", packsWindow, (hSize/2), 0)
  121.         closeButton:Show(true)
  122.  
  123.         function closeButton:OnClick()
  124.             packsWindow:Show(false)
  125.         end
  126.         closeButton:SetHandler("OnClick", closeButton.OnClick)
  127.  
  128.         packsWindow:Enable(true)
  129.    
  130.         packsWindow:EnableDrag(true)
  131.  
  132.         function packsWindow:OnDragStart()
  133.             self:StartMoving()
  134.             self.moving = true
  135.         end
  136.         packsWindow:SetHandler("OnDragStart", packsWindow.OnDragStart)
  137.  
  138.         function packsWindow:OnDragStop()
  139.             self:StopMovingOrSizing()
  140.             self.moving = false
  141.         end
  142.         packsWindow:SetHandler("OnDragStop", packsWindow.OnDragStop)
  143.        
  144.     end
  145.     packsWindow:Show(not packsWindow:IsVisible())
  146. end
Add Comment
Please, Sign In to add comment