zoukankan      html  css  js  c++  java
  • 聊天栏快捷按钮

      \Interface\AddOns\ShestakUI\Modules\Chat\ChatBars.lua


    样式

    local function CreateButton(f, c)
        f:Width(16)
        f:Height(16)
        f:SetTemplate()
        f:RegisterForClicks("AnyUp")
        f:SetScript("OnClick", c)
    --[[
        f.t = f:CreateTexture(nil, "ARTWORK")        -- 原样式
        f.t:SetTexture(C.media.blank)
        f.t:Point("TOPLEFT", f, "TOPLEFT", 2, -2)
        f.t:Point("BOTTOMRIGHT", f, "BOTTOMRIGHT", -2, 2)
        ]]
        
        f.t = f:CreateFontString(nil, "OVERLAY")
        f.t:SetFont(unpack(font))
        f.t:SetJustifyV("TOP")
        f.t:SetJustifyH("TOP")
        if f == sw then f.t:SetText("S") end
        if f == go then f.t:SetText("G") end
        if f == rp then f.t:SetText("P") end
        if f == yr then f.t:SetText("T") end
        if f == gt then f.t:SetText("2") end
        if f == lg then f.t:SetText("5") end
        f.t:SetPoint("LEFT",2,-1)
    end

    /roll

    -- ROLL
    local RFrame = CreateFrame("Frame", nil, UIParent) 
    RFrame:SetWidth(16) 
    RFrame:SetHeight(16) 
    RFrame:SetBackdrop({ 
                bgFile = [[Interface\Buttons\WHITE8x8]], 
                insets = {left = 1,right = 1,top = 1,bottom = 1}, 
                edgeFile = [[Interface\Buttons\WHITE8x8]], 
                edgeSize = 1, 
                })
    RFrame:SetBackdropColor(0, 0, 0, 0.6) 
    RFrame:SetBackdropBorderColor(255/255, 215/255, 0, 1) 
    RFrame:SetPoint("BOTTOM",ChatBar,"TOP",0,3)
    
    local roll = CreateFrame("Button", "rollMacro", UIParent, "SecureActionButtonTemplate")
    roll:SetAttribute("*type*", "macro")
    roll:SetAttribute("macrotext", "/roll")
    --SetOverrideBindingClick(roll, true, "5", "rollMacro", nil) -- 把该宏绑在数字键5快捷键上
    roll:SetWidth(15)
    roll:SetHeight(15)
    roll:SetPoint("RIGHT",RFrame,"RIGHT",1,-1)
    
    rollText =roll:CreateFontString("ROLLText", "OVERLAY")
    rollText:SetFont(unpack(font))
    rollText:SetJustifyV("CENTER")
    rollText:SetJustifyH("CENTER")
    --rollText:SetWidth(16)
    --rollText:SetHeight(16)
    rollText:SetText("R")
    rollText:SetPoint("CENTER")
    rollText:SetTextColor(255/255, 215/255, 0)

    点击事件

    function cbar:SW(button)
        if button == "RightButton" then      --右键
            ChatFrame_OpenChat("/w ", SELECTED_DOCK_FRAME)
        elseif button == "MiddleButton" then   -- 中键
            ChatFrame_OpenChat("/y ", SELECTED_DOCK_FRAME)
        else                      -- 否则默认左键
            ChatFrame_OpenChat("/s ", SELECTED_DOCK_FRAME)
        end
    end
  • 相关阅读:
    vba合并报表(搬一下)
    自选股票并绘制图像
    python代码--利用python进行数据分析里第十四章缺失代码
    python时间戳(1)
    python学习--列替换问题
    python学习--练习题28
    报错记录--004--panda删除添加问题
    python学习--练习题21-27
    python学习--练习题14-20
    python学习--练习题111213--分阶段判断问题、输出指定日期格式问题、统计字符问题
  • 原文地址:https://www.cnblogs.com/sakaras/p/2611400.html
Copyright © 2011-2022 走看看