修几个小bug
This commit is contained in:
notify 2023-06-18 16:24:12 +08:00 committed by GitHub
parent bd42f51b38
commit 0c9701b74a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 30 deletions

View File

@ -112,18 +112,27 @@ Flickable {
screenName.text = extra_data.photo.screenName;
const gamedata = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [id]));
const total = gamedata[0];
const win = gamedata[1];
const run = gamedata[2];
const winRate = (win / total) * 100;
const runRate = (run / total) * 100;
playerGameData.text = Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2))
.arg(runRate.toFixed(2)).arg(total);
if (!config.observing) {
const gamedata = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [id]));
const total = gamedata[0];
const win = gamedata[1];
const run = gamedata[2];
const winRate = (win / total) * 100;
const runRate = (run / total) * 100;
playerGameData.text = Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2))
.arg(runRate.toFixed(2)).arg(total);
}
const data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id]));
data.forEach(t => {
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
});
const equips = JSON.parse(Backend.callLuaFunction("GetPlayerEquips", [id]));
equips.forEach(cid => {
const t = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
skillDesc.append("--------------------");
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + Backend.translate(":" + t.name));
});
}
}

View File

@ -216,25 +216,12 @@ end
function GetPlayerSkills(id)
local p = ClientInstance:getPlayerById(id)
local equip = {}
local ret = {}
table.forEach(p.player_skills, function(s)
if s:isEquipmentSkill() then
table.insert(equip, s.attached_equip)
elseif s.visible then
table.insert(ret, {
name = s.name,
description = Fk:getDescription(s.name),
})
end
end)
table.insertTable(ret, table.map(equip, function(e)
return {
name = e,
description = Fk:getDescription(e),
}
return json.encode(table.map(p.player_skills, function(s)
return s.visible and {
name = s.name,
description = Fk:getDescription(s.name),
} or nil
end))
return json.encode(ret)
end
---@param card string | integer
@ -572,6 +559,12 @@ function GetPlayerHandcards(pid)
return json.encode(p.player_cards[Player.Hand])
end
function GetPlayerEquips(pid)
local c = ClientInstance
local p = c:getPlayerById(pid)
return json.encode(p.player_cards[Player.Equip])
end
function ResetClientLua()
local data = ClientInstance.room_settings
Self = ClientPlayer:new(fk.Self)

View File

@ -710,10 +710,8 @@ function Room:doRaceRequest(command, players, jsonData)
if p.reply_cancel then
table.removeOne(players, p)
table.insertIfNeed(canceled_players, p)
end
-- 骗过调度器让他以为自己尚未就绪
if p.id > 0 then
elseif p.id > 0 then
-- 骗过调度器让他以为自己尚未就绪
p.request_timeout = remainTime - elapsed
p.serverplayer:setThinking(true)
end

View File

@ -121,6 +121,8 @@ local function mainLoop()
-- verbose('[.] Sleeping for %d ms...', time)
local cur = os.getms()
time = math.min((time <= 0 and 9999999 or time), 200)
-- 调用RoomThread的trySleep函数开始真正的睡眠。会被wakeUp(c++)唤醒。
requestRoom.thread:trySleep(time)