diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index 171bb5a7..74e47c31 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -299,6 +299,19 @@ function doIndicate(from, tos) { line.running = true; } +callbacks["cardMax"] = function(jsonData) { + + let data = JSON.parse(jsonData); + let id = data.id; + let cardMax = data.pcardMax; + let photo = getPhoto(id); + if (!photo) { + return null; + } + photo.cardMax = cardMax; + +} + function changeSelf(id) { Backend.callLuaFunction("ChangeSelf", [id]); diff --git a/Fk/RoomElement/Photo.qml b/Fk/RoomElement/Photo.qml index 91d3b2b0..54700660 100644 --- a/Fk/RoomElement/Photo.qml +++ b/Fk/RoomElement/Photo.qml @@ -31,6 +31,7 @@ Item { property bool isOwner: false property int distance: 0 property string status: "normal" + property int cardMax: 0 property alias handcardArea: handcardAreaItem property alias equipArea: equipAreaItem @@ -351,7 +352,7 @@ Item { x: -6 Text { - text: root.handcards + text: root.handcards + "/" +root.cardMax font.family: fontLibian.name font.pixelSize: 32 //font.weight: 30 diff --git a/lua/client/client.lua b/lua/client/client.lua index f5d431e7..a1a76830 100644 --- a/lua/client/client.lua +++ b/lua/client/client.lua @@ -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("cardMax", 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("cardMax", json.encode{ pcardMax = ClientInstance:getPlayerById(data[1]):getMaxCards(), id = data[1]}) end fk.client_callback["AskForCardChosen"] = function(jsonData)