-
Notifications
You must be signed in to change notification settings - Fork 2
/
Options.qml
152 lines (131 loc) · 4.24 KB
/
Options.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import "qrc:/assets/ui" as UiStyle
import "./ui"
import "./game"
Pane {
property bool loaded: false
background: UiStyle.Pane {}
Component.onCompleted: {
console.log("Option locale load", i18n.currentLocale, i18n.getAvailableLocales());
localeInput.currentIndex = i18n.getAvailableLocales().indexOf(i18n.currentLocale);
movementInput.currentIndex = gameManager.movementModeOption;
loaded = true;
pauseController.paused = true;
}
PauseController { id: pauseController }
BackAction {
id: closeAction
text: i18n.t("Close")
onTriggered: {
pauseController.paused = false;
application.popView();
}
}
Connections {
target: gamepad
function onBackClicked() { closeAction.trigger() }
}
Pane {
anchors { top: parent.top; left: parent.left; right: parent.right; bottom: formControls.top }
anchors.margins: 20
background: UiStyle.TerminalPane {}
GridLayout {
columns: 2
TerminalLabel {
text: i18n.t("options.title.interface")
font.pixelSize: 30
Layout.columnSpan: 2
}
TerminalLabel { text: i18n.t("options.locale") }
TerminalComboBox {
id: localeInput
Layout.fillWidth: true
model: i18n.getAvailableLocales()
onCurrentIndexChanged: {
const newLocale = i18n.getAvailableLocales()[currentIndex];
if (i18n.currentLocale !== newLocale && loaded)
i18n.currentLocale = newLocale;
}
TerminalButton {
anchors.left: localeInput.right
anchors.leftMargin: 10
text: i18n.t("Restore")
onClicked: localeInput.currentIndex = localeInput.indexOfValue(i18n.systemLocale);
}
}
TerminalLabel { text: i18n.t("options.fullscreen") }
TerminalCheckBox {
id: fullscreenInput
checked: application.isFullScreen
onCheckedChanged: application.isFullScreen = checked
}
TerminalLabel {
text: i18n.t("options.title.sounds")
font.pixelSize: 30
Layout.columnSpan: 2
Layout.topMargin: 20
}
TerminalLabel { text: i18n.t("options.musicVolume") }
Slider {
id: musicVolumeInput
Layout.fillWidth: true
from: 0
to: 100
Component.onCompleted: { value = musicManager.defaultVolume; }
onValueChanged: { musicManager.defaultVolume = value; }
}
TerminalLabel { text: i18n.t("options.soundEffectsVolume") }
Slider {
id: soundEffectsVolume
Layout.fillWidth: true
from: 0
to: 100
Component.onCompleted: { value = soundManager.defaultVolume; }
onValueChanged: { soundManager.defaultVolume = value; }
}
TerminalLabel {
text: i18n.t("options.title.gameplay")
font.pixelSize: 30
Layout.columnSpan: 2
Layout.topMargin: 20
}
TerminalLabel { text: i18n.t("options.movementMode") }
TerminalComboBox {
id: movementInput
Layout.fillWidth: true
model: [i18n.t("options.movement.mixed"), i18n.t("options.movement.alwaysRun"), i18n.t("options.movement.alwaysWalk")]
currentIndex: gameManager.movementModeOption
onCurrentIndexChanged: gameManager.movementModeOption = currentIndex
}
TerminalLabel { text: i18n.t("options.movementCursor") }
TerminalCheckBox {
id: movementCursorInput
checked: mouseCursor.withMoveCursor
onCheckedChanged: mouseCursor.withMoveCursor = checked
}
TerminalLabel { text: i18n.t("options.withPlayerCropCircle") }
TerminalCheckBox {
id: withPlayerCropCircleInput
checked: gameManager.withPlayerCropCircle
onCheckedChanged: gameManager.withPlayerCropCircle = checked
}
TerminalLabel { text: i18n.t("options.combatSpeed") }
Slider {
id: combatSpeedInput
Layout.fillWidth: true
value: gameManager.combatSpeedOption
from: 1
to: 10
onValueChanged: gameManager.combatSpeedOption = value
}
}
}
MenuButton {
id: formControls
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
action: closeAction
}
}