2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
2022-03-24 13:23:42 +00:00
|
|
|
|
|
|
|
QtObject {
|
2022-04-30 07:27:56 +00:00
|
|
|
// Client configuration
|
2023-02-27 02:23:48 +00:00
|
|
|
property real winX
|
|
|
|
property real winY
|
2022-12-18 04:52:52 +00:00
|
|
|
property real winWidth
|
|
|
|
property real winHeight
|
|
|
|
property var conf: ({})
|
|
|
|
property string lastLoginServer
|
|
|
|
property var savedPassword: ({})
|
2023-02-15 11:54:35 +00:00
|
|
|
property string lobbyBg
|
|
|
|
property string roomBg
|
|
|
|
property string bgmFile
|
2023-02-27 02:23:48 +00:00
|
|
|
property string language
|
2023-03-14 06:12:13 +00:00
|
|
|
property var disabledPack: []
|
|
|
|
property string preferedMode
|
|
|
|
property int preferedPlayerNum
|
2023-03-20 06:53:56 +00:00
|
|
|
property int preferredGeneralNum
|
|
|
|
property string ladyImg
|
2022-03-24 13:23:42 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
// Player property of client
|
2022-12-18 04:52:52 +00:00
|
|
|
property string serverAddr
|
2022-04-30 07:27:56 +00:00
|
|
|
property string screenName: ""
|
|
|
|
property string password: ""
|
2022-12-18 04:52:52 +00:00
|
|
|
property string cipherText
|
2023-04-15 04:06:39 +00:00
|
|
|
property string aeskey
|
2022-03-24 13:23:42 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
// Client data
|
|
|
|
property int roomCapacity: 0
|
|
|
|
property int roomTimeout: 0
|
2023-02-15 11:54:35 +00:00
|
|
|
property bool enableFreeAssign: false
|
|
|
|
property bool observing: false
|
2022-12-18 04:52:52 +00:00
|
|
|
|
|
|
|
function loadConf() {
|
|
|
|
conf = JSON.parse(Backend.loadConf());
|
2023-02-27 02:23:48 +00:00
|
|
|
winX = conf.winX || 100;
|
|
|
|
winY = conf.winY || 100;
|
2023-02-15 11:54:35 +00:00
|
|
|
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";
|
2023-02-27 02:23:48 +00:00
|
|
|
language = conf.language || "zh_CN";
|
2023-03-14 06:12:13 +00:00
|
|
|
disabledPack = conf.disabledPack || [ "test_p_0" ];
|
|
|
|
preferedMode = conf.preferedMode || "aaa_role_mode";
|
|
|
|
preferedPlayerNum = conf.preferedPlayerNum || 2;
|
2023-03-20 06:53:56 +00:00
|
|
|
preferredGeneralNum = conf.preferredGeneralNum || 3;
|
|
|
|
ladyImg = conf.ladyImg || AppPath + "/image/lady";
|
2022-12-18 04:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function saveConf() {
|
2023-02-27 02:23:48 +00:00
|
|
|
conf.winX = realMainWin.x;
|
|
|
|
conf.winY = realMainWin.y;
|
2022-12-18 04:52:52 +00:00
|
|
|
conf.winWidth = realMainWin.width;
|
|
|
|
conf.winHeight = realMainWin.height;
|
|
|
|
conf.lastLoginServer = lastLoginServer;
|
|
|
|
conf.savedPassword = savedPassword;
|
2023-02-15 11:54:35 +00:00
|
|
|
conf.lobbyBg = lobbyBg;
|
|
|
|
conf.roomBg = roomBg;
|
|
|
|
conf.bgmFile = bgmFile;
|
2023-02-27 02:23:48 +00:00
|
|
|
conf.language = language;
|
2023-03-14 06:12:13 +00:00
|
|
|
conf.disabledPack = disabledPack;
|
|
|
|
conf.preferedMode = preferedMode;
|
|
|
|
conf.preferedPlayerNum = preferedPlayerNum;
|
2023-03-20 06:53:56 +00:00
|
|
|
conf.ladyImg = ladyImg;
|
|
|
|
conf.preferredGeneralNum = preferredGeneralNum;
|
2022-12-18 04:52:52 +00:00
|
|
|
|
|
|
|
Backend.saveConf(JSON.stringify(conf, undefined, 2));
|
|
|
|
}
|
2022-03-24 13:23:42 +00:00
|
|
|
}
|