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 {
|
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
|
2022-04-30 07:27:56 +00:00
|
|
|
source: SkinBank.DELAYED_TRICK_DIR + name
|
|
|
|
}
|
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 => {
|
|
|
|
let v = JSON.parse(Backend.callLuaFunction("GetVirtualEquip", [parent.playerid, card.cid]));
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
let result = area.remove(outputs);
|
|
|
|
for (let i = 0; i < result.length; i++) {
|
|
|
|
let item = result[i];
|
|
|
|
for (let j = 0; j < cards.count; j++) {
|
|
|
|
let icon = cards.get(j);
|
|
|
|
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
|
|
|
}
|