无冲突

master
lingmeng 2026-03-12 18:50:37 +08:00
commit dde72409dd
4 changed files with 24 additions and 143 deletions

View File

@ -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 '"<function: ' .. info.name .. '>"'
else
return '"<function>"'
end
else
return '"<' .. type(t) .. '>"'
end
end
visited = visited or {}
if visited[t] then
return '"<cyclic reference>"'
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 = '"<function: ' .. info.name .. '>"'
else
valueStr = '"<function>"'
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

View File

@ -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()

View File

@ -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",

View File

@ -5,9 +5,9 @@
<loader id="n20_eqee" name="card1" xy="9,2" size="80,96" group="n24_eqee" aspect="true" url="ui://v6yvqp7wu21j77" fill="scale"/>
<loader id="n21_eqee" name="card2" xy="7,106" size="89,106" group="n24_eqee" aspect="true" url="ui://v6yvqp7wu21j6a" fill="scale"/>
<loader id="n22_eqee" name="card3" xy="6,216" size="89,106" group="n24_eqee" aspect="true" url="ui://v6yvqp7wu21j7a" fill="scale"/>
<graph id="n23_eqee" name="n23" xy="5,2" size="88,101" group="n24_eqee" type="rect" fillColor="#80000000" corner="5"/>
<graph id="n23_eqee" name="n23" xy="5,2" size="88,101" group="n24_eqee" visible="false" type="rect" fillColor="#80000000" corner="5"/>
<group id="n24_eqee" name="n24" xy="5,2" size="91,320"/>
<graph id="n25_eqee" name="n25" xy="-1,0" size="66,225" type="rect" lineSize="2" lineColor="#ffffff00" fillColor="#00ffffff">
<graph id="n25_eqee" name="n25" xy="-1,0" size="94,321" type="rect" lineSize="2" lineColor="#ffffff00" fillColor="#00ffffff">
<gearDisplay controller="zhong" pages="1"/>
</graph>
</displayList>