Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local map_frame = CreateFrame("Frame", "DragFrame2", UIParent)
- map_frame:SetMovable(true)
- map_frame:EnableMouse(true)
- map_frame:RegisterForDrag("LeftButton")
- map_frame:SetScript("OnDragStart", map_frame.StartMoving)
- map_frame:SetScript("OnDragStop", map_frame.StopMovingOrSizing)
- map_frame:SetPoint("CENTER", -700, 150);
- map_frame:SetWidth(300);
- map_frame:SetHeight(300);
- map_frame:SetFrameStrata("BACKGROUND")
- local map_tex = map_frame:CreateTexture("ARTWORK");
- map_tex:SetAllPoints();
- map_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
- map_tex:SetVertexColor(0, 0, 0)
- map_tex:SetAlpha(0.5);
- tile_size = 10
- player_frame = CreateFrame("Frame", nil, map_frame)
- player_frame:SetPoint("CENTER", tile_size/2, tile_size/2)
- player_frame:SetSize(tile_size/2, tile_size/2)
- player_frame:SetFrameStrata("HIGH")
- local player_tex = player_frame:CreateTexture("ARTWORK");
- player_tex:SetAllPoints();
- player_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
- player_tex:SetMask([[Interface\CharacterFrame\TempPortraitAlphaMask]])
- player_tex:SetVertexColor(1, .5, 0)
- player_tex:SetAlpha(1);
- local btn_frame = CreateFrame("Frame", "DragFrame2", UIParent)
- btn_frame:SetMovable(true)
- btn_frame:EnableMouse(true)
- btn_frame:RegisterForDrag("LeftButton")
- btn_frame:SetScript("OnDragStart", btn_frame.StartMoving)
- btn_frame:SetScript("OnDragStop", btn_frame.StopMovingOrSizing)
- btn_frame:SetPoint("CENTER", -700, -100);
- btn_frame:SetWidth(200);
- btn_frame:SetHeight(200);
- btn_frame:SetFrameStrata("BACKGROUND")
- local btn_frm_tex = btn_frame:CreateTexture("ARTWORK");
- btn_frm_tex:SetAllPoints();
- btn_frm_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
- btn_frm_tex:SetVertexColor(0, 0, 0)
- btn_frm_tex:SetAlpha(0.5);
- local our_selection = "None"
- local our_color = "None"
- local our_type = "None"
- col_chek = {
- ["Red Rune"]=true,
- ["Blue Rune"]=true,
- ["Green Rune"]=true,
- ["Yellow Rune"]=true,
- ["Purple Rune"]=true,
- ["Red Orb"]=true,
- ["Blue Orb"]=true,
- ["Green Orb"]=true,
- ["Yellow Orb"]=true,
- ["Purple Orb"]=true,
- }
- local dropDown = CreateFrame("FRAME", "WPDemoDropDown", btn_frame, "UIDropDownMenuTemplate")
- dropDown:SetPoint("CENTER", 0, -100)
- UIDropDownMenu_SetWidth(dropDown, 200)
- UIDropDownMenu_SetText(dropDown, "Seleceted: " .. our_selection)
- UIDropDownMenu_Initialize(dropDown, function(self, level, menuList)
- colors = {"Red", "Blue", "Green", "Yellow", "Purple"}
- for k,v in pairs(colors) do
- local info = UIDropDownMenu_CreateInfo()
- info.func = self.SetValue
- if(col_chek[v .. " Rune"] == true) then
- info.text, info.arg1, info.arg2, info.checked = v .. " Rune", v .. " Rune", {[0]= v, [1]="Rune"}, false
- UIDropDownMenu_AddButton(info)
- end
- if(col_chek[v .. " Orb"] == true) then
- info.text, info.arg1, info.arg2, info.checked = v .. " Orb", v .. " Orb", {[0]= v, [1]="Orb"}, false
- UIDropDownMenu_AddButton(info)
- end
- end
- local info = UIDropDownMenu_CreateInfo()
- info.func = self.SetValue
- info.text, info.arg1, info.arg2, info.checked = "TP Room??", "TP Room??", {[0]= "Cyan", [1]="TP"}, false
- UIDropDownMenu_AddButton(info)
- end)
- function dropDown:SetValue(name, dat)
- our_selection = name
- our_color = dat[0]
- our_type = dat[1]
- -- print(our_color, our_type)
- -- Update the text; if we merely wanted it to display newValue, we would not need to do this
- UIDropDownMenu_SetText(dropDown, "Seleceted: " .. our_selection)
- -- Because this is called from a sub-menu, only that menu level is closed by default.
- -- Close the entire menu with this next call
- CloseDropDownMenus()
- end
- local bg_file_u = [[Interface\ChatFrame\UI-ChatIcon-ScrollUp-Up]]
- local bg_file_d = [[Interface\ChatFrame\UI-ChatIcon-ScrollUp-Down]]
- local highlight = [[Interface\Buttons\UI-Common-MouseHilight]]
- pos_x = 0
- pos_y = 0
- function btn_script(btn_name, o_type, color)
- -- print(btn_name)
- color_vals = {
- ["Red"] = {[0]=1,[1]=0,[2]=0},
- ["Blue"] = {[0]=0,[1]=0,[2]=1},
- ["Green"] = {[0]=0,[1]=1,[2]=0},
- ["Yellow"] = {[0]=1,[1]=1,[2]=0},
- ["Purple"] = {[0]=1,[1]=0,[2]=1},
- ["Cyan"] = {[0]=0,[1]=1,[2]=1},
- ["None"] = {[0]=1,[1]=1,[2]=1}
- }
- if(btn_name == "UP") then
- pos_y = pos_y + (tile_size + 1)
- elseif(btn_name == "DOWN") then
- pos_y = pos_y - (tile_size + 1)
- elseif(btn_name == "LEFT") then
- pos_x = pos_x - (tile_size + 1)
- elseif(btn_name == "RIGHT") then
- pos_x = pos_x + (tile_size + 1)
- elseif(btn_name == "PLUS") then
- if(our_type ~= "None") then
- print("Marking Spot")
- else
- message("You need to select what type of room it is")
- end
- end
- -- wrap_check()
- player_frame:SetPoint("CENTER", pos_x, pos_y)
- local tile_frame = CreateFrame("Frame", "DragFrame2", map_frame)
- tile_frame:SetMovable(true)
- tile_frame:EnableMouse(true)
- tile_frame:SetPoint("CENTER", pos_x, pos_y);
- tile_frame:SetWidth(tile_size);
- tile_frame:SetHeight(tile_size);
- tile_frame:SetFrameStrata("MEDIUM")
- local tile_tex = tile_frame:CreateTexture("ARTWORK");
- tile_tex:SetAllPoints();
- tile_tex:SetTexture("Interface\\Buttons\\WHITE8X8");
- local tile_text=tile_frame:CreateFontString(nil,"OVERLAY","GameFontNormal");-- Our text area
- tile_text:SetPoint("CENTER");
- if(o_type == "Rune") then
- tile_text:SetFont("Fonts\\ARIALN.ttf", tile_size, "OUTLINE")
- tile_text:SetText("R")
- -- col_chek[our_color .. " ".. our_type] = false
- tile_frame:SetFrameStrata("HIGH")
- elseif(o_type == "Orb") then
- tile_text:SetFont("Fonts\\ARIALN.ttf", tile_size, "OUTLINE")
- tile_text:SetText("O")
- -- col_chek[our_color .. " ".. our_type] = false
- tile_frame:SetFrameStrata("HIGH")
- elseif(o_type == "TP") then
- tile_text:SetFont("Fonts\\ARIALN.ttf", tile_size, "OUTLINE")
- tile_text:SetText("TP")
- -- col_chek[our_color .. " ".. our_type] = false
- tile_frame:SetFrameStrata("HIGH")
- end
- c_col = color_vals[color]
- tile_tex:SetVertexColor(c_col[0], c_col[1], c_col[2])
- tile_tex:SetAlpha(1);
- our_selection = "None"
- our_type = "None"
- our_color = "None"
- -- wrap_check()
- UIDropDownMenu_SetText(dropDown, "Seleceted: " .. our_selection)
- end
- function makeButton(parent, rot, _x, _y, btn_name, bg_file_u, bg_file_d, highlight)
- local btn = CreateFrame("BUTTON",nil,parent)
- btn:SetWidth(64) -- Set these to whatever height/width is needed
- btn:SetHeight(64) -- for your Texture
- local t_u = btn:CreateTexture(nil,"ARTWORK")
- t_u:SetTexture(bg_file_u)
- t_u:SetDesaturated(1)
- t_u:SetVertexColor(1,1,1)
- t_u:SetAllPoints(btn)
- t_u:SetRotation(math.rad(rot))
- local t_d = btn:CreateTexture(nil,"BACKGROUND")
- t_d:SetTexture(bg_file_d)
- t_d:SetAllPoints(btn)
- t_d:SetRotation(math.rad(rot))
- local t_h = btn:CreateTexture(nil,"BACKGROUND")
- t_h:SetTexture(highlight)
- t_h:SetAllPoints(btn)
- t_h:SetRotation(math.rad(rot))
- btn:SetNormalTexture(t_u)
- btn:SetPushedTexture(t_d)
- btn:SetHighlightTexture(t_h)
- btn:SetPoint("CENTER", _x, _y)
- btn:Show()
- btn:SetScript("OnClick", function(self)
- btn_script(btn_name, our_type, our_color)
- end)
- return t_u
- end
- add = makeButton(btn_frame, 0, 0, 0, "PLUS", 878232, 878232, highlight)
- local up = makeButton(btn_frame, 0, 0, 64, "UP", bg_file_u, bg_file_d, highlight)
- local down = makeButton(btn_frame, 180, 0, -64, "DOWN", bg_file_u, bg_file_d, highlight)
- local left = makeButton(btn_frame, 90, -64, 0, "LEFT", bg_file_u, bg_file_d, highlight)
- local right = makeButton(btn_frame, -90, 64, 0, "RIGHT", bg_file_u, bg_file_d, highlight)
- btn_script("None", "None", "None")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement