update freeassign

This commit is contained in:
notify 2023-04-28 19:19:45 +08:00
parent 432bd5df4d
commit 417ec49de9
6 changed files with 94 additions and 30 deletions

View File

@ -23,6 +23,7 @@ Fk:loadTranslationTable{
["BG Settings"] = "游戏背景", ["BG Settings"] = "游戏背景",
["Audio Settings"] = "音频", ["Audio Settings"] = "音频",
["Disable message audio"] = "禁用聊天语音", ["Disable message audio"] = "禁用聊天语音",
["Back"] = "返回",
["Create Room"] = "创建房间", ["Create Room"] = "创建房间",
["Room Name"] = "房间名字", ["Room Name"] = "房间名字",

View File

@ -33,7 +33,7 @@ ColumnLayout {
} }
} }
CheckBox { Switch {
text: Backend.translate("Disable message audio") text: Backend.translate("Disable message audio")
checked: config.disableMsgAudio checked: config.disableMsgAudio
onCheckedChanged: config.disableMsgAudio = checked; onCheckedChanged: config.disableMsgAudio = checked;

View File

@ -79,13 +79,13 @@ ColumnLayout {
} }
} }
CheckBox { Switch {
id: freeAssignCheck id: freeAssignCheck
checked: Debugging ? true : false checked: Debugging ? true : false
text: Backend.translate("Enable free assign") text: Backend.translate("Enable free assign")
} }
CheckBox { Switch {
id: deputyCheck id: deputyCheck
checked: Debugging ? true : false checked: Debugging ? true : false
text: Backend.translate("Enable deputy general") text: Backend.translate("Enable deputy general")

View File

@ -21,7 +21,7 @@ Flickable {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 8 anchors.topMargin: 8
CheckBox { Switch {
text: "禁用Lua拓展 (重启后生效)" text: "禁用Lua拓展 (重启后生效)"
} }

View File

@ -3,41 +3,105 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import ".."
Item { Item {
id: root id: root
anchors.fill: parent anchors.fill: parent
property var generalModel
property var extra_data: ({}) property var extra_data: ({})
signal finish() signal finish()
Flickable { ToolBar {
height: parent.height id: bar
width: generalButtons.width width: parent.width
anchors.centerIn: parent RowLayout {
contentHeight: generalButtons.height anchors.fill: parent
ScrollBar.vertical: ScrollBar {} ToolButton {
ColumnLayout { opacity: stack.depth > 1 ? 1 : 0
id: generalButtons Behavior on opacity { NumberAnimation { duration: 100 } }
Repeater { text: Backend.translate("Back")
model: ListModel { onClicked: stack.pop()
id: packages }
Label {
text: Backend.translate("Enable free assign")
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: true
}
ToolButton {
opacity: 0
}
}
}
StackView {
id: stack
width: parent.width
height: parent.height - bar.height
anchors.top: bar.bottom
initialItem: pkgList
}
ListModel {
id: packages
}
Component {
id: pkgList
GridView {
id: listView
width: parent.width
height: stack.height
ScrollBar.vertical: ScrollBar {}
model: packages
clip: true
cellWidth: width / 3
cellHeight: 40
delegate: ItemDelegate {
width: listView.width / 3
height: 40
Text {
text: Backend.translate(name)
anchors.centerIn: parent
} }
ColumnLayout { onClicked: {
Text { text: Backend.translate(name) } generalModel = JSON.parse(Backend.callLuaFunction("GetGenerals",
GridLayout { [packages.get(index).name]));
columns: 5 stack.push(generalList);
Repeater { }
model: JSON.parse(Backend.callLuaFunction("GetGenerals", [name])) }
Button { }
text: Backend.translate(modelData) }
onClicked: {
extra_data.card.name = modelData; Component {
root.finish(); id: generalList
} ColumnLayout {
} clip: true
} width: stack.width
height: stack.height
Item { height: 6 }
GridView {
Layout.preferredWidth: stack.width - stack.width % 100 + 10
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
model: generalModel
ScrollBar.vertical: ScrollBar {}
cellHeight: 140
cellWidth: 100
delegate: GeneralCardItem {
autoBack: false
name: modelData
onClicked: {
extra_data.card.name = modelData;
root.finish();
} }
} }
} }

View File

@ -263,7 +263,6 @@ void QmlBackend::playSound(const QString &name, int index) {
auto output = new QAudioOutput; auto output = new QAudioOutput;
player->setAudioOutput(output); player->setAudioOutput(output);
player->setSource(QUrl::fromLocalFile(fname)); player->setSource(QUrl::fromLocalFile(fname));
qDebug() << m_volume;
output->setVolume(m_volume / 100); output->setVolume(m_volume / 100);
connect(player, &QMediaPlayer::playbackStateChanged, this, [=]() { connect(player, &QMediaPlayer::playbackStateChanged, this, [=]() {
if (player->playbackState() == QMediaPlayer::StoppedState) { if (player->playbackState() == QMediaPlayer::StoppedState) {