2023-02-15 11:54:35 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
width: 138
|
|
|
|
height: markTxtList.height
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: markList
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
color: "#3C3229"
|
|
|
|
opacity: 0.8
|
|
|
|
radius: 4
|
|
|
|
border.color: "white"
|
|
|
|
border.width: 1
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: markTxtList
|
|
|
|
x: 2
|
|
|
|
spacing: 0
|
|
|
|
Repeater {
|
|
|
|
model: markList
|
|
|
|
Item {
|
|
|
|
width: childrenRect.width
|
|
|
|
height: 22
|
|
|
|
Text {
|
|
|
|
text: Backend.translate(mark_name) + ' ' + Backend.translate(mark_extra)
|
|
|
|
font.family: fontLibian.name
|
|
|
|
font.pixelSize: 22
|
|
|
|
color: "white"
|
|
|
|
style: Text.Outline
|
|
|
|
textFormat: Text.RichText
|
|
|
|
}
|
|
|
|
|
2023-03-18 07:34:42 +00:00
|
|
|
TapHandler {
|
|
|
|
enabled: root.parent.state != "candidate" || !root.parent.selectable
|
|
|
|
onTapped: {
|
2023-02-21 05:44:24 +00:00
|
|
|
let data = JSON.parse(Backend.callLuaFunction("GetPile", [root.parent.playerid, mark_name]));
|
|
|
|
data = data.filter((e) => e !== -1);
|
|
|
|
if (data.length === 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Just for using room's right drawer
|
|
|
|
roomScene.startCheat("RoomElement/ViewPile.qml", {
|
|
|
|
name: mark_name,
|
|
|
|
ids: data
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-02-15 11:54:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setMark(mark, data) {
|
|
|
|
let i, modelItem;
|
|
|
|
for (i = 0; i < markList.count; i++) {
|
|
|
|
if (markList.get(i).mark_name === mark) {
|
|
|
|
modelItem = markList.get(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (modelItem)
|
|
|
|
modelItem.mark_extra = data;
|
|
|
|
else
|
|
|
|
markList.append({ mark_name: mark, mark_extra: data });
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeMark(mark) {
|
|
|
|
let i, modelItem;
|
|
|
|
for (i = 0; i < markList.count; i++) {
|
|
|
|
if (markList.get(i).mark_name === mark) {
|
|
|
|
markList.remove(i, 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|