2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
2022-04-14 10:22:00 +00:00
|
|
|
import ".."
|
|
|
|
import "../../skin-bank.js" as SkinBank
|
|
|
|
|
|
|
|
Item {
|
2022-04-30 07:27:56 +00:00
|
|
|
property alias rows: grid.rows
|
|
|
|
property alias columns: grid.columns
|
2022-04-14 10:22:00 +00:00
|
|
|
|
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
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Grid {
|
|
|
|
id: grid
|
|
|
|
anchors.fill: parent
|
|
|
|
rows: 100
|
|
|
|
columns: 100
|
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 {
|
|
|
|
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
|
|
|
}
|