diff --git a/lua_probject/base_project/Main.lua b/lua_probject/base_project/Main.lua index b9a1897f..eb3a0f81 100644 --- a/lua_probject/base_project/Main.lua +++ b/lua_probject/base_project/Main.lua @@ -379,113 +379,4 @@ function printlog(...) if debug_print then print(...) end -end - -function TableToString(t, indent, visited) - if type(t) ~= "table" then - if type(t) == "string" then - return '"' .. t:gsub('["\\]', '\\%0') .. '"' - elseif type(t) == "number" or type(t) == "boolean" then - return tostring(t) - elseif type(t) == "function" then - -- 尝试获取函数名 - local info = debug.getinfo(t, "n") - if info and info.name and info.name ~= "" then - return '""' - else - return '""' - end - else - return '"<' .. type(t) .. '>"' - end - end - - visited = visited or {} - if visited[t] then - return '""' - end - visited[t] = true - - indent = indent or "" - local nextIndent = indent .. " " - - -- 更准确的数组检测 - local isArray = true - local maxIndex = 0 - for k in pairs(t) do - if type(k) ~= "number" or k < 1 or k ~= math.floor(k) then - isArray = false - break - end - if k > maxIndex then - maxIndex = k - end - end - - -- 检查连续性 - if isArray and maxIndex > 0 then - for i = 1, maxIndex do - if t[i] == nil then - isArray = false - break - end - end - end - - local result = "" - - if isArray then - result = result .. "[" - local parts = {} - for i = 1, maxIndex do - parts[i] = TableToString(t[i], nextIndent, visited) - end - result = result .. table.concat(parts, ",") - result = result .. "]" - else - result = result .. "{\n" - local parts = {} - local count = 0 - - for k, v in pairs(t) do - count = count + 1 - local key - if type(k) == "string" and string.match(k, "^[a-zA-Z_][a-zA-Z0-9_]*$") then - key = '"' .. k .. '"' -- 即使是标识符也加双引号,保持JSON格式 - else - key = '"' .. tostring(k):gsub('["\\]', '\\%0') .. '"' - end - - local valueStr - if type(v) == "function" then - -- 对函数进行特殊处理,只显示方法名 - local info = debug.getinfo(v, "n") - if info and info.name and info.name ~= "" then - valueStr = '""' - else - valueStr = '""' - end - else - valueStr = TableToString(v, nextIndent, visited) - end - - parts[count] = nextIndent .. key .. ": " .. valueStr - end - - -- 按键名排序,使输出更一致 - table.sort(parts, function(a, b) - local keyA = a:match('^%s*"([^"]+)"') - local keyB = b:match('^%s*"([^"]+)"') - return (keyA or "") < (keyB or "") - end) - - result = result .. table.concat(parts, ",\n") - if count > 0 then - result = result .. "\n" .. indent - end - result = result .. "}" - end - - visited[t] = nil - return result -end +end \ No newline at end of file diff --git a/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua b/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua index 12e9fd9e..00cea9b2 100644 --- a/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua +++ b/lua_probject/extend_project/extend/zipai/fanpaofa/EXMainView.lua @@ -880,13 +880,12 @@ function M:_ChiView(tip_list, tip_hu, callback) for i = 1, #tip_list do if tip_list[i].weight ~= 4 then local item_choose = list_choose:AddItemFromPool() - item_choose:GetChild('card' .. 2).icon = - UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tip_list[i].OpCard[1])) - item_choose:GetChild('card' .. 3).icon = - UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tip_list[i].OpCard[2])) - item_choose:GetChild('card' .. 1).icon = - UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tip_list[i].card)) - + local tempCard = { [1] = tip_list[i].OpCard[1], [2] = tip_list[i].OpCard[2], [3] = tip_list[i].card } + table.sort(tempCard) + for index = #tempCard, 1, -1 do + local tempItem = item_choose:GetChild('card' .. index) + tempItem.icon = UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tempCard[index])) + end item_choose.onClick:Add( function() for k = 1, list_choose.numChildren do @@ -926,12 +925,12 @@ function M:CheckRatioCard(_tiplist, index, chicard, _biid, list) for i = 1, #_tiplist do local item = UIPackage.CreateObjectFromURL('ui://Main_RunBeard/Comp_choose') local item_choose = Bilist_choose:AddChild(item) - item_choose:GetChild('card' .. 2).icon = - UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', _tiplist[i].opcard[1])) - item_choose:GetChild('card' .. 3).icon = - UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', _tiplist[i].opcard[2])) - item_choose:GetChild('card' .. 1).icon = - UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', chicard)) + local tempCard = { [1] = _tiplist[i].opcard[1], [2] = _tiplist[i].opcard[2], [3] = chicard } + table.sort(tempCard) + for index = #tempCard, 1, -1 do + local tempItem = item_choose:GetChild('card' .. index) + tempItem.icon = UIPackage.GetItemURL('Main_RunBeard', self:getCardItem('201_', tempCard[index])) + end item_choose:GetController('zhong').selectedIndex = 0 item_choose.onClick:Add( function() diff --git a/wb_new_ui/.objs/workspace.json b/wb_new_ui/.objs/workspace.json index e788f1f4..eb2e84b7 100644 --- a/wb_new_ui/.objs/workspace.json +++ b/wb_new_ui/.objs/workspace.json @@ -10,44 +10,35 @@ "ui://1utjt0r2ufu930", "ui://lkq9ne9speuq2q", "ui://lkq9ne9speuq9m", + "ui://lkq9ne9speuq9n", + "ui://lkq9ne9speuq9g", + "ui://lkq9ne9speuqcu", "ui://lkq9ne9speuqt" ], "test.device": "Huawei Mate20", "canvasColor": 10066329, "auxline2": true, - "doc.activeDoc": "ui://1utjt0r2ufu92i", + "doc.activeDoc": "ui://lkq9ne9speuq9g", "libview.twoColumn": false, "libview.expandedNodes": [ "27vd145b", "/", "27vd145b", "/images/", - "1utjt0r2", - "/", - "1utjt0r2", - "/component/", - "1utjt0r2", - "/component/clearing/", - "1utjt0r2", - "/component/clearing/image/", "lkq9ne9s", "/", "lkq9ne9s", "/component/", "lkq9ne9s", - "/component/HuTip/", + "/component/option/", "lkq9ne9s", - "/component/Main/", + "/component/option/component/", "lkq9ne9s", - "/component/Main/component/", + "/component/option/component/choose/", "lkq9ne9s", - "/component/Main/images/", + "/images/", "lkq9ne9s", - "/component/cards/", - "lkq9ne9s", - "/component/images/", - "lkq9ne9s", - "/component/niao/", + "/images/cards1/", "yzaioi79", "/", "yzaioi79", diff --git a/wb_new_ui/assets/Main_RunBeard/component/option/component/choose/Comp_choose.xml b/wb_new_ui/assets/Main_RunBeard/component/option/component/choose/Comp_choose.xml index 40b1fe94..e5c6ef8c 100644 --- a/wb_new_ui/assets/Main_RunBeard/component/option/component/choose/Comp_choose.xml +++ b/wb_new_ui/assets/Main_RunBeard/component/option/component/choose/Comp_choose.xml @@ -5,9 +5,9 @@ - + - +