mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 19:58:13 +08:00
7f718503bd
- 复活角色 - 将cancelable全改为默认true - move私有牌堆的未知牌时不再显示错误 - 处理区牌增加大多数脚注 - 装备栏有宝物时压缩间距 - 使用虚拟牌时处理区有虚拟名字 - 带详细描述的选择框 - 武将一览界面显示技能语音、胜利语音、死亡语音
127 lines
2.4 KiB
QML
127 lines
2.4 KiB
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import Fk
|
|
import Fk.RoomElement
|
|
|
|
/* Layout of EquipArea:
|
|
* | Treasure |
|
|
| Weapon |
|
|
| Armor |
|
|
| +1 | -1 |
|
|
+---------------+
|
|
*/
|
|
|
|
Column {
|
|
height: 70
|
|
width: 138
|
|
property int itemHeight: treasureItem.name === "" ? height / 3 : height / 4
|
|
property var items: [treasureItem, weaponItem, armorItem, defensiveHorseItem, offensiveHorseItem]
|
|
property var subtypes: ["treasure", "weapon", "armor", "defensive_horse", "offensive_horse"]
|
|
property int length: area.length
|
|
|
|
InvisibleCardArea {
|
|
id: area
|
|
anchors.centerIn: parent
|
|
checkExisting: true
|
|
}
|
|
|
|
EquipItem {
|
|
id: treasureItem
|
|
width: parent.width
|
|
height: name === "" ? 0 : itemHeight
|
|
opacity: 0
|
|
}
|
|
|
|
EquipItem {
|
|
id: weaponItem
|
|
width: parent.width
|
|
height: itemHeight
|
|
opacity: 0
|
|
}
|
|
|
|
EquipItem {
|
|
id: armorItem
|
|
width: parent.width
|
|
height: itemHeight
|
|
opacity: 0
|
|
}
|
|
|
|
Row {
|
|
width: parent.width
|
|
height: itemHeight
|
|
|
|
Item {
|
|
width: Math.ceil(parent.width / 2)
|
|
height: itemHeight
|
|
|
|
EquipItem {
|
|
id: defensiveHorseItem
|
|
width: parent.width
|
|
height: itemHeight
|
|
icon: "horse"
|
|
opacity: 0
|
|
}
|
|
}
|
|
|
|
Item {
|
|
width: Math.floor(parent.width / 2)
|
|
height: itemHeight
|
|
|
|
EquipItem {
|
|
id: offensiveHorseItem
|
|
width: parent.width
|
|
height: itemHeight
|
|
icon: "horse"
|
|
opacity: 0
|
|
}
|
|
}
|
|
}
|
|
|
|
function add(inputs)
|
|
{
|
|
area.add(inputs);
|
|
|
|
let card, item;
|
|
if (inputs instanceof Array) {
|
|
for (let i = 0; i < inputs.length; i++) {
|
|
card = inputs[i];
|
|
item = items[subtypes.indexOf(card.subtype)];
|
|
item.setCard(card);
|
|
item.show();
|
|
}
|
|
} else {
|
|
card = inputs;
|
|
item = items[subtypes.indexOf(card.subtype)];
|
|
item.setCard(card);
|
|
item.show();
|
|
}
|
|
}
|
|
|
|
function remove(outputs)
|
|
{
|
|
const result = area.remove(outputs);
|
|
for (let i = 0; i < result.length; i++) {
|
|
const card = result[i];
|
|
for (let j = 0; j < items.length; j++) {
|
|
const item = items[j];
|
|
if (item.cid === card.cid) {
|
|
item.reset();
|
|
item.hide();
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
function updateCardPosition(animated)
|
|
{
|
|
area.updateCardPosition(animated);
|
|
}
|
|
|
|
function getAllCards() {
|
|
return area.cards;
|
|
}
|
|
}
|