2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
2023-05-19 02:08:36 +00:00
|
|
|
import Fk
|
|
|
|
import Fk.RoomElement
|
2022-04-14 10:22:00 +00:00
|
|
|
|
|
|
|
Item {
|
2023-08-12 18:25:04 +00:00
|
|
|
property bool sealed: parent.sealedSlots.includes("JudgeSlot")
|
|
|
|
|
|
|
|
Image {
|
|
|
|
visible: sealed
|
|
|
|
x: -6; y: 8; z: 9
|
|
|
|
source: SkinBank.DELAYED_TRICK_DIR + "sealed"
|
|
|
|
height: 28
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
InvisibleCardArea {
|
|
|
|
id: area
|
|
|
|
checkExisting: true
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
ListModel {
|
|
|
|
id: cards
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2023-05-18 23:45:21 +00:00
|
|
|
Row {
|
2022-04-30 07:27:56 +00:00
|
|
|
id: grid
|
|
|
|
anchors.fill: parent
|
2023-05-18 23:45:21 +00:00
|
|
|
spacing: -4
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Repeater {
|
|
|
|
model: cards
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Image {
|
2023-05-18 23:45:21 +00:00
|
|
|
height: 55 * 0.8
|
|
|
|
width: 47 * 0.8
|
2023-06-04 11:31:44 +00:00
|
|
|
source: SkinBank.getDelayedTrickPicture(name) // SkinBank.DELAYED_TRICK_DIR + name
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
function add(inputs)
|
|
|
|
{
|
|
|
|
area.add(inputs);
|
2023-01-29 10:11:41 +00:00
|
|
|
if (!(inputs instanceof Array)) {
|
|
|
|
inputs = [inputs];
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
2023-01-29 10:11:41 +00:00
|
|
|
inputs.forEach(card => {
|
2023-06-09 09:23:02 +00:00
|
|
|
const v = JSON.parse(Backend.callLuaFunction("GetVirtualEquip", [parent.playerid, card.cid]));
|
2023-01-29 10:11:41 +00:00
|
|
|
if (v !== null) {
|
|
|
|
cards.append(v);
|
|
|
|
} else {
|
2023-02-15 11:54:35 +00:00
|
|
|
cards.append({
|
|
|
|
name: card.name,
|
|
|
|
cid: card.cid
|
|
|
|
});
|
2023-01-29 10:11:41 +00:00
|
|
|
}
|
|
|
|
});
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
function remove(outputs)
|
|
|
|
{
|
2023-06-09 09:23:02 +00:00
|
|
|
const result = area.remove(outputs);
|
2022-04-30 07:27:56 +00:00
|
|
|
for (let i = 0; i < result.length; i++) {
|
2023-06-09 09:23:02 +00:00
|
|
|
const item = result[i];
|
2022-04-30 07:27:56 +00:00
|
|
|
for (let j = 0; j < cards.count; j++) {
|
2023-06-09 09:23:02 +00:00
|
|
|
const icon = cards.get(j);
|
2022-04-30 07:27:56 +00:00
|
|
|
if (icon.cid === item.cid) {
|
|
|
|
cards.remove(j, 1);
|
|
|
|
break;
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateCardPosition(animated)
|
|
|
|
{
|
|
|
|
area.updateCardPosition(animated);
|
|
|
|
}
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|