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);
|
|
|
|
if (inputs instanceof Array) {
|
|
|
|
cards.append(...inputs);
|
|
|
|
} else {
|
|
|
|
cards.append(inputs);
|
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 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
|
|
|
}
|