美文网首页
重新排序初始化(赋值权重)

重新排序初始化(赋值权重)

作者: 菜鸟的笔记 | 来源:发表于2019-10-16 20:40 被阅读0次

function LuaScriptName.RefreshMenuItemState()
    --重新排序初始化
local asdas = {}
    table.sort(packet.ScoreAwardList, function(subNode1, subNode2)
        local aWeigth
        local bWeight

        if subNode1.State == 1 then
            aWeigth = 3
        elseif subNode1.State == 0 then
            aWeigth = 2
        else
            aWeigth = 1
        end
        
        
        if subNode2.State == 1 then
            bWeight = 3
        elseif subNode2.State == 0 then
            bWeight = 2
        else
            bWeight = 1
        end
        if aWeigth == bWeight then
            return subNode1.Id < subNode2.Id
        else
            return aWeigth > bWeight 
        end
    end)
    _UIContainerScroll:InitContentItemL2L(packet.ScoreAwardList)
end

相关文章

网友评论

      本文标题:重新排序初始化(赋值权重)

      本文链接:https://www.haomeiwen.com/subject/fwfpmctx.html