2023-04-09 13:35:35 +08:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
import QtQuick
|
2022-03-24 21:23:42 +08:00
|
|
|
|
|
|
|
QtObject {
|
2022-04-30 15:27:56 +08:00
|
|
|
// Client configuration
|
2023-02-27 10:23:48 +08:00
|
|
|
property real winX
|
|
|
|
property real winY
|
2022-12-18 12:52:52 +08:00
|
|
|
property real winWidth
|
|
|
|
property real winHeight
|
|
|
|
property var conf: ({})
|
|
|
|
property string lastLoginServer
|
|
|
|
property var savedPassword: ({})
|
2023-02-15 19:54:35 +08:00
|
|
|
property string lobbyBg
|
|
|
|
property string roomBg
|
|
|
|
property string bgmFile
|
2023-02-27 10:23:48 +08:00
|
|
|
property string language
|
2023-03-14 14:12:13 +08:00
|
|
|
property var disabledPack: []
|
|
|
|
property string preferedMode
|
|
|
|
property int preferedPlayerNum
|
2023-03-20 14:53:56 +08:00
|
|
|
property int preferredGeneralNum
|
|
|
|
property string ladyImg
|
2023-04-28 18:24:31 +08:00
|
|
|
property real bgmVolume
|
|
|
|
property bool disableMsgAudio
|
2022-03-24 21:23:42 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
// Player property of client
|
2022-12-18 12:52:52 +08:00
|
|
|
property string serverAddr
|
2022-04-30 15:27:56 +08:00
|
|
|
property string screenName: ""
|
|
|
|
property string password: ""
|
2022-12-18 12:52:52 +08:00
|
|
|
property string cipherText
|
2023-04-15 12:06:39 +08:00
|
|
|
property string aeskey
|
2022-03-24 21:23:42 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
// Client data
|
|
|
|
property int roomCapacity: 0
|
|
|
|
property int roomTimeout: 0
|
2023-02-15 19:54:35 +08:00
|
|
|
property bool enableFreeAssign: false
|
|
|
|
property bool observing: false
|
2022-12-18 12:52:52 +08:00
|
|
|
|
|
|
|
function loadConf() {
|
|
|
|
conf = JSON.parse(Backend.loadConf());
|
2023-04-27 14:15:08 +08:00
|
|
|
winX = conf.winX ?? 100;
|
|
|
|
winY = conf.winY ?? 100;
|
|
|
|
winWidth = conf.winWidth ?? 960;
|
|
|
|
winHeight = conf.winHeight ?? 540;
|
|
|
|
lastLoginServer = conf.lastLoginServer ?? "127.0.0.1";
|
|
|
|
savedPassword = conf.savedPassword ?? {};
|
|
|
|
lobbyBg = conf.lobbyBg ?? AppPath + "/image/background";
|
|
|
|
roomBg = conf.roomBg ?? AppPath + "/image/gamebg";
|
|
|
|
bgmFile = conf.bgmFile ?? AppPath + "/audio/system/bgm.mp3";
|
|
|
|
language = conf.language ?? "zh_CN";
|
|
|
|
disabledPack = conf.disabledPack ?? [ "test_p_0" ];
|
|
|
|
preferedMode = conf.preferedMode ?? "aaa_role_mode";
|
|
|
|
preferedPlayerNum = conf.preferedPlayerNum ?? 2;
|
|
|
|
preferredGeneralNum = conf.preferredGeneralNum ?? 3;
|
|
|
|
ladyImg = conf.ladyImg ?? AppPath + "/image/lady";
|
2023-04-28 18:24:31 +08:00
|
|
|
Backend.volume = conf.effectVolume ?? 50.;
|
|
|
|
bgmVolume = conf.bgmVolume ?? 50.;
|
|
|
|
disableMsgAudio = conf.disableMsgAudio ?? false;
|
2022-12-18 12:52:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function saveConf() {
|
2023-02-27 10:23:48 +08:00
|
|
|
conf.winX = realMainWin.x;
|
|
|
|
conf.winY = realMainWin.y;
|
2022-12-18 12:52:52 +08:00
|
|
|
conf.winWidth = realMainWin.width;
|
|
|
|
conf.winHeight = realMainWin.height;
|
|
|
|
conf.lastLoginServer = lastLoginServer;
|
|
|
|
conf.savedPassword = savedPassword;
|
2023-02-15 19:54:35 +08:00
|
|
|
conf.lobbyBg = lobbyBg;
|
|
|
|
conf.roomBg = roomBg;
|
|
|
|
conf.bgmFile = bgmFile;
|
2023-02-27 10:23:48 +08:00
|
|
|
conf.language = language;
|
2023-03-14 14:12:13 +08:00
|
|
|
conf.disabledPack = disabledPack;
|
|
|
|
conf.preferedMode = preferedMode;
|
|
|
|
conf.preferedPlayerNum = preferedPlayerNum;
|
2023-03-20 14:53:56 +08:00
|
|
|
conf.ladyImg = ladyImg;
|
|
|
|
conf.preferredGeneralNum = preferredGeneralNum;
|
2023-04-28 18:24:31 +08:00
|
|
|
conf.effectVolume = Backend.volume;
|
|
|
|
conf.bgmVolume = bgmVolume;
|
|
|
|
conf.disableMsgAudio = disableMsgAudio;
|
2022-12-18 12:52:52 +08:00
|
|
|
|
|
|
|
Backend.saveConf(JSON.stringify(conf, undefined, 2));
|
|
|
|
}
|
2022-03-24 21:23:42 +08:00
|
|
|
}
|