手牌上限显示

手牌上限显示,体力不等时不显示
This commit is contained in:
肯我赛 2023-05-28 17:59:55 +08:00
parent 6fde0d983d
commit fadfc0f7ec
3 changed files with 18 additions and 2 deletions

View File

@ -299,6 +299,19 @@ function doIndicate(from, tos) {
line.running = true;
}
callbacks["MaxCard"] = function(jsonData) {
let data = JSON.parse(jsonData);
let id = data.id;
let cardMax = data.pcardMax;
let photo = getPhoto(id);
if (!photo) {
return null;
}
photo.maxCard = cardMax;
}
function changeSelf(id) {
Backend.callLuaFunction("ChangeSelf", [id]);

View File

@ -31,6 +31,7 @@ Item {
property bool isOwner: false
property int distance: 0
property string status: "normal"
property int maxCard: 0
property alias handcardArea: handcardAreaItem
property alias equipArea: equipAreaItem
@ -351,9 +352,9 @@ Item {
x: -6
Text {
text: root.handcards
text: root.maxCard==root.hp ? root.handcards : root.handcards + "/" +root.maxCard
font.family: fontLibian.name
font.pixelSize: 32
font.pixelSize: root.maxCard==root.hp ? 32 : 27
//font.weight: 30
color: "white"
anchors.horizontalCenter: parent.horizontalCenter

View File

@ -77,6 +77,7 @@ function Client:moveCards(moves)
for _, move in ipairs(moves) do
if move.from and move.fromArea then
local from = self:getPlayerById(move.from)
ClientInstance:notifyUI("MaxCard", json.encode{ pcardMax = from:getMaxCards(),id = move.from})
if from.id ~= Self.id and move.fromArea == Card.PlayerHand then
for i = 1, #move.ids do
table.remove(from.player_cards[Player.Hand])
@ -290,6 +291,7 @@ fk.client_callback["PropertyUpdate"] = function(jsonData)
local id, name, value = data[1], data[2], data[3]
ClientInstance:getPlayerById(id)[name] = value
ClientInstance:notifyUI("PropertyUpdate", jsonData)
ClientInstance:notifyUI("MaxCard", json.encode{ pcardMax = ClientInstance:getPlayerById(data[1]):getMaxCards(), id = data[1]})
end
fk.client_callback["AskForCardChosen"] = function(jsonData)