From ae84b104ccf83b28212233446ed41cc0e2df76d8 Mon Sep 17 00:00:00 2001 From: Ho-spair Date: Sat, 25 Nov 2023 18:18:40 +0800 Subject: [PATCH] mark card in UI --- Fk/Pages/Room.qml | 28 ++++++++++++++++++++++++++++ Fk/Pages/RoomLogic.js | 14 ++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index a5178680..0e6bb68d 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -8,6 +8,7 @@ import QtMultimedia import Fk import Fk.Common import Fk.RoomElement +import Fk.PhotoElement import "RoomLogic.js" as Logic Item { @@ -510,6 +511,33 @@ Item { } } + Rectangle { + id: markCardBoard + + anchors.top: dashboard.top + anchors.left: dashboardBtn.right + visible: false + color: "black" + width: markCardItem.width + 20 + height: markCardItem.height + 20 + radius: 5 + + PicMarkArea { + id: markCardItem + + anchors.centerIn: markCardBoard + } + + TapHandler { + id: mouse + onTapped: markCardBoard.clicked() + } + + onClicked: { + + } + } + Dashboard { id: dashboard width: roomScene.width - dashboardBtn.width diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index 8936a9dd..fd0ede28 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -756,7 +756,7 @@ callbacks["PropertyUpdate"] = (jsonData) => { model[property_name] = value; } - if (property_name === "phase") { + if (prdashboardoperty_name === "phase") { let item = getPhoto(uid); item.playing = value < 8; // Player.NotActive } @@ -1334,14 +1334,20 @@ callbacks["WaitForNullification"] = () => { callbacks["SetPlayerMark"] = (jsonData) => { const data = JSON.parse(jsonData); const player = getPhoto(data[0]); - const mark = data[1]; + const mark = data[1].startsWith('@#') ? data[1].replace('@#', '@!') : data[1]; const value = data[2] instanceof Array ? data[2] : data[2].toString(); - let area = mark.startsWith("@!") ? player.picMarkArea : player.markArea; + let area = (data[1].startsWith("@!") || data[1].startsWith("@#")) ? player.picMarkArea : player.markArea; if (data[2] === 0) { area.removeMark(mark); } else { - area.setMark(mark, mark.startsWith("@@") ? "" : value); + if (data[1].startsWith("@#") && data[0] === Self.id) { + markCardItem.setMark(mark, value); + } else { + area.setMark(mark, mark.startsWith("@@") ? "" : value); + } } + + markCardBoard.visible = markCardItem.data.length > 0; } callbacks["Animate"] = (jsonData) => {