parent
bd42f51b38
commit
0c9701b74a
|
@ -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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue