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
|
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
|
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-02-27 10:23:48 +08:00
|
|
|
winX = conf.winX || 100;
|
|
|
|
winY = conf.winY || 100;
|
2023-02-15 19:54:35 +08: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 10:23:48 +08:00
|
|
|
language = conf.language || "zh_CN";
|
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;
|
2022-12-18 12:52:52 +08:00
|
|
|
|
|
|
|
Backend.saveConf(JSON.stringify(conf, undefined, 2));
|
|
|
|
}
|
2022-03-24 21:23:42 +08:00
|
|
|
}
|