diff --git a/Fk/Logic.js b/Fk/Logic.js index d94bf479..c413f893 100644 --- a/Fk/Logic.js +++ b/Fk/Logic.js @@ -113,7 +113,7 @@ callbacks["UpdateRoomList"] = function(jsonData) { gameMode: room[2], playerNum: room[3], capacity: room[4], - hasPassword: room[5], + hasPassword: room[5] ? true : false, }); }); } diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index 2c50b6d7..921022ab 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -361,7 +361,8 @@ Item { anchors.rightMargin: 20 color: "#88EEEEEE" radius: 8 - visible: roomScene.state == "playing" && (specialCardSkills.count > 1 || specialCardSkills.model[0] !== "_normal_use") + visible: roomScene.state == "playing" && (specialCardSkills.count > 1 + || (specialCardSkills.model && specialCardSkills.model[0] !== "_normal_use")) width: childrenRect.width height: childrenRect.height - 20 diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index 171bb5a7..e3334230 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -299,6 +299,16 @@ 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) { + photo.maxCard = cardMax; + } +} + function changeSelf(id) { Backend.callLuaFunction("ChangeSelf", [id]); diff --git a/Fk/RoomElement/Photo.qml b/Fk/RoomElement/Photo.qml index 91d3b2b0..c8792fab 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 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 diff --git a/lua/client/client.lua b/lua/client/client.lua index f5d431e7..6341b1b1 100644 --- a/lua/client/client.lua +++ b/lua/client/client.lua @@ -77,6 +77,10 @@ function Client:moveCards(moves) for _, move in ipairs(moves) do if move.from and move.fromArea then local from = self:getPlayerById(move.from) + self: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]) @@ -92,6 +96,10 @@ function Client:moveCards(moves) if move.to and move.toArea then local ids = move.ids + self:notifyUI("MaxCard", json.encode{ + pcardMax = self:getPlayerById(move.to):getMaxCards(), + id = move.to, + }) if (move.to ~= Self.id and move.toArea == Card.PlayerHand) or table.contains(ids, -1) then ids = table.map(ids, function() return -1 end) end @@ -290,6 +298,10 @@ 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(id):getMaxCards(), + id = id, + }) end fk.client_callback["AskForCardChosen"] = function(jsonData)