Advertisement
Guest User

endlesshalls

a guest
Feb 28th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.88 KB | None | 0 0
  1. local map_frame = CreateFrame("Frame", "DragFrame2", UIParent)
  2. map_frame:SetMovable(true)
  3. map_frame:EnableMouse(true)
  4. map_frame:RegisterForDrag("LeftButton")
  5. map_frame:SetScript("OnDragStart", map_frame.StartMoving)
  6. map_frame:SetScript("OnDragStop", map_frame.StopMovingOrSizing)
  7. map_frame:SetPoint("CENTER", -700, 150);
  8. map_frame:SetWidth(300);
  9. map_frame:SetHeight(300);
  10. map_frame:SetFrameStrata("BACKGROUND")
  11. local map_tex = map_frame:CreateTexture("ARTWORK");
  12. map_tex:SetAllPoints();
  13. map_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
  14. map_tex:SetVertexColor(0, 0, 0)
  15. map_tex:SetAlpha(0.5);
  16.  
  17. tile_size = 10
  18.  
  19. player_frame = CreateFrame("Frame", nil, map_frame)
  20. player_frame:SetPoint("CENTER", tile_size/2, tile_size/2)
  21. player_frame:SetSize(tile_size/2, tile_size/2)
  22. player_frame:SetFrameStrata("HIGH")
  23.  
  24. local player_tex = player_frame:CreateTexture("ARTWORK");
  25. player_tex:SetAllPoints();
  26. player_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
  27. player_tex:SetMask([[Interface\CharacterFrame\TempPortraitAlphaMask]])
  28. player_tex:SetVertexColor(1, .5, 0)
  29. player_tex:SetAlpha(1);
  30.  
  31.  
  32.  
  33.  
  34.  
  35. local btn_frame = CreateFrame("Frame", "DragFrame2", UIParent)
  36. btn_frame:SetMovable(true)
  37. btn_frame:EnableMouse(true)
  38. btn_frame:RegisterForDrag("LeftButton")
  39. btn_frame:SetScript("OnDragStart", btn_frame.StartMoving)
  40. btn_frame:SetScript("OnDragStop", btn_frame.StopMovingOrSizing)
  41. btn_frame:SetPoint("CENTER", -700, -100);
  42. btn_frame:SetWidth(200);
  43. btn_frame:SetHeight(200);
  44. btn_frame:SetFrameStrata("BACKGROUND")
  45. local btn_frm_tex = btn_frame:CreateTexture("ARTWORK");
  46. btn_frm_tex:SetAllPoints();
  47. btn_frm_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
  48. btn_frm_tex:SetVertexColor(0, 0, 0)
  49. btn_frm_tex:SetAlpha(0.5);
  50.  
  51.  
  52. local our_selection = "None"
  53. local our_color = "None"
  54. local our_type = "None"
  55.  
  56. col_chek = {
  57.     ["Red Rune"]=true,
  58.     ["Blue Rune"]=true,
  59.     ["Green Rune"]=true,
  60.     ["Yellow Rune"]=true,
  61.     ["Purple Rune"]=true,
  62.     ["Red Orb"]=true,
  63.     ["Blue Orb"]=true,
  64.     ["Green Orb"]=true,
  65.     ["Yellow Orb"]=true,
  66.     ["Purple Orb"]=true,
  67. }
  68.  
  69. local dropDown = CreateFrame("FRAME", "WPDemoDropDown", btn_frame, "UIDropDownMenuTemplate")
  70. dropDown:SetPoint("CENTER", 0, -100)
  71. UIDropDownMenu_SetWidth(dropDown, 200)
  72. UIDropDownMenu_SetText(dropDown, "Seleceted: " .. our_selection)
  73.  
  74. UIDropDownMenu_Initialize(dropDown, function(self, level, menuList)
  75.     colors = {"Red", "Blue", "Green", "Yellow", "Purple"}
  76.     for k,v in pairs(colors) do
  77.         local info = UIDropDownMenu_CreateInfo()
  78.         info.func = self.SetValue
  79.         if(col_chek[v .. " Rune"] == true) then
  80.             info.text, info.arg1, info.arg2, info.checked = v .. " Rune", v .. " Rune", {[0]= v, [1]="Rune"}, false
  81.             UIDropDownMenu_AddButton(info)
  82.         end
  83.         if(col_chek[v .. " Orb"] == true) then
  84.             info.text, info.arg1, info.arg2, info.checked = v .. " Orb", v .. " Orb", {[0]= v, [1]="Orb"}, false
  85.             UIDropDownMenu_AddButton(info)
  86.         end
  87.     end
  88.     local info = UIDropDownMenu_CreateInfo()
  89.     info.func = self.SetValue
  90.     info.text, info.arg1, info.arg2, info.checked = "TP Room??", "TP Room??", {[0]= "Cyan", [1]="TP"}, false
  91.     UIDropDownMenu_AddButton(info)
  92.  
  93. end)
  94.  
  95. function dropDown:SetValue(name, dat)
  96.     our_selection = name
  97.     our_color = dat[0]
  98.     our_type = dat[1]
  99.     -- print(our_color, our_type)
  100.     -- Update the text; if we merely wanted it to display newValue, we would not need to do this
  101.     UIDropDownMenu_SetText(dropDown, "Seleceted: " .. our_selection)
  102.     -- Because this is called from a sub-menu, only that menu level is closed by default.
  103.     -- Close the entire menu with this next call
  104.     CloseDropDownMenus()
  105. end
  106.  
  107.  
  108. local bg_file_u = [[Interface\ChatFrame\UI-ChatIcon-ScrollUp-Up]]
  109. local bg_file_d = [[Interface\ChatFrame\UI-ChatIcon-ScrollUp-Down]]
  110. local highlight = [[Interface\Buttons\UI-Common-MouseHilight]]
  111. pos_x = 0
  112. pos_y = 0
  113.  
  114. function btn_script(btn_name, o_type, color)
  115.     -- print(btn_name)
  116.     color_vals = {
  117.         ["Red"] = {[0]=1,[1]=0,[2]=0},
  118.         ["Blue"] = {[0]=0,[1]=0,[2]=1},
  119.         ["Green"] = {[0]=0,[1]=1,[2]=0},
  120.         ["Yellow"] = {[0]=1,[1]=1,[2]=0},
  121.         ["Purple"] = {[0]=1,[1]=0,[2]=1},
  122.         ["Cyan"] = {[0]=0,[1]=1,[2]=1},
  123.         ["None"] = {[0]=1,[1]=1,[2]=1}
  124.     }
  125.     if(btn_name == "UP") then
  126.         pos_y = pos_y + (tile_size + 1)
  127.     elseif(btn_name == "DOWN") then
  128.         pos_y = pos_y - (tile_size + 1)
  129.     elseif(btn_name == "LEFT") then
  130.         pos_x = pos_x - (tile_size + 1)
  131.     elseif(btn_name == "RIGHT") then
  132.         pos_x = pos_x + (tile_size + 1)
  133.     elseif(btn_name == "PLUS") then
  134.         if(our_type ~= "None") then
  135.             print("Marking Spot")
  136.         else
  137.             message("You need to select what type of room it is")
  138.         end
  139.     end
  140.     -- wrap_check()
  141.     player_frame:SetPoint("CENTER", pos_x, pos_y)
  142.     local tile_frame = CreateFrame("Frame", "DragFrame2", map_frame)
  143.     tile_frame:SetMovable(true)
  144.     tile_frame:EnableMouse(true)
  145.     tile_frame:SetPoint("CENTER", pos_x, pos_y);
  146.     tile_frame:SetWidth(tile_size);
  147.     tile_frame:SetHeight(tile_size);
  148.     tile_frame:SetFrameStrata("MEDIUM")
  149.     local tile_tex = tile_frame:CreateTexture("ARTWORK");
  150.     tile_tex:SetAllPoints();
  151.     tile_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
  152.     local tile_text=tile_frame:CreateFontString(nil,"OVERLAY","GameFontNormal");--    Our text area
  153.     tile_text:SetPoint("CENTER");
  154.     if(o_type == "Rune") then
  155.         tile_text:SetFont("Fonts\\ARIALN.ttf", tile_size, "OUTLINE")
  156.         tile_text:SetText("R")
  157.         -- col_chek[our_color .. " ".. our_type] = false
  158.  
  159.         tile_frame:SetFrameStrata("HIGH")
  160.     elseif(o_type == "Orb") then
  161.         tile_text:SetFont("Fonts\\ARIALN.ttf", tile_size, "OUTLINE")
  162.         tile_text:SetText("O")
  163.         -- col_chek[our_color .. " ".. our_type] = false
  164.  
  165.         tile_frame:SetFrameStrata("HIGH")
  166.     elseif(o_type == "TP") then
  167.         tile_text:SetFont("Fonts\\ARIALN.ttf", tile_size, "OUTLINE")
  168.         tile_text:SetText("TP")
  169.         -- col_chek[our_color .. " ".. our_type] = false
  170.  
  171.         tile_frame:SetFrameStrata("HIGH")
  172.     end
  173.     c_col = color_vals[color]
  174.     tile_tex:SetVertexColor(c_col[0], c_col[1], c_col[2])
  175.     tile_tex:SetAlpha(1);
  176.     our_selection = "None"
  177.     our_type = "None"
  178.     our_color = "None"
  179.     -- wrap_check()
  180.     UIDropDownMenu_SetText(dropDown, "Seleceted: " .. our_selection)
  181. end
  182.  
  183.  
  184. function makeButton(parent, rot, _x, _y, btn_name, bg_file_u, bg_file_d, highlight)
  185.     local btn = CreateFrame("BUTTON",nil,parent)
  186.  
  187.     btn:SetWidth(64) -- Set these to whatever height/width is needed
  188.     btn:SetHeight(64) -- for your Texture
  189.  
  190.     local t_u = btn:CreateTexture(nil,"ARTWORK")
  191.     t_u:SetTexture(bg_file_u)
  192.     t_u:SetDesaturated(1)
  193.     t_u:SetVertexColor(1,1,1)
  194.     t_u:SetAllPoints(btn)
  195.     t_u:SetRotation(math.rad(rot))
  196.  
  197.     local t_d = btn:CreateTexture(nil,"BACKGROUND")
  198.     t_d:SetTexture(bg_file_d)
  199.     t_d:SetAllPoints(btn)
  200.     t_d:SetRotation(math.rad(rot))
  201.  
  202.     local t_h = btn:CreateTexture(nil,"BACKGROUND")
  203.     t_h:SetTexture(highlight)
  204.     t_h:SetAllPoints(btn)
  205.     t_h:SetRotation(math.rad(rot))
  206.  
  207.  
  208.     btn:SetNormalTexture(t_u)
  209.     btn:SetPushedTexture(t_d)
  210.     btn:SetHighlightTexture(t_h)
  211.  
  212.     btn:SetPoint("CENTER", _x, _y)
  213.     btn:Show()
  214.     btn:SetScript("OnClick", function(self)
  215.         btn_script(btn_name, our_type, our_color)
  216.     end)
  217.     return t_u
  218. end
  219.  
  220. add = makeButton(btn_frame, 0, 0, 0, "PLUS", 878232, 878232, highlight)
  221.  
  222. local up = makeButton(btn_frame, 0, 0, 64, "UP", bg_file_u, bg_file_d, highlight)
  223. local down = makeButton(btn_frame, 180, 0, -64, "DOWN", bg_file_u, bg_file_d, highlight)
  224. local left = makeButton(btn_frame, 90, -64, 0, "LEFT", bg_file_u, bg_file_d, highlight)
  225. local right = makeButton(btn_frame, -90, 64, 0, "RIGHT", bg_file_u, bg_file_d, highlight)
  226. btn_script("None", "None", "None")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement