فهرست منبع

Store settings

nordsoft 3 سال پیش
والد
کامیت
aac859a030
3فایلهای تغییر یافته به همراه23 افزوده شده و 2 حذف شده
  1. 13 1
      config/schemas/settings.json
  2. 9 0
      launcher/lobby/lobby_moc.cpp
  3. 1 1
      launcher/lobby/lobby_moc.h

+ 13 - 1
config/schemas/settings.json

@@ -380,7 +380,7 @@
 			"type" : "object",
 			"default": {},
 			"additionalProperties" : false,
-			"required" : [ "repositoryURL", "enableInstalledMods", "extraResolutionsModPath", "autoCheckRepositories", "updateOnStartup", "updateConfigUrl" ],
+			"required" : [ "repositoryURL", "enableInstalledMods", "extraResolutionsModPath", "autoCheckRepositories", "updateOnStartup", "updateConfigUrl", "lobbyUrl", "lobbyPort", "lobbyUsername" ],
 			"properties" : {
 				"repositoryURL" : {
 					"type" : "array",
@@ -410,6 +410,18 @@
 				"updateConfigUrl" : {
 					"type" : "string",
 					"default" : "https://raw.githubusercontent.com/vcmi/vcmi-updates/master/vcmi-updates.json"
+				},
+				"lobbyUrl" : {
+					"type" : "string",
+					"default" : "127.0.0.1"
+				},
+				"lobbyPort" : {
+					"type" : "number",
+					"default" : 5002
+				},
+				"lobbyUsername" : {
+					"type" : "string",
+					"default" : ""
 				}
 			}
 		}

+ 9 - 0
launcher/lobby/lobby_moc.cpp

@@ -1,6 +1,9 @@
 #include "lobby_moc.h"
 #include "ui_lobby_moc.h"
 #include "../lib/GameConstants.h"
+#include "../jsonutils.h"
+#include "../../lib/CConfigHandler.h"
+//#include "../../lib/VCMIDirs.h"
 
 SocketLobby::SocketLobby(QObject *parent) :
 	QObject(parent)
@@ -253,6 +256,12 @@ void Lobby::on_connectButton_toggled(bool checked)
 	if(checked)
 	{
 		username = ui->userEdit->text();
+
+		Settings node = settings.write["launcher"];
+		node["lobbyUrl"].String() = ui->hostEdit->text().toStdString();
+		node["lobbyPort"].Integer() = ui->portEdit->text().toInt();
+		node["lobbyUsername"].String() = username.toStdString();
+
 		socketLobby.connectServer(ui->hostEdit->text(), ui->portEdit->text().toInt(), username);
 	}
 	else

+ 1 - 1
launcher/lobby/lobby_moc.h

@@ -36,7 +36,7 @@ const QMap<ProtocolConsts, QString> ProtocolStrings
 	{SESSIONS, "SESSIONS"}, //amount:session_name:joined_players:total_players:is_protected
 	{JOINED, "JOIN"}, //session_name:username
 	{KICKED, "KICK"}, //session_name:username
-	{START, "START"}, //session_name
+	{START, "START"}, //session_name:uuid
 	{STATUS, "STATUS"}, //joined_players:player_name:is_ready
 	{ERROR, "ERROR"},
 	{CHAT, "MSG"} //username:message