Browse Source

update 9/10 22

XKSYU2021 1 month ago
parent
commit
384cb51602
2 changed files with 161 additions and 0 deletions
  1. 2 0
      Ui for BDS/Config.h
  2. 159 0
      Ui for BDS/config.cpp

+ 2 - 0
Ui for BDS/Config.h

@@ -2,6 +2,8 @@
 
 void Submit(HWND hWnd1);
 
+extern HWND hGamemode, hDifficulty, hPermission;
+
 #define CONF_ServerName 51010
 #define CONF_GameMode 51020
 #define CONF_ForceGameMode 51021

+ 159 - 0
Ui for BDS/config.cpp

@@ -133,6 +133,160 @@ static void ConfigSet_CheckDIY_AntiCheat(std::vector<std::string>& configText, H
 	}
 }
 
+static void ConfigSet_ComboDIY_Gamemode(std::vector<std::string>& configText, HWND hWnd1)
+{
+	int selected = SendMessage(hGamemode, CB_GETCURSEL, 0, 0);
+	std::string target;
+	switch (selected)
+	{
+	case 0:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+					l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 1:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 2:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 3:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	}
+}
+static void ConfigSet_ComboDIY_Difficuty(std::vector<std::string>& configText, HWND hWnd1)
+{
+	int selected = SendMessage(hDifficulty, CB_GETCURSEL, 0, 0);
+	std::string target;
+	switch (selected)
+	{
+	case 0:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 1:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 2:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 3:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 4:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	}
+}
+static void ConfigSet_ComboDIY_Level(std::vector<std::string>& configText, HWND hWnd1)
+{
+	int selected = SendMessage(hPermission, CB_GETCURSEL, 0, 0);
+	std::string target;
+	switch (selected)
+	{
+	case 0:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 1:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 2:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	case 3:
+		for (auto& l : configText)
+		{
+			if (l.find(target) != std::string::npos)
+			{
+				l = target + "=";
+				return;
+			}
+		}
+		break;
+	}
+}
 
 //whole
 void Submit(HWND hWnd1)
@@ -171,6 +325,11 @@ void Submit(HWND hWnd1)
 		"chat-restriction", CONF_Mute, CONF_Mute_NOEDIT);
 	ConfigSet_CheckDIY_AntiCheat(configText, hWnd1);
 
+	//ComboDIY
+	ConfigSet_ComboDIY_Gamemode(configText, hWnd1);
+	ConfigSet_ComboDIY_Difficuty(configText, hWnd1);
+	ConfigSet_ComboDIY_Level(configText, hWnd1);
+
 	//submit
 	ConfigWrite(configText);
 	MessageBox(hWnd,