mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
a82b8c1b0a
- 15秒后其他人可以将房主踢出 - event中的从room.lua复制过来的self都规范成room - 删了feasible的deprecate警告 - 虚空印卡 关于虚空印卡的说明: * 印的卡id为负数,但依然属于实体卡。 * 这也就是说今后判断虚拟牌的依据是id == 0而不是 <= 0。 * 不过其实虚拟牌的id自古以来就固定是0啦,所以不用担心。 * 虚空印的卡自然只和当前运行的房间有关。 * 虚空印卡的id从-2开始,每印一张其id便减少1。 * 之所以不从-1开始是因为UI把-1认定为未知牌。Bot的玩家id也从-2开始,这是一个道理。 * 除此之外,印出的卡就如同一张普通的实体卡一样,洗入牌堆啥的都没问题,用来作其他虚拟卡的子卡也没啥问题。 * 坐等后面测试出bug吧,当然我希望直接不出bug。
163 lines
3.5 KiB
QML
163 lines
3.5 KiB
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
Flickable {
|
|
id: root
|
|
flickableDirection: Flickable.AutoFlickIfNeeded
|
|
clip: true
|
|
contentHeight: layout.height
|
|
property bool loading: false
|
|
ScrollBar.vertical: ScrollBar {
|
|
parent: root.parent
|
|
anchors.top: root.top
|
|
anchors.right: root.right
|
|
anchors.bottom: root.bottom
|
|
}
|
|
|
|
ColumnLayout {
|
|
id: layout
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 8
|
|
|
|
Switch {
|
|
text: Backend.translate("Disable Extension")
|
|
}
|
|
|
|
RowLayout {
|
|
Text {
|
|
text: Backend.translate("General Packages")
|
|
font.bold: true
|
|
}
|
|
Button {
|
|
text: Backend.translate("Select All")
|
|
onClicked: {
|
|
for (let i = 0; i < gpacks.count; i++) {
|
|
const item = gpacks.itemAt(i);
|
|
item.checked = true;
|
|
}
|
|
}
|
|
}
|
|
Button {
|
|
text: Backend.translate("Revert Selection")
|
|
onClicked: {
|
|
for (let i = 0; i < gpacks.count; i++) {
|
|
const item = gpacks.itemAt(i);
|
|
item.checked = !item.checked;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
GridLayout {
|
|
columns: 2
|
|
|
|
Repeater {
|
|
id: gpacks
|
|
model: ListModel {
|
|
id: gpacklist
|
|
}
|
|
|
|
CheckBox {
|
|
text: name
|
|
checked: pkg_enabled
|
|
enabled: orig_name !== "test_p_0"
|
|
|
|
onCheckedChanged: {
|
|
if (!loading) {
|
|
checkPackage(orig_name, checked);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
Text {
|
|
text: Backend.translate("Card Packages")
|
|
font.bold: true
|
|
}
|
|
Button {
|
|
text: Backend.translate("Select All")
|
|
onClicked: {
|
|
for (let i = 0; i < cpacks.count; i++) {
|
|
const item = cpacks.itemAt(i);
|
|
item.checked = true;
|
|
}
|
|
}
|
|
}
|
|
Button {
|
|
text: Backend.translate("Revert Selection")
|
|
onClicked: {
|
|
for (let i = 0; i < cpacks.count; i++) {
|
|
const item = cpacks.itemAt(i);
|
|
item.checked = !item.checked;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
GridLayout {
|
|
columns: 2
|
|
|
|
Repeater {
|
|
id: cpacks
|
|
model: ListModel {
|
|
id: cpacklist
|
|
}
|
|
|
|
CheckBox {
|
|
text: name
|
|
checked: pkg_enabled
|
|
|
|
onCheckedChanged: {
|
|
checkPackage(orig_name, checked);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function checkPackage(orig_name, checked) {
|
|
const packs = config.disabledPack;
|
|
if (checked) {
|
|
const idx = packs.indexOf(orig_name);
|
|
if (idx !== -1) packs.splice(idx, 1);
|
|
} else {
|
|
packs.push(orig_name);
|
|
}
|
|
Backend.callLuaFunction("UpdatePackageEnable", [orig_name, checked]);
|
|
config.disabledPackChanged();
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
loading = true;
|
|
const g = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
|
for (let orig of g) {
|
|
if (config.serverHiddenPacks.includes(orig)) {
|
|
continue;
|
|
}
|
|
gpacklist.append({
|
|
name: Backend.translate(orig),
|
|
orig_name: orig,
|
|
pkg_enabled: !config.disabledPack.includes(orig),
|
|
});
|
|
}
|
|
|
|
const c = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
|
for (let orig of c) {
|
|
if (config.serverHiddenPacks.includes(orig)) {
|
|
continue;
|
|
}
|
|
cpacklist.append({
|
|
name: Backend.translate(orig),
|
|
orig_name: orig,
|
|
pkg_enabled: !config.disabledPack.includes(orig),
|
|
});
|
|
}
|
|
loading = false;
|
|
}
|
|
}
|