LUACN论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
热搜: YJWOW MagicStone BoL
查看: 96|回复: 0

[寻求帮助] 求1.12版本可以用的tab键切换聊天频道

[复制链接]
发表于 2023-11-18 20:19:03 | 显示全部楼层 |阅读模式
找了许久  不知道1.12版本有没有这个功能的插件代码

目前找到这一段代码 但是不能再1.12版用 会报错

local typeCycle = {
    {
        chatType = 'SAY',
        allowFunc = function() return true end,
    },
    {
        chatType = 'PARTY',
        allowFunc = function() return GetNumSubgroupMembers() > 0 end,
    },
    {
        chatType = 'INSTANCE_CHAT',
        allowFunc = function() return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE and IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and IsInInstance() end,
    },
    {
        chatType = 'RAID',
        allowFunc = function() return GetNumGroupMembers() > 0 and IsInRaid() end,
    },
    {
        chatType = 'GUILD',
        allowFunc = function() return IsInGuild() end,
    },
}

function ChatEdit_CustomTabPressed(editBox)
    if strsub(tostring(editBox:GetText()), 1, 1) == '/' then return end

    local chatType = editBox:GetAttribute('chatType')
    if chatType == 'CHANNEL' or chatType == 'OFFICER' or chatType == 'WHISPER' then
        editBox:SetAttribute('chatType', 'SAY');
        ChatEdit_UpdateHeader(editBox);
    else
        local length = #typeCycle
        for index, tbl in pairs(typeCycle) do
            if chatType == tbl.chatType then
                local step = IsShiftKeyDown() and -1 or 1
                local curr = index + step
                while true do
                    if curr == 0 then
                        curr = length
                    elseif curr > length then
                        curr = 1
                    end
                    if typeCycle[curr].allowFunc() then
                        editBox:SetAttribute('chatType', typeCycle[curr].chatType);
                        ChatEdit_UpdateHeader(editBox);
                        break
                    end
                    curr = curr + step
                end
                break
            end
        end
    end
end
6&to=1
回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies |上传

本版积分规则

小黑屋|手机版|Archiver|LUACN论坛

GMT+8, 2024-5-5 09:00 PM , Processed in 0.042012 second(s), 13 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表