XKSYU2021 2 месяцев назад
Родитель
Сommit
52293f017a
3 измененных файлов с 57 добавлено и 46 удалено
  1. 2 4
      Ui for BDS/Config.h
  2. 22 9
      Ui for BDS/config.cpp
  3. 33 33
      Ui for BDS/configEditProc.cpp

+ 2 - 4
Ui for BDS/Config.h

@@ -4,7 +4,7 @@ void Submit(HWND hWnd1);
 
 #define CONF_ServerName 51010
 #define CONF_GameMode 51020
-#define CONF_ForeceGameMode 51021
+#define CONF_ForceGameMode 51021
 #define CONF_GameDifficuty 51030
 #define CONF_Cheat 51040
 #define CONF_Cheat_NOEDIT 51041
@@ -28,9 +28,7 @@ void Submit(HWND hWnd1);
 #define CONF_Mute_NOEDIT 51151
 
 #define CONF_AntiCheat_NOEDIT 51161
-#define CONF_AntiCheat_OFF 51162
-#define CONF_AntiCheat_ON 51163
-#define CONF_AntiCheat_STRICT 51164
+#define CONF_AntiCheat 51162
 
 #define CONF_OPENCONFIG 51170
 #define CONF_OK 51180

+ 22 - 9
Ui for BDS/config.cpp

@@ -105,17 +105,29 @@ static void ConfigSet_CheckDIY_AntiCheat(std::vector<std::string>& configText, H
 {
 	if (IsDlgButtonChecked(hWnd1, CONF_AntiCheat_NOEDIT) != BST_CHECKED)
 	{
+		std::string targetA = "server-authoritative-movement-strict", 
+			targetB = "server-authoritative-dismount-strict",
+			targetC = "server-authoritative-entity-interactions-strict";
 		for (auto& l : configText)
 		{
-			char targetA, targetB, targetC, targetD;
+			bool check = (IsDlgButtonChecked(hWnd1, CONF_AntiCheat) == BST_CHECKED);
 			if (l.find(targetA) != std::string::npos)
 			{
-				if (IsDlgButtonChecked(hWnd1, CONF_AntiCheat_OFF) == BST_CHECKED)
-					l = targetA + "=Disabled";
-				else if (IsDlgButtonChecked(hWnd1, CONF_AntiCheat_ON) == BST_CHECKED)
-					l = targetA + "=Disabled";
-				else l = targetA + "=None";
-				return;
+				if(check)
+					l = targetA + "=true";
+				else l = targetA + "=false";
+			}
+			if (l.find(targetB) != std::string::npos)
+			{
+				if (check)
+					l = targetB + "=true";
+				else l = targetB + "=false";
+			}
+			if (l.find(targetC) != std::string::npos)
+			{
+				if (check)
+					l = targetC + "=true";
+				else l = targetC + "=false";
 			}
 		}
 	}
@@ -129,7 +141,7 @@ void Submit(HWND hWnd1)
 
 	//EDIT
 	ConfigSet_EDIT(configText, hWnd1, 
-		"server-name",  CONF_ServerName);
+		"server-name", CONF_ServerName);
 
 	ConfigSet_EDIT(configText, hWnd1,
 		"level-name", CONF_LevelName);
@@ -157,8 +169,9 @@ void Submit(HWND hWnd1)
 	//CheckDIY
 	ConfigSet_CheckDIY_Mute(configText, hWnd1,
 		"chat-restriction", CONF_Mute, CONF_Mute_NOEDIT);
+	ConfigSet_CheckDIY_AntiCheat(configText, hWnd1);
 
-
+	//submit
 	ConfigWrite(configText);
 	MessageBox(hWnd,
 		L"Òѳ¢ÊÔÌá½»", TITLE,

+ 33 - 33
Ui for BDS/configEditProc.cpp

@@ -58,9 +58,9 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
         SendMessage(hGamemode, CB_SETCURSEL, 0, 0);
         HWND hForceGM = CreateWindow(
             L"BUTTON", L"强制游戏模式",
-            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            WS_CHILD | BS_AUTOCHECKBOX,
             320, 145, 150, 40,
-            hWnd1, (HMENU)CONF_ForeceGameMode,
+            hWnd1, (HMENU)CONF_ForceGameMode,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
         );
         HWND hLabel_3 = CreateWindow(
@@ -175,7 +175,7 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
             L"BUTTON", L"在线模式",
             WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
             20, 650, 100, 40,
-            hWnd1, (HMENU)CONF_OnlineMod,
+            hWnd1, (HMENU)CONF_OnlineMode,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
         );
         HWND hLAN = CreateWindow(
@@ -187,7 +187,7 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
         );
         HWND hWhiteList = CreateWindow(
             L"BUTTON", L"打开原生白名单",
-            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            WS_CHILD | BS_AUTOCHECKBOX,
             320, 650, 200, 40,
             hWnd1, (HMENU)CONF_Whitelist,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
@@ -196,7 +196,7 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
             L"BUTTON", L"不修改上项",
             WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
             20, 700, 130, 40,
-            hWnd1, (HMENU)CONF_OnlineMod_NOEDIT,
+            hWnd1, (HMENU)CONF_OnlineMode_NOEDIT,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
         );
         HWND hLAN_1 = CreateWindow(
@@ -208,7 +208,7 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
         );
         HWND hWiteList_1 = CreateWindow(
             L"BUTTON", L"不修改上项",
-            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            WS_CHILD | BS_AUTOCHECKBOX,
             320, 700, 130, 40,
             hWnd1, (HMENU)CONF_Whitelist_NOEDIT,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
@@ -272,39 +272,18 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
 
         HWND hCompare = CreateWindow(
             L"BUTTON", L"服务端校验",
-            WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
-            20, 940, 440, 100,
-            hWnd1, NULL,
+            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            20, 930, 130, 40,
+            hWnd1, (HMENU)CONF_AntiCheat,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
         );
         HWND hCompare_1 = CreateWindow(
-            L"BUTTON", L"不修改",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | WS_GROUP,
-            40, 980, 90, 40,
+            L"BUTTON", L"不修改上项",
+            WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
+            20, 980, 130, 40,
             hWnd1, (HMENU)CONF_AntiCheat_NOEDIT,
             (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
         );
-        HWND hCompare_2 = CreateWindow(
-            L"BUTTON", L"关闭",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
-            150, 980, 80, 40,
-            hWnd1, (HMENU)CONF_AntiCheat_OFF,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        HWND hCompare_3 = CreateWindow(
-            L"BUTTON", L"启用",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
-            250, 980, 80, 40,
-            hWnd1, (HMENU)CONF_AntiCheat_ON,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
-        HWND hCompare_4 = CreateWindow(
-            L"BUTTON", L"最严格",
-            WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON,
-            350, 980, 80, 40,
-            hWnd1, (HMENU)CONF_AntiCheat_STRICT,
-            (HINSTANCE)GetWindowLongPtr(hWnd1, GWLP_HINSTANCE), NULL
-        );
         SendMessage(hCompare_1, BM_SETCHECK, BST_CHECKED, 0);
 
 
@@ -329,6 +308,27 @@ LRESULT CALLBACK ConfProc(HWND hWnd1, UINT msg, WPARAM wParam, LPARAM lParam)
     case WM_COMMAND:
     {
         WORD wmId = LOWORD(wParam);
+        WORD wmEvent = HIWORD(wParam);
+
+        if (wmEvent == CBN_SELCHANGE && wmId == CONF_GameMode)
+        {
+            int selected = SendMessage(GetDlgItem(hWnd1, CONF_GameMode), CB_GETCURSEL, 0, 0);
+            ShowWindow(GetDlgItem(hWnd1, CONF_ForceGameMode), SW_HIDE);
+            if (selected != 0)
+                ShowWindow(GetDlgItem(hWnd1, CONF_ForceGameMode), SW_SHOW);
+        }
+        if (wmEvent == BN_CLICKED && wmId == CONF_OnlineMode)
+        {
+            ShowWindow(GetDlgItem(hWnd1, CONF_Whitelist), SW_HIDE);
+            ShowWindow(GetDlgItem(hWnd1, CONF_Whitelist_NOEDIT), SW_HIDE);
+            if (IsDlgButtonChecked(hWnd1, CONF_OnlineMode) == BST_CHECKED)
+            {
+                ShowWindow(GetDlgItem(hWnd1, CONF_Whitelist), SW_SHOW);
+                ShowWindow(GetDlgItem(hWnd1, CONF_Whitelist_NOEDIT), SW_SHOW);
+            }
+        }
+
+
         switch (wmId)
         {
         case CONF_OK: