FreeKill/Fk/LobbyElement/BanGeneralSetting.qml
Nyutanislavsky 4235bf6237
enhance processPrompt (#355)
1. 改进processPrompt,支持双将和暗将
2. 副将长名旋转
3. 国战体力上限优化,包括一览和选将框
4. 空格添加结束出牌阶段,Escape键呼出菜单
5. 武将一览左栏文本换行
6. 同名替换影响已选择的武将
7. 再次排序手牌时按照点数排序
8. Logic.js翻译
9. 进入房间翻译删去句号,跟房间内其他toast风格统一
10. 常见疑问最后一张“下一条”改为“OK!”
11. 录像回放“从文件打开”翻译
12. interaction自动弹出和关闭,comboBox补技能名
13. 卡牌音效添加装备效果音效和使用音效,小小重构
14. activeSkill的prompt的selected_targets实装
15. 禁用扩展包文本ui限制长度
16. 右键技能呼出气泡
Qsgs-Fans/freekill-core#3
2024-06-10 14:58:48 +08:00

244 lines
5.7 KiB
QML

// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
id: root
clip: true
ColumnLayout {
anchors.fill: parent
RowLayout {
Layout.fillWidth: true
anchors.rightMargin: 8
spacing: 16
Text {
text: luatr("Ban List")
}
ComboBox {
id: banCombo
textRole: "name"
Layout.fillWidth: true
model: ListModel {
id: banComboList
}
onCurrentIndexChanged: {
word.text = "";
config.disableSchemes[config.currentDisableIdx] = config.curScheme;
config.currentDisableIdx = currentIndex;
config.curScheme = config.disableSchemes[currentIndex];
}
}
GridLayout {
columns: 2
Button {
text: luatr("New")
onClicked: {
const i = config.disableSchemes.length;
banComboList.append({
name: luatr("List") + (i + 1),
});
config.disableSchemes.push({
name: "",
banPkg: {},
normalPkg: {},
banCardPkg: [],
});
}
}
Button {
text: luatr("Clear")
onClicked: {
config.curScheme.banPkg = {};
config.curScheme.normalPkg = {};
config.curScheme.banCardPkg = [];
config.curSchemeChanged();
}
}
Button {
text: luatr("Export")
onClicked: {
Backend.copyToClipboard(JSON.stringify(config.curScheme));
toast.show(luatr("Export Success"));
}
}
Button {
text: luatr("Import")
onClicked: {
const str = Backend.readClipboard();
let data;
try {
data = JSON.parse(str);
} catch (e) {
toast.show(luatr("Not Legal"));
return;
}
if (!data instanceof Object || !data.banPkg || !data.normalPkg
|| !data.banCardPkg) {
toast.show(luatr("Not JSON"));
return;
}
config.curScheme = data;
if (data.name) {
banComboList.get(banCombo.currentIndex).name = data.name;
}
}
}
}
TextField {
id: word
clip: true
leftPadding: 5
rightPadding: 5
}
Button {
text: luatr("Rename")
enabled: word.text !== ""
onClicked: {
banComboList.get(banCombo.currentIndex).name = word.text;
config.curScheme.name = word.text;
word.text = "";
}
}
}
Text {
Layout.fillWidth: true
Layout.margins: 8
wrapMode: Text.WrapAnywhere
text: luatr("Help_Ban_List")
}
GridLayout {
id: grid
flow: GridLayout.TopToBottom
rows: 2
Layout.fillWidth: true
Layout.fillHeight: true
Text {
wrapMode: Text.WrapAnywhere
text: luatr("Ban_Generals")
font.pixelSize: 18
font.bold: true
}
GridView {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
cellWidth: width / 2
cellHeight: 24
model: {
let ret = [], k;
const s = config.curScheme;
for (k in s.normalPkg) {
ret.push(...s.normalPkg[k]);
}
return ret;
}
delegate: Text {
//width: banChara.width
text: {
const prefix = modelData.split("__")[0];
let name = luatr(modelData);
if (prefix !== modelData) {
name += (" (" + luatr(prefix) + ")");
}
return name;
}
font.pixelSize: 16
}
}
Text {
wrapMode: Text.WrapAnywhere
text: luatr("Ban_Packages")
font.pixelSize: 18
font.bold: true
}
GridView {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
cellWidth: width / 2
cellHeight: 24
model: {
let ret = [], k;
const s = config.curScheme;
for (k in s.banPkg) {
ret.push(k);
}
ret.push(...s.banCardPkg)
return ret;
}
delegate: Text {
width: parent.width / 2
wrapMode: Text.WordWrap
fontSizeMode: Text.HorizontalFit
minimumPixelSize: 14
elide: Text.ElideRight
height: 24
text: luatr(modelData)
font.pixelSize: 16
}
}
Text {
wrapMode: Text.WrapAnywhere
text: luatr("Whitelist_Generals")
font.pixelSize: 18
font.bold: true
}
GridView {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
cellWidth: width / 2
cellHeight: 24
model: {
let ret = [], k;
const s = config.curScheme;
for (k in s.banPkg) {
ret.push(...s.banPkg[k]);
}
return ret;
}
delegate: Text {
text: {
const prefix = modelData.split("__")[0];
let name = luatr(modelData);
if (prefix !== modelData) {
name += (" (" + luatr(prefix) + ")");
}
return name;
}
font.pixelSize: 16
}
}
}
}
Component.onCompleted: {
for (let i = 0; i < config.disableSchemes.length; i++) {
banComboList.append({
name: config.disableSchemes[i]?.name || (luatr("List") + (i + 1)),
});
}
banCombo.currentIndex = config.currentDisableIdx;
}
}