bool g_ShowDisclaimer = true;

struct LVColors
{
	ImVec4 brown = ImVec4(0.40f, 0.29f, 0.12f, 1.00f);
	ImVec4 beige = ImVec4(0.96f, 0.93f, 0.85f, 1.00f);
	ImVec4 gold = ImVec4(0.83f, 0.69f, 0.22f, 1.00f);
	ImVec4 dark_brown = ImVec4(0.25f, 0.18f, 0.08f, 1.00f);
	ImVec4 cream = ImVec4(0.98f, 0.96f, 0.90f, 1.00f);
	ImVec4 light_gold = ImVec4(0.90f, 0.80f, 0.40f, 1.00f);
};

struct LVLayout
{
	float window_padding = 20.0f;
	float child_rounding = 8.0f;
	float frame_rounding = 6.0f;
	float tab_rounding = 12.0f;
	float button_rounding = 6.0f;
	ImVec2 window_size = ImVec2(850, 550);
	ImVec2 child_size_small = ImVec2(280, 220);
	ImVec2 child_size_medium = ImVec2(280, 220);
	ImVec2 child_size_large = ImVec2(280, 280);
	ImVec2 button_size_wide = ImVec2(260, 40);
	ImVec2 button_size_normal = ImVec2(120, 36);
	float item_spacing = 10.0f;
	float group_spacing = 10.0f;
};

static LVLayout lv_layout;
static LVColors lv_colors;

struct LuxuryLayout
{
	ImVec2 window_size = ImVec2(920, 640);
	float window_rounding = 16.0f;
	float child_rounding = 12.0f;
	float frame_rounding = 8.0f;
	float tab_rounding = 20.0f;
	float button_rounding = 10.0f;
	float window_padding = 10.0f;
	float item_spacing = 10.0f;
	float group_spacing = 10.0f;
	ImVec2 child_large = ImVec2(420, 220);
	ImVec2 child_medium = ImVec2(420, 220);
	ImVec2 child_small = ImVec2(420, 220);
	float border_thickness = 2.5f;
	float shadow_blur = 8.0f;
};

static LuxuryLayout luxury_layout;
struct GrenadeTrajectory
{
	std::vector<FVector> pathPoints;
	float startTime;
	float duration;
	bool isActive;
	ImColor trailColor;
	uintptr_t grenadeAddr;
	float lastUpdateTime; // 添加这一行
};
struct LVSuspensionCounter
{
	float animationProgress = 0.0f;
	float pulseEffect = 0.0f;
	float hoverEffect = 0.0f;
	float lastUpdateTime = 0.0f;
	int prevPlayerCount = 0;
	int prevBotCount = 0;
	bool isAnimating = false;
	bool isHovering = false;
};

static LVSuspensionCounter suspensionCounter;

void DrawLuxuryFrame(ImDrawList *draw, ImVec2 pos, ImVec2 size, ImColor base_color, float rounding)
{
	draw->AddRectFilled(pos, pos + size, base_color, rounding);
	draw->AddRect(pos, pos + size, ImColor(lv_colors.gold), rounding, 0, luxury_layout.border_thickness * DPI);
	draw->AddRect(pos + ImVec2(2 * DPI, 2 * DPI), pos + size - ImVec2(2 * DPI, 2 * DPI),
				  ImColor(lv_colors.beige), rounding - 2 * DPI, 0, 1.0f * DPI);

	float corner_size = 8.0f * DPI;
	draw->AddRectFilled(pos, pos + ImVec2(corner_size, corner_size), ImColor(lv_colors.gold));
	draw->AddRectFilled(pos + ImVec2(size.x - corner_size, 0),
						pos + ImVec2(size.x, corner_size), ImColor(lv_colors.gold));
	draw->AddRectFilled(pos + ImVec2(0, size.y - corner_size),
						pos + ImVec2(corner_size, size.y), ImColor(lv_colors.gold));
	draw->AddRectFilled(pos + ImVec2(size.x - corner_size, size.y - corner_size),
						pos + size, ImColor(lv_colors.gold));
}

void DrawLuxuryButton(ImDrawList *draw, ImVec2 pos, ImVec2 size, const char *label, bool active)
{
	if (active)
	{
		draw->AddRectFilled(pos, pos + size, ImColor(lv_colors.gold), luxury_layout.button_rounding);
		draw->AddRect(pos, pos + size, ImColor(lv_colors.beige), luxury_layout.button_rounding, 0, 2.0f);

		ImVec2 text_size = ImGui::CalcTextSize(label);
		ImVec2 text_pos(pos.x + (size.x - text_size.x) * 0.5f,
						pos.y + (size.y - text_size.y) * 0.5f);
		draw->AddText(text_pos, ImColor(lv_colors.dark_brown), label);
	}
	else
	{
		draw->AddRectFilled(pos, pos + size, ImColor(lv_colors.dark_brown), luxury_layout.button_rounding);
		draw->AddRect(pos, pos + size, ImColor(lv_colors.brown), luxury_layout.button_rounding, 0, 1.5f);

		ImVec2 text_size = ImGui::CalcTextSize(label);
		ImVec2 text_pos(pos.x + (size.x - text_size.x) * 0.5f,
						pos.y + (size.y - text_size.y) * 0.5f);
		draw->AddText(text_pos, ImColor(lv_colors.gold), label);
	}
}

bool g_UserAgreed = false;
void ShowDisclaimerPopup()
{
	// if (!g_ShowDisclaimer)
	// 	return;

	ImVec2 screenSize(displayInfo.width, displayInfo.height);
	ImVec2 windowSize(650 * DPI, 450 * DPI);

	ImVec2 windowPos((screenSize.x - windowSize.x) * 0.5f, (screenSize.y - windowSize.y) * 0.5f);

	ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always);
	ImGui::SetNextWindowSize(windowSize, ImGuiCond_Always);

	ImGuiWindowFlags flags = ImGuiWindowFlags_NoResize |
							 ImGuiWindowFlags_NoMove |
							 ImGuiWindowFlags_NoCollapse |
							 ImGuiWindowFlags_NoSavedSettings |
							 ImGuiWindowFlags_NoTitleBar;

	ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(25 * DPI, 25 * DPI));
	ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 16.0f * DPI);
	ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 8.0f * DPI);
	ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(15 * DPI, 10 * DPI));

	ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 0.98f));
	ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 1.0f));
	ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, 1.0f));
	ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.15f, 0.12f, 0.08f, 0.9f));

	if (ImGui::Begin("DisclaimerWindow", &g_ShowDisclaimer, flags))
	{
		ImDrawList *draw = ImGui::GetWindowDrawList();
		ImVec2 windowPos = ImGui::GetWindowPos();
		ImVec2 windowSize = ImGui::GetWindowSize();

		DrawLuxuryFrame(draw, windowPos, windowSize, ImColor(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 0.98f), 16.0f * DPI);

		float titleBarHeight = 50 * DPI;
		draw->AddRectFilled(windowPos,
							ImVec2(windowPos.x + windowSize.x, windowPos.y + titleBarHeight),
							ImColor(lv_colors.gold), 16.0f * DPI, ImDrawFlags_RoundCornersTop);

		float cornerSize = 8.0f * DPI;
		draw->AddRectFilled(windowPos, windowPos + ImVec2(cornerSize, cornerSize), ImColor(lv_colors.beige));
		draw->AddRectFilled(ImVec2(windowPos.x + windowSize.x - cornerSize, windowPos.y),
							windowPos + ImVec2(windowSize.x, cornerSize), ImColor(lv_colors.beige));

		const char *titleText = "LOUIS VUITTON - 免责声明";
		ImVec2 titleSize = ImGui::CalcTextSize(titleText);
		ImVec2 titlePos(windowPos.x + (windowSize.x - titleSize.x) * 0.5f,
						windowPos.y + (titleBarHeight - titleSize.y) * 0.5f);

		draw->AddText(ImVec2(titlePos.x + 5, titlePos.y + 5),
					  ImColor(0.0f, 0.0f, 0.0f, 0.3f), titleText);
		draw->AddText(YuanerSet->inter_semibold_font, 20 * DPI, titlePos,
					  ImColor(lv_colors.dark_brown), titleText);

		ImGui::SetCursorPosY(titleBarHeight + 15 * DPI);

		ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.09f, 0.06f, 0.8f));
		ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(lv_colors.brown.x, lv_colors.brown.y, lv_colors.brown.z, 1.0f));
		ImGui::BeginChild("DisclaimerContent", ImVec2(0, 300 * DPI), true);
		{
			ImGui::PushTextWrapPos();

			ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, 1.0f));

			ImGui::TextWrapped("• 本程序为LOUIS VUITTON内核，仅供学习交流参考");
			ImGui::TextWrapped("• 下载后请于24小时内删除，严禁用于商业用途");
			ImGui::Spacing();

			ImGui::TextWrapped("用户使用此程序需确认并接受以下全部风险：");
			ImGui::Spacing();

			ImGui::TextWrapped("• 可能违反相关软件的服务条款");
			ImGui::TextWrapped("• 可能导致账号封禁或其他处罚");
			ImGui::TextWrapped("• 开发者不承担任何因使用造成的损失");
			ImGui::TextWrapped("• 用户需自行承担所有法律和安全风险");
			ImGui::TextWrapped("• 严禁将本程序用于非法用途");
			ImGui::Spacing();
			if (gui->button("连接网络雷达", ImVec2(150 * DPI, 35 * DPI)))
			{
				// TODO: 接入网络雷达逻辑
			}
			ImGui::Text("状态：未开启网络雷达");
			ImGui::Text("连接状态：未初始化");
			ImGui::Text("房间号：-");
			if (gui->button("复制房间号及地址", ImVec2(150 * DPI, 35 * DPI)))
			{
				ImGui::SetClipboardText("房间号:- 地址:-");
			}

			ImGui::PopStyleColor();
			ImGui::PopTextWrapPos();
		}
		ImGui::EndChild();
		ImGui::PopStyleColor(2);

		float buttonWidth = 160 * DPI;
		float buttonHeight = 45 * DPI;
		float totalWidth = buttonWidth * 2 + 25 * DPI;
		ImGui::SetCursorPosX((windowSize.x - totalWidth) * 0.5f);
		ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 15 * DPI);

		ImGui::BeginGroup();

		ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 1.0f));
		ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(lv_colors.light_gold.x, lv_colors.light_gold.y, lv_colors.light_gold.z, 1.0f));
		ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(lv_colors.gold.x * 0.8f, lv_colors.gold.y * 0.8f, lv_colors.gold.z * 0.8f, 1.0f));
		ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 1.0f));

		if (ImGui::Button("我已知悉并同意", ImVec2(buttonWidth, buttonHeight)))
		{
			g_UserAgreed = true;
			g_ShowDisclaimer = false;
		}
		ImGui::PopStyleColor(4);

		ImGui::SameLine();

		ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 1.0f));
		ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(lv_colors.brown.x, lv_colors.brown.y, lv_colors.brown.z, 1.0f));
		ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(lv_colors.dark_brown.x * 0.8f, lv_colors.dark_brown.y * 0.8f, lv_colors.dark_brown.z * 0.8f, 1.0f));
		ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 1.0f));

		if (ImGui::Button("我不同意", ImVec2(buttonWidth, buttonHeight)))
		{
			Touch_Close();
			exit(0);
		}
		ImGui::PopStyleColor(4);

		ImGui::EndGroup();

		ImGui::SetCursorPosX(30 * DPI);
		ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10 * DPI);
		ImGui::TextColored(ImVec4(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 1.0f),
						   "注意：您必须同意以上条款才能使用LOUIS VUITTON公益内核");
	}
	ImGui::End();

	ImGui::PopStyleColor(4);
	ImGui::PopStyleVar(4);
}
bool aimbotInitialized = false;

bool show_aim_advanced_settings = false;
char aim_advanced_submenu_title[64] = "自瞄高级设置";
int aim_advanced_parent_tab = -1;

bool show_visual_advanced_settings = false;
char visual_advanced_submenu_title[64] = "绘图高级设置";
int visual_advanced_parent_tab = -1;

void DrawLuxuryVisualAdvancedSettings(float child_width)
{
	ImGui::BeginGroup();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("绘图高级设置头部", ImVec2(child_width * 2 + luxury_layout.item_spacing * DPI, 60 * DPI), true);
		{
			ImDrawList *draw = ImGui::GetWindowDrawList();
			ImVec2 pos = ImGui::GetCursorScreenPos();
			ImVec2 size = ImGui::GetWindowSize();

			draw->AddRectFilled(pos, pos + size, ImColor(lv_colors.dark_brown), luxury_layout.child_rounding);

			float buttonWidth = 120 * DPI;
			float buttonHeight = 35 * DPI;
			ImVec2 buttonPos = ImVec2(pos.x + 20 * DPI, pos.y + (size.y - buttonHeight) * 0.5f);

			bool hovered = ImGui::IsMouseHoveringRect(buttonPos, buttonPos + ImVec2(buttonWidth, buttonHeight));
			bool clicked = hovered && ImGui::IsMouseClicked(0);

			DrawLuxuryButton(draw, buttonPos, ImVec2(buttonWidth, buttonHeight), "返回上级", hovered);

			ImVec2 textSize = ImGui::CalcTextSize(visual_advanced_submenu_title);
			ImVec2 textPos = ImVec2(
				pos.x + size.x * 0.5f - textSize.x * 0.5f,
				pos.y + (size.y - textSize.y) * 0.5f);

			draw->AddText(textPos, ImColor(lv_colors.gold), visual_advanced_submenu_title);

			if (clicked)
			{
				show_visual_advanced_settings = false;
				YuanerSet->selection_count = visual_advanced_parent_tab;
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::Spacing();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("视觉高级设置", ImVec2(child_width, 0), true);
		{
			ImGui::Spacing();

			// 手雷轨迹设置
			ImGui::TextColored(ImColor(lv_colors.gold), "手雷轨迹设置");
			ImGui::Separator();

			// gui->checkbox("显示手雷轨迹", &globalConfig.ShowGrenadeTrajectory, 字体加粗);
			// gui->checkbox("显示人数统计", &globalConfig.ShowPlayerCounter, 字体加粗);
			// if (globalConfig.ShowPlayerCounter)
			// {
			// 	const char *counterStyles[] = {"奢华悬浮", "极简悬浮"};
			// 	gui->dropdown("统计样式", &globalConfig.PlayerCounterStyle, counterStyles, 2);
			// 	gui->slider_float("透明度", &globalConfig.CounterOpacity, 0.1f, 1.0f, "%.1f");
			// 	gui->checkbox("自动隐藏", &globalConfig.CounterAutoHide, 字体加粗);
			//
			// 	readText(ImColor(gui->get_clr(clr->TextColored)),
			// 			 ImColor(gui->get_clr(clr->Texticon)),
			// 			 YuanerSet->Texticon,
			// 			 "悬浮在屏幕顶部中央，不遮挡游戏内容");
			// }
		}
		ImGui::EndChild();

		ImGui::SameLine();

		ImGui::BeginChild("颜色与血条设置", ImVec2(child_width, 0), true);
		{
			ImGui::Spacing();

			//gui->checkbox("固定血条大小", &globalConfig.FixedHealthBarSize, 字体加粗);
			// if (globalConfig.FixedHealthBarSize)
			// {
			// 	gui->slider_float("血条宽度", &globalConfig.HealthBarWidth, 60.0f, 200.0f, "%.0f");
			// 	gui->slider_float("血条高度", &globalConfig.HealthBarHeight, 4.0f, 15.0f, "%.0f");
			// 	gui->slider_float("距离缩放", &globalConfig.HealthBarDistanceScale, 0.0f, 1.0f, "%.1f");
			// 	readText(ImColor(gui->get_clr(clr->TextColored)),
			// 			 ImColor(gui->get_clr(clr->Texticon)),
			// 			 YuanerSet->Texticon,
			// 			 "0=完全固定，1=完全随距离缩放");
			// }

			/*  gui->checkbox("血条动画效果", &globalConfig.HealthBarAnimation, 字体加粗);
			  if (globalConfig.HealthBarAnimation) {
				  gui->slider_float("动画速度", &globalConfig.HealthBarAnimSpeed, 0.5f, 3.0f, "%.1f");
			  }*/
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::EndGroup();
}

void DrawLuxuryAimAdvancedSettings(float child_width)
{
	ImGui::BeginGroup();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("自瞄高级设置头部", ImVec2(child_width * 2 + luxury_layout.item_spacing * DPI, 60 * DPI), true);
		{
			ImDrawList *draw = ImGui::GetWindowDrawList();
			ImVec2 pos = ImGui::GetCursorScreenPos();
			ImVec2 size = ImGui::GetWindowSize();

			draw->AddRectFilled(pos, pos + size, ImColor(lv_colors.dark_brown), luxury_layout.child_rounding);

			float buttonWidth = 120 * DPI;
			float buttonHeight = 35 * DPI;
			ImVec2 buttonPos = ImVec2(pos.x + 20 * DPI, pos.y + (size.y - buttonHeight) * 0.5f);

			bool hovered = ImGui::IsMouseHoveringRect(buttonPos, buttonPos + ImVec2(buttonWidth, buttonHeight));
			bool clicked = hovered && ImGui::IsMouseClicked(0);

			DrawLuxuryButton(draw, buttonPos, ImVec2(buttonWidth, buttonHeight), "返回上级", hovered);

			ImVec2 textSize = ImGui::CalcTextSize(aim_advanced_submenu_title);
			ImVec2 textPos = ImVec2(
				pos.x + size.x * 0.5f - textSize.x * 0.5f,
				pos.y + (size.y - textSize.y) * 0.5f);

			draw->AddText(textPos, ImColor(lv_colors.gold), aim_advanced_submenu_title);

			if (clicked)
			{
				show_aim_advanced_settings = false;
				YuanerSet->selection_count = aim_advanced_parent_tab;
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::Spacing();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("自瞄算法高级设置", ImVec2(child_width, 0), true);
		{

			gui->slider_float("腰射距离限制", &globalConfig.HipShootingDislimit, 0.0f, 600.0f, "%.1f");
			gui->slider_float("开镜距离限制", &globalConfig.ScopeDislimit, 0.0f, 600.0f, "%.1f");
			gui->checkbox("模拟手搓", &globalConfig.IsJitter, 字体加粗);
			if (globalConfig.IsJitter)
				gui->slider_float("偏差因子", &globalConfig.Jitter, 1.0f, 2.0f, "%.1f");

			Revise &revise = globalConfig.map[WeaponTypeNew];
			gui->slider_float("站立的压枪", &revise.Stand, 1.0f, 0.0f, "%.1f");
			gui->slider_float("蹲下的压枪", &revise.Crouch, 1.0f, 0.0f, "%.1f");
			gui->slider_float("趴下的压枪", &revise.LieDown, 1.0f, 0.0f, "%.1f");
		}
		ImGui::EndChild();

		ImGui::SameLine();

		ImGui::BeginChild("高级功能设置", ImVec2(child_width, 0), true);
		{
			ImGui::Spacing();

			readText(ImColor(gui->get_clr(clr->TextColored)),
					 ImColor(gui->get_clr(clr->Texticon)),
					 YuanerSet->Texticon,
					 "说明:自瞄速度(越低越快)");
			gui->slider_int("触控采样率", &globalConfig.Touchmode, 3000, 30000, "%.1d ms");
			readText(ImColor(gui->get_clr(clr->TextColored)),
					 ImColor(gui->get_clr(clr->Texticon)),
					 YuanerSet->Texticon,
					 "说明:高级参数调整");
			gui->slider_float("自瞄加速度", &globalConfig.AimSpeed, 1.0f, 10.0f, "%.1f");
			gui->slider_float("压枪强度", &globalConfig.Ya, 1.0, 2.0, "%.1f");
			gui->slider_float("自瞄速度(水平)", &globalConfig.AimSpeedX, 0.0f, 30.0f, "%.1f");
			gui->slider_float("自瞄速度(垂直)", &globalConfig.AimSpeedY, 0.0f, 30.0f, "%.1f");
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::EndGroup();
}

// void UpdateUISmoothAnimation()
// {
// 	if (!animating)
// 		return;
//
// 	float animation_speed = 2.5f;
// 	float delta = animation_speed * ImGui::GetIO().DeltaTime;
//
// 	if (ui_visible)
// 	{
// 		animation_progress += delta;
// 		if (animation_progress >= 1.0f)
// 		{
// 			animation_progress = 1.0f;
// 			animating = false;
// 		}
// 	}
// 	else
// 	{
// 		animation_progress -= delta;
// 		if (animation_progress <= 0.0f)
// 		{
// 			animation_progress = 0.0f;
// 			animating = false;
// 		}
// 	}
//
// 	auto EaseOutBack = [](float x)
// 	{
// 		float c1 = 1.70158f;
// 		float c3 = c1 + 1.0f;
// 		return 1.0f + c3 * powf(x - 1.0f, 3.0f) + c1 * powf(x - 1.0f, 2.0f);
// 	};
//
// 	float eased_progress = EaseOutBack(animation_progress);
//
// 	float scale_start = 0.3f;
// 	float scale_end = 1.0f;
// 	float current_scale = scale_start + (scale_end - scale_start) * eased_progress;
//
// 	window_current_size.x = window_target_size.x * current_scale;
// 	window_current_size.y = window_target_size.y * current_scale;
//
// 	window_current_pos.x = displayInfo.width / 2 - window_current_size.x / 2;
// 	window_current_pos.y = displayInfo.height / 2 - window_current_size.y / 2;
// }

bool animating;
bool ui_visible = false;
float animation_progress = 0.0f;
ImVec2 window_target_size;
ImVec2 window_current_size;
ImVec2 window_target_pos;
ImVec2 window_current_pos;

static int prev_selection = 0;
static float tab_slide_animation = 0.0f;
static ImVec2 tab_highlight_pos = ImVec2(0, 0);
static ImVec2 tab_highlight_size = ImVec2(0, 0);
static bool tab_animating = false;

void DrawLuxuryTabSystem(ImDrawList *draw, ImVec2 pos, ImVec2 size, float alpha)
{
	const char *tab_names[] = {"视觉设置", "自瞄控制", "物资显示", "系统设置"};

	float tab_width = 180.0f * DPI;
	float tab_height = 50.0f * DPI;
	float tab_spacing = 15.0f * DPI;

	float total_width = (tab_width * 4) + (tab_spacing * 3);
	float start_x = pos.x + (size.x - total_width) * 0.5f;
	float tab_y = pos.y + size.y - 80.0f * DPI;

	if (tab_animating)
	{
		tab_slide_animation += ImGui::GetIO().DeltaTime * 12.0f;
		if (tab_slide_animation >= 1.0f)
		{
			tab_slide_animation = 1.0f;
			tab_animating = false;
		}
	}

	ImVec2 target_pos = ImVec2(start_x + YuanerSet->selection_count * (tab_width + tab_spacing), tab_y);
	ImVec2 target_size = ImVec2(tab_width, tab_height);

	if (!tab_animating && tab_highlight_size.x == 0)
	{
		tab_highlight_pos = target_pos;
		tab_highlight_size = target_size;
	}

	if (tab_animating)
	{
		auto easeOutCubic = [](float x)
		{
			return 1.0f - powf(1.0f - x, 3.0f);
		};

		float eased = easeOutCubic(tab_slide_animation);
		tab_highlight_pos.x = tab_highlight_pos.x + (target_pos.x - tab_highlight_pos.x) * eased;
		tab_highlight_pos.y = tab_highlight_pos.y + (target_pos.y - tab_highlight_pos.y) * eased;
		tab_highlight_size.x = tab_highlight_size.x + (target_size.x - tab_highlight_size.x) * eased;
		tab_highlight_size.y = tab_highlight_size.y + (target_size.y - tab_highlight_size.y) * eased;
	}
	else
	{
		tab_highlight_pos = target_pos;
		tab_highlight_size = target_size;
	}

	ImColor bg_color = ImColor(0.08f, 0.07f, 0.06f, 0.95f * alpha);
	draw->AddRectFilled(
		ImVec2(start_x - 20.0f * DPI, tab_y - 10.0f * DPI),
		ImVec2(start_x + total_width + 20.0f * DPI, tab_y + tab_height + 10.0f * DPI),
		bg_color, 25.0f * DPI);

	draw->AddRect(
		ImVec2(start_x - 20.0f * DPI, tab_y - 10.0f * DPI),
		ImVec2(start_x + total_width + 20.0f * DPI, tab_y + tab_height + 10.0f * DPI),
		ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 0.8f * alpha),
		25.0f * DPI, 0, 2.0f * DPI);

	{
		draw->AddRectFilled(tab_highlight_pos, tab_highlight_pos + tab_highlight_size,
							ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 0.9f * alpha),
							12.0f * DPI);

		draw->AddRect(tab_highlight_pos, tab_highlight_pos + tab_highlight_size,
					  ImColor(1.0f, 1.0f, 1.0f, 0.6f * alpha), 12.0f * DPI, 0, 1.5f * DPI);

		for (int i = 0; i < 3; i++)
		{
			float glow_alpha = (0.3f - i * 0.1f) * alpha;
			float glow_size = 5.0f * DPI * (1.0f + i * 0.5f);
			draw->AddRect(
				tab_highlight_pos - ImVec2(glow_size, glow_size),
				tab_highlight_pos + tab_highlight_size + ImVec2(glow_size, glow_size),
				ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, glow_alpha),
				12.0f * DPI + glow_size, 0, 1.0f * DPI);
		}

		float corner_size = 8.0f * DPI;
		draw->AddRectFilled(tab_highlight_pos,
							tab_highlight_pos + ImVec2(corner_size, corner_size),
							ImColor(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, alpha));
		draw->AddRectFilled(ImVec2(tab_highlight_pos.x + tab_highlight_size.x - corner_size, tab_highlight_pos.y),
							tab_highlight_pos + ImVec2(tab_highlight_size.x, corner_size),
							ImColor(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, alpha));
		draw->AddRectFilled(ImVec2(tab_highlight_pos.x, tab_highlight_pos.y + tab_highlight_size.y - corner_size),
							tab_highlight_pos + ImVec2(corner_size, tab_highlight_size.y),
							ImColor(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, alpha));
		draw->AddRectFilled(ImVec2(tab_highlight_pos.x + tab_highlight_size.x - corner_size, tab_highlight_pos.y + tab_highlight_size.y - corner_size),
							tab_highlight_pos + tab_highlight_size,
							ImColor(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, alpha));

		float time = ImGui::GetTime();
		for (int i = 0; i < 6; i++)
		{
			float angle = time * 4.0f + i * IM_PI / 3.0f;
			float radius = 15.0f * DPI * tab_slide_animation;
			ImVec2 particle_pos = ImVec2(
				tab_highlight_pos.x + tab_highlight_size.x * 0.5f + cosf(angle) * radius,
				tab_highlight_pos.y + tab_highlight_size.y * 0.5f + sinf(angle) * radius);
			draw->AddCircleFilled(particle_pos, 2.0f * DPI * (1.0f + sinf(time * 8.0f + i) * 0.5f),
								  ImColor(1.0f, 1.0f, 1.0f, 0.8f * tab_slide_animation * alpha));
		}
	}

	float current_x = start_x;
	for (int i = 0; i < 4; i++)
	{
		bool is_active = (YuanerSet->selection_count == i);
		bool is_hovered = ImGui::IsMouseHoveringRect(
			ImVec2(current_x, tab_y),
			ImVec2(current_x + tab_width, tab_y + tab_height));

		if (!is_active)
		{
			ImColor tab_bg = is_hovered ? ImColor(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 0.8f * alpha) : ImColor(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 0.6f * alpha);

			draw->AddRectFilled(ImVec2(current_x, tab_y),
								ImVec2(current_x + tab_width, tab_y + tab_height),
								tab_bg, 8.0f * DPI);

			draw->AddRect(ImVec2(current_x, tab_y),
						  ImVec2(current_x + tab_width, tab_y + tab_height),
						  ImColor(lv_colors.brown.x, lv_colors.brown.y, lv_colors.brown.z, 0.8f * alpha),
						  8.0f * DPI, 0, 1.0f * DPI);
		}

		ImVec2 text_size = ImGui::CalcTextSize(tab_names[i]);
		ImVec2 text_pos = ImVec2(
			current_x + (tab_width - text_size.x) * 0.5f,
			tab_y + (tab_height - text_size.y) * 0.5f);

		ImColor text_color = is_active ? ImColor(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, alpha) : ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, alpha);

		if (!is_active)
		{
			draw->AddText(ImVec2(text_pos.x + 1, text_pos.y + 1),
						  ImColor(0.0f, 0.0f, 0.0f, 0.5f * alpha), tab_names[i]);
		}

		draw->AddText(text_pos, text_color, tab_names[i]);

		if (is_hovered && !is_active)
		{
			draw->AddRect(ImVec2(current_x, tab_y),
						  ImVec2(current_x + tab_width, tab_y + tab_height),
						  ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 0.5f * alpha),
						  8.0f * DPI, 0, 2.0f * DPI);
		}

		if (ImGui::IsMouseHoveringRect(ImVec2(current_x, tab_y), ImVec2(current_x + tab_width, tab_y + tab_height)) &&
			ImGui::IsMouseClicked(0))
		{
			if (YuanerSet->selection_count != i)
			{
				prev_selection = YuanerSet->selection_count;
				YuanerSet->selection_count = i;
				show_aim_advanced_settings = false;
				show_visual_advanced_settings = false;
				tab_animating = true;
				tab_slide_animation = 0.0f;
			}
		}

		current_x += tab_width + tab_spacing;
	}

	draw->AddLine(
		ImVec2(start_x - 10.0f * DPI, tab_y + tab_height + 15.0f * DPI),
		ImVec2(start_x + total_width + 10.0f * DPI, tab_y + tab_height + 15.0f * DPI),
		ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 0.6f * alpha),
		2.0f * DPI);
}
void DrawLuxuryVisualTab(float child_width);
void DrawLuxuryAimTab(float child_width);
void DrawLuxuryItemsTab(float child_width);
void DrawLuxurySystemTab(float child_width);

void Menu_UI()
{
	if (!g_UserAgreed)
	{
		ShowDisclaimerPopup();
		return;
	}

	clr->updateThemeTransition();

	// if (背景图片)
	// {
	// 	ImGui::GetBackgroundDrawList()->AddImage((ImTextureID)YuanerSet->bg.textureId,
	// 											 ImVec2(0, 0), ImVec2(displayInfo.width, displayInfo.height),
	// 											 ImVec2(0, 0), ImVec2(1, 1), IM_COL32_WHITE);
	// }

	// 水印显示控制
	// if (false)
	// {
	// 	ImGui::SetNextWindowSize(ImVec2(350 * DPI, 55 * DPI));
	// 	ImGui::SetNextWindowPos(ImVec2(displayInfo.width - 1700 * DPI - (15 * DPI), 15 * DPI));
	// 	gui->begin("watermark", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus);
	// 	{
	// 		const ImVec2 pos = ImGui::GetWindowPos();
	// 		const ImVec2 size = ImGui::GetWindowSize();
	// 		ImDrawList *draw = ImGui::GetWindowDrawList();
	//
	// 		DrawLuxuryFrame(draw, pos, size, ImColor(0.08f, 0.07f, 0.06f, 0.9f), 12.0f * DPI);
	//
	// 		std::string watermarkText = "LV公益频道@LV520A【@China520a】";
	// 		std::string subText = "Louis Vuitton Elite Edition";
	//
	// 		ImVec2 mainTextSize = ImGui::CalcTextSize(watermarkText.c_str());
	// 		ImVec2 subTextSize = ImGui::CalcTextSize(subText.c_str());
	//
	// 		draw->AddText(YuanerSet->inter_semibold_font, 18 * DPI,
	// 					  ImVec2(pos.x + (size.x - mainTextSize.x) * 0.5f, pos.y + 10 * DPI),
	// 					  ImColor(lv_colors.gold), watermarkText.c_str());
	//
	// 		draw->AddText(ImVec2(pos.x + (size.x - subTextSize.x) * 0.5f, pos.y + 35 * DPI),
	// 					  ImColor(lv_colors.beige), subText.c_str());
	// 	}
	// 	gui->end();
	// }
	// ... 其余代码保持不变

	if (animating)
	{
		//UpdateUISmoothAnimation();
	}

	if (ui_visible || animating)
	{
		float alpha = animation_progress;

		ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus;

		if (animating)
		{
			window_flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
			ImGui::SetNextWindowSize(window_current_size);
			ImGui::SetNextWindowPos(window_current_pos);
		}
		else
		{
			ImGui::SetNextWindowSize({luxury_layout.window_size.x * DPI, luxury_layout.window_size.y * DPI});
			ImVec2 center = ImVec2(displayInfo.width / 2, displayInfo.height / 2);
			ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
		}

		ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);

		gui->begin("menu", NULL, window_flags);
		{
			const ImVec2 pos = ImGui::GetWindowPos();
			const ImVec2 size = ImGui::GetWindowSize();
			ImDrawList *draw = ImGui::GetWindowDrawList();
			ImGuiStyle *style = &ImGui::GetStyle();

			if (alpha > 0.05f)
			{
				{
					style->WindowPadding = ImVec2(luxury_layout.window_padding * DPI, luxury_layout.window_padding * DPI);
					style->WindowRounding = luxury_layout.window_rounding * DPI;
					style->WindowBorderSize = luxury_layout.border_thickness;

					ImColor bg_color = gui->get_clr(clr->window_background);
					bg_color.Value.w = alpha;
					DrawLuxuryFrame(draw, pos, size, bg_color, style->WindowRounding);

					draw->AddRectFilled(pos, pos + ImVec2(size.x, 70 * DPI),
										ImColor(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, alpha),
										style->WindowRounding, ImDrawFlags_RoundCornersTop);

					draw->AddRectFilled(pos + ImVec2(0, size.y - (80 * DPI)), pos + size,
										ImColor(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, alpha),
										style->WindowRounding, ImDrawFlags_RoundCornersBottom);

					if (YuanerSet->logo.textureId)
					{
						float logoSize = 40 * DPI;
						ImVec2 logoPos = pos + ImVec2(20 * DPI, 15 * DPI);
						draw->AddImage((ImTextureID)YuanerSet->logo.textureId,
									   logoPos, logoPos + ImVec2(logoSize, logoSize),
									   ImVec2(0, 0), ImVec2(1, 1),
									   ImColor(1.0f, 1.0f, 1.0f, alpha));
					}

					{
						float themeToggleSize = 60 * DPI;
						ImVec2 themeTogglePos = pos + ImVec2(size.x - 50 * DPI, 35 * DPI);

						draw->AddCircleFilled(themeTogglePos, themeToggleSize * 0.5f, ImColor(60, 60, 70, 200), 32);

						if (clr->currentTheme == 0)
						{
							draw->AddCircleFilled(themeTogglePos, themeToggleSize * 0.3f,
												  ImColor(255 / 255.0f, 220 / 255.0f, 100 / 255.0f, 255 / 255.0f * alpha), 32);
							draw->AddCircle(themeTogglePos, themeToggleSize * 0.35f,
											ImColor(255 / 255.0f, 200 / 255.0f, 50 / 255.0f, 255 / 255.0f * alpha), 32, 2.0f * DPI);

							for (int i = 0; i < 8; i++)
							{
								float angle = i * IM_PI / 4;
								ImVec2 start = ImVec2(
									themeTogglePos.x + cos(angle) * themeToggleSize * 0.35f,
									themeTogglePos.y + sin(angle) * themeToggleSize * 0.35f);
								ImVec2 end = ImVec2(
									themeTogglePos.x + cos(angle) * themeToggleSize * 0.45f,
									themeTogglePos.y + sin(angle) * themeToggleSize * 0.45f);
								draw->AddLine(start, end, ImColor(255, 200, 50, 255), 2.0f * DPI);
							}
						}
						else
						{
							draw->AddCircleFilled(themeTogglePos, themeToggleSize * 0.3f,
												  ImColor(200 / 255.0f, 220 / 255.0f, 255 / 255.0f, 255 / 255.0f * alpha), 32);
							draw->AddCircleFilled(themeTogglePos + ImVec2(themeToggleSize * 0.1f, 0),
												  themeToggleSize * 0.2f,
												  ImColor(60 / 255.0f, 60 / 255.0f, 70 / 255.0f, 200 / 255.0f * alpha), 32);
						}

						ImVec2 mousePos = ImGui::GetIO().MousePos;
						float dist = sqrtf((mousePos.x - themeTogglePos.x) * (mousePos.x - themeTogglePos.x) +
										   (mousePos.y - themeTogglePos.y) * (mousePos.y - themeTogglePos.y));
						if (dist <= themeToggleSize * 0.5f && ImGui::IsMouseClicked(0))
						{
							clr->toggleTheme();
						}

						if (dist <= themeToggleSize * 0.5f)
						{
							const char *tip = clr->currentTheme == 0 ? "切换到夜晚模式" : "切换到白天模式";
							DrawTextX(draw, tip,
									  ImVec2(themeTogglePos.x - calcTextSize(tip, 18) / 2, themeTogglePos.y + themeToggleSize * 0.6f + 8),
									  ImColor(1.0f, 1.0f, 1.0f, 1.0f), true, 18);
						}
					}

					const char *mainTitle = "LOUIS VUITTON";
					const char *subTitle = "LV公益频道@LV520A【@China520a】| Elite Assistant System";

					ImFont *mainFont = YuanerSet->inter_semibold_font;
					ImFont *subFont = YuanerSet->inter_semibold_min_font;

					float mainFontSize = 26 * DPI;
					float subFontSize = 16 * DPI;

					ImVec2 mainTitleSize = mainFont->CalcTextSizeA(mainFontSize, FLT_MAX, 0.0f, mainTitle);
					ImVec2 subTitleSize = subFont->CalcTextSizeA(subFontSize, FLT_MAX, 0.0f, subTitle);

					draw->AddText(mainFont, mainFontSize,
								  ImVec2(pos.x + (size.x - mainTitleSize.x) * 0.5f, pos.y + 15 * DPI),
								  ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, alpha), mainTitle);

					draw->AddText(subFont, subFontSize,
								  ImVec2(pos.x + (size.x - subTitleSize.x) * 0.5f, pos.y + 45 * DPI),
								  ImColor(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, alpha), subTitle);
				}

				{
					DrawLuxuryTabSystem(draw, pos, size, alpha);
				}

				{
					float content_top = 70 * DPI;
					float content_bottom = 90 * DPI;
					float content_height = size.y - content_top - content_bottom;

					ImGui::SetCursorPos(ImVec2(0, content_top));

					ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImVec4(0.1f, 0.1f, 0.1f, 0.6f * alpha));
					ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, ImVec4(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 0.8f * alpha));
					ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 1.0f * alpha));
					ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(lv_colors.light_gold.x, lv_colors.light_gold.y, lv_colors.light_gold.z, 1.0f * alpha));

					ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarRounding, 6.0f * DPI);
					ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 10.0f * DPI);

					ImGui::BeginChild("##ScrollableContent",
									  ImVec2(size.x, content_height),
									  false,
									  ImGuiWindowFlags_AlwaysVerticalScrollbar);

					static float tab_alpha = 0.f;
					static int active_tab = 0;
					static float Atimer = 0.0f;

					tab_alpha += (YuanerSet->selection_count == active_tab ? 1.0f : -1.0f) * (3.0f * ImGui::GetIO().DeltaTime);
					tab_alpha = ImClamp(tab_alpha, 0.f, 1.f);

					if (tab_alpha == 0.f)
					{
						Atimer += ImGui::GetIO().DeltaTime;
						if (Atimer > 0.3f)
						{
							active_tab = YuanerSet->selection_count;
							Atimer = 0.0f;
							tab_alpha = 0.0f;
						}
					}

					ImGui::PushStyleVar(ImGuiStyleVar_Alpha, tab_alpha * alpha);

					ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, luxury_layout.child_rounding * DPI);
					ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, luxury_layout.frame_rounding * DPI);
					ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, luxury_layout.frame_rounding * DPI);
					ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, luxury_layout.child_rounding * DPI);

					float side_margin = 15.0f * DPI;
					ImGui::SetCursorPos(ImVec2(side_margin, 15 * DPI));

					ImGui::BeginGroup();

					float scrollbar_size = ImGui::GetStyle().ScrollbarSize * DPI;
					float available_width = ImGui::GetContentRegionAvail().x - (2 * side_margin) - scrollbar_size;
					float child_width = (available_width - luxury_layout.item_spacing * DPI * 2) * 0.53f;
					// 在 Menu_UI 函数中的正确位置：
					if (show_visual_advanced_settings)
					{
						DrawLuxuryVisualAdvancedSettings(child_width);
					}
					else if (show_aim_advanced_settings)
					{
						DrawLuxuryAimAdvancedSettings(child_width);
					}
					else
					{
						switch (active_tab)
						{
						case 0:
							DrawLuxuryVisualTab(child_width);
							break;
						case 1:
							DrawLuxuryAimTab(child_width);
							break;
						case 2:
							DrawLuxuryItemsTab(child_width);
							break;
						case 3:
							DrawLuxurySystemTab(child_width);
							break;
						}
					}
					ImGui::EndGroup();

					ImGui::PopStyleVar(5);

					ImGui::EndChild();
					ImGui::PopStyleVar(2);

					ImGui::PopStyleColor(4);
				}
			}
		}
		ImGui::PopStyleVar();
		gui->end();
	}
}

void DrawLuxuryVisualTab(float child_width)
{
	ImGui::BeginGroup();
	const float columnSpacing = ImGui::GetStyle().ItemSpacing.x;
	const float columnWidth = (child_width - columnSpacing * 2.0f) / 3.0f;

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("人物绘制设置", ImVec2(child_width, 0 * DPI), true, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
		{
			ImGui::TextColored(ImColor(lv_colors.gold), "常用绘制");
			ImGui::Separator();
			ImGui::Spacing();

			const float fullDropdownWidth = ImGui::GetContentRegionAvail().x;
			const ImVec2 leftColumnScreenPos = ImGui::GetCursorScreenPos();
			float modelRowScreenY = 0.0f;
			const float columnChildHeight = ImGui::GetFrameHeightWithSpacing() * 7.0f;
			ImGui::BeginChild("visual_common_col1", ImVec2(columnWidth, columnChildHeight), false);
			{
				//gui->checkbox("绘制血量", &globalConfig.ShowHealthBar, 字体加粗);
				gui->checkbox("背敌预警", &globalConfig.edge, 字体加粗);
				//gui->checkbox("显示人数", &globalConfig.ShowPlayerCounter, 字体加粗);
				//gui->checkbox("人物距离", &globalConfig.ShowPlayerDistance, 字体加粗);
				gui->checkbox("人物射线", &globalConfig.Ray, 字体加粗);
				gui->checkbox("忽略倒地", &globalConfig.IgnoreFall, 字体加粗);
				//gui->checkbox("显示模型", &globalConfig.ModelDrawing, 字体加粗);
				modelRowScreenY = ImGui::GetCursorScreenPos().y;
			}
			ImGui::EndChild();

			ImGui::SameLine(0, columnSpacing);

			ImGui::BeginChild("visual_common_col2", ImVec2(columnWidth, columnChildHeight), false);
			{
				gui->checkbox("绘制方框", &globalConfig.Box, 字体加粗);
				gui->checkbox("开启雷达", &globalConfig.Map, 字体加粗);
				gui->checkbox("手持显示", &globalConfig.weapon, 字体加粗);
				// gui->checkbox("手雷范围", &globalConfig.ShowGrenadeTrajectory, 字体加粗);
				// gui->checkbox("被瞄预警", &globalConfig.AimWarning, 字体加粗);
				// gui->checkbox("对局显示", &globalConfig.showMatchInfo, 字体加粗);
				// gui->checkbox("燃烧范围", &globalConfig.ShowFireRange, 字体加粗);
				// gui->checkbox("导弹范围", &globalConfig.ShowMissileRange, 字体加粗);
			}
			ImGui::EndChild();

			ImGui::SameLine(0, columnSpacing);

			ImGui::BeginChild("visual_common_col3", ImVec2(columnWidth, columnChildHeight), false);
			{
				gui->checkbox("人物名称", &globalConfig.Info, 字体加粗);
				bool ignoreRobot = globalConfig.Dont != 0;
				if (gui->checkbox("忽略人机", &ignoreRobot, 字体加粗))
				{
					globalConfig.Dont = ignoreRobot ? 1 : 0;
				}
				gui->checkbox("人物骨骼", &globalConfig.Bone, 字体加粗);
				// gui->checkbox("绘制护具", &globalConfig.ShowArmor, 字体加粗);
				// gui->checkbox("烟雾范围", &globalConfig.ShowSmokeRange, 字体加粗);
				gui->checkbox("导弹预警", &globalConfig.materialSwitch[Missile], 字体加粗);
			}
			ImGui::EndChild();

			const float fixedGapPx = 3.0f;
			const float leftColumnLocalX = leftColumnScreenPos.x - ImGui::GetWindowPos().x;
			float targetY = ImGui::GetCursorPosY() + fixedGapPx;
			if (modelRowScreenY > 0.0f)
			{
				const float modelRowLocalY = modelRowScreenY - ImGui::GetWindowPos().y;
				targetY = modelRowLocalY + fixedGapPx;
			}
			ImGui::SetCursorPos(ImVec2(leftColumnLocalX, targetY));
			const float dropdownRowHeight = 53.0f * DPI + ImGui::GetStyle().ItemSpacing.y;
			const float dropdownChildHeight = dropdownRowHeight * 3.0f + ImGui::GetStyle().WindowPadding.y * 2.0f;
			ImGui::BeginChild("visual_common_dropdowns", ImVec2(fullDropdownWidth, dropdownChildHeight), false);
			{

			}
			ImGui::EndChild();
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::SameLine();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("绘制参数调整", ImVec2(child_width, 0), true);
		{
			if (gui->button("进入绘图高级设置", ImVec2(180 * DPI, 45 * DPI)))
			{
				show_visual_advanced_settings = true;
				strcpy(visual_advanced_submenu_title, "绘图高级设置 注:设置完请返回上级");
				visual_advanced_parent_tab = YuanerSet->selection_count;
			}

			const char *Dont[3] = {"绘制人机", "仅绘图过滤人机", "全局过滤人机"};
			ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
			gui->dropdown("\u5ffd\u7565\u4eba\u673a", &globalConfig.Dont, Dont, 3);
			ImGui::PopItemWidth();

			gui->slider_float("距离限制", &globalConfig.CharacterDis, 0.0f, 600.0f, "%.fM");
			if (gui->slider_int("绘图帧率", &FPS, 60.0, 165.0, "%d FPS"))
			{
				globalConfig.FPS = FPS;
			}
			readText(ImColor(gui->get_clr(clr->TextColored)),
					 ImColor(gui->get_clr(clr->Texticon)),
					 YuanerSet->Texticon,
					 "绘图卡顿时请调节帧率");

			if (globalConfig.Map)
			{
				gui->slider_float("X坐标", &globalConfig.radarCoord.X, 0, px * 2, "%.f");
				gui->slider_float("大小", &globalConfig.radarSize, 1.0, 100, "%.0f%%");
				gui->slider_float("Y坐标", &globalConfig.radarCoord.Y, 0, py * 2, "%.f");
				gui->slider_int("缩放", &globalConfig.scaling, 0, 300, "%.1d");
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::EndGroup();
}

void DrawLuxuryAimTab(float child_width)
{
	ImGui::BeginGroup();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("自瞄核心控制", ImVec2(child_width, 0), true);
		{
			float buttonWidth = ImGui::GetContentRegionAvail().x;

			if (!aimbotInitialized)
			{

				if (gui->button("初始化自瞄系统", ImVec2(buttonWidth, 45 * DPI)))
				{
					aimbotInitialized = true;
					__android_log_print(ANDROID_LOG_INFO, "LV", "自瞄系统已初始化");
				}

				ImGui::Spacing();
				ImGui::Spacing();
				ImGui::TextColored(ImColor(lv_colors.gold), "LOUIS VUITTON 自瞄系统");
				ImGui::Spacing();
				ImGui::TextColored(ImColor(1.0f, 0.5f, 0.2f, 1.0f), "请先初始化自瞄系统");
				ImGui::TextColored(ImColor(1.0f, 0.5f, 0.2f, 1.0f), "不初始化初始化自瞄系统即为单透模式 不加载自瞄线程");
				ImGui::TextColored(ImColor(0.8f, 0.8f, 0.8f, 1.0f), "初始化后自瞄功能将可用");
				ImGui::Spacing();
				ImGui::TextColored(ImColor(0.6f, 0.6f, 0.6f, 1.0f), "安全提示: 自瞄功能仅供学习交流");
				ImGui::TextColored(ImColor(0.6f, 0.6f, 0.6f, 1.0f), "请合理使用，遵守游戏规则");
			}
			else
			{
				// 已初始化时显示所有控件
				ImDrawList *draw = ImGui::GetWindowDrawList();
				ImVec2 screenPos = ImGui::GetCursorScreenPos();
				/*
				// 绘制初始化状态
				draw->AddText(ImVec2(screenPos.x, screenPos.y),
							ImColor(0.0f, 1.0f, 0.0f, 1.0f), "✓");
				draw->AddText(ImVec2(screenPos.x + 20 * DPI, screenPos.y),
							ImColor(lv_colors.beige), "自瞄系统已初始化");

				ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 25 * DPI);
				*/

				std::string aimbotButtonText = globalConfig.AimBot_STAR ? "关闭自瞄" : "开启自瞄";
				if (gui->button(aimbotButtonText.c_str(), ImVec2(buttonWidth, 45 * DPI)))
				{
					globalConfig.AimBot_STAR = !globalConfig.AimBot_STAR;
				}
				//       gui->checkbox("启用掩体漏打", &isPhysXEnabled, 字体加粗);
				// 基础自瞄选项：三列排版（与视觉设置左侧栏一致）
				const float aimColumnSpacing = ImGui::GetStyle().ItemSpacing.x;
				const float aimColumnWidth = (ImGui::GetContentRegionAvail().x - aimColumnSpacing * 2.0f) / 3.0f;
				const float aimColumnHeight = ImGui::GetFrameHeightWithSpacing() * 3.0f;

				ImGui::BeginChild("aim_basic_col1", ImVec2(aimColumnWidth, aimColumnHeight), false);
				{
					//gui->checkbox("框内自瞄", &globalConfig.BoxAim, 字体加粗);
					gui->checkbox("持续锁定", &globalConfig.Persistentlocking, 字体加粗);
					// gui->checkbox("动态自瞄", &globalConfig.DynamicAim, 字体加粗);
				}
				ImGui::EndChild();

				ImGui::SameLine(0, aimColumnSpacing);

				ImGui::BeginChild("aim_basic_col2", ImVec2(aimColumnWidth, aimColumnHeight), false);
				{
					//gui->checkbox("显示自瞄范围", &globalConfig.ShowAimRadius, 字体加粗);
					switch (globalConfig.Dont)
					{
					case 0:
					case 1:
						gui->checkbox("忽略人机", &globalConfig.IgnoreRoBot, 字体加粗);
						break;
					}
					//gui->checkbox("烟雾不瞄", &globalConfig.IgnoreSmokeAim, 字体加粗);
				}
				ImGui::EndChild();

				ImGui::SameLine(0, aimColumnSpacing);

				ImGui::BeginChild("aim_basic_col3", ImVec2(aimColumnWidth, aimColumnHeight), false);
				{
					gui->checkbox("忽略倒地", &globalConfig.IgnoreFall, 字体加粗);
					//gui->checkbox("准心射线", &globalConfig.CrosshairRay, 字体加粗);
				}
				ImGui::EndChild();

				// if (globalConfig.BoxAim)
				// {
				// 	gui->slider_float("框内范围", &globalConfig.BoxAimSize, 50.0f, 300.0f, "%.1f");
				// }

				gui->slider_float("自瞄范围", &globalConfig.Radius, 0.0f, 300, "%.1f");
				ImGui::Separator();
				ImGui::TextColored(ImColor(lv_colors.gold), "自瞄模式设置");

				//gui->checkbox("启用软锁模式", &globalConfig.SoftAim, 字体加粗);

				// if (globalConfig.SoftAim)
				// {
				//
				// 	gui->slider_float("软锁强度", &globalConfig.SoftAimStrength, 0.1f, 1.0f, "%.2f");
				//
				// 	readText(ImColor(gui->get_clr(clr->TextColored)),
				// 			 ImColor(gui->get_clr(clr->Texticon)),
				// 			 YuanerSet->Texticon,
				// 			 "软锁模式：更自然的瞄准，避免直接锁定");
				//
				// 	if (globalConfig.SoftAimStrength < 0.3f)
				// 	{
				// 		readText(ImColor(0.0f, 1.0f, 0.0f, 1.0f),
				// 				 ImColor(gui->get_clr(clr->Texticon)),
				// 				 YuanerSet->Texticon,
				// 				 "极软：非常自然的瞄准移动");
				// 	}
				// 	else if (globalConfig.SoftAimStrength < 0.6f)
				// 	{
				// 		readText(ImColor(1.0f, 1.0f, 0.0f, 1.0f),
				// 				 ImColor(gui->get_clr(clr->Texticon)),
				// 				 YuanerSet->Texticon,
				// 				 "中等：平衡的瞄准速度");
				// 	}
				// 	else
				// 	{
				// 		readText(ImColor(1.0f, 0.5f, 0.0f, 1.0f),
				// 				 ImColor(gui->get_clr(clr->Texticon)),
				// 				 YuanerSet->Texticon,
				// 				 "较硬：接近硬锁的响应");
				// 	}
				// }
				// else
				// {
				// 	readText(ImColor(1.0f, 0.0f, 0.0f, 1.0f),
				// 			 ImColor(gui->get_clr(clr->Texticon)),
				// 			 YuanerSet->Texticon,
				// 			 "硬锁模式：直接快速锁定目标");
				// }
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::SameLine();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("自瞄参数配置", ImVec2(child_width, 0), true);
		{
			if (!aimbotInitialized)
			{

				ImGui::Spacing();
				ImGui::Spacing();
				ImGui::TextColored(ImColor(lv_colors.gold), "自瞄参数配置");
				ImGui::Spacing();
				ImGui::TextColored(ImColor(0.8f, 0.8f, 0.8f, 1.0f), "请先初始化自瞄系统");
				ImGui::Spacing();
				ImGui::TextColored(ImColor(0.6f, 0.6f, 0.6f, 1.0f), "初始化后此处将显示");
				ImGui::TextColored(ImColor(0.6f, 0.6f, 0.6f, 1.0f), "详细的参数配置选项");

				ImDrawList *draw = ImGui::GetWindowDrawList();
				ImVec2 pos = ImGui::GetWindowPos();
				ImVec2 size = ImGui::GetWindowSize();

				draw->AddRect(pos, ImVec2(pos.x + size.x, pos.y + size.y),
							  ImColor(lv_colors.gold.x, lv_colors.gold.y, lv_colors.gold.z, 0.3f),
							  8.0f * DPI, 0, 1.5f * DPI);

				draw->AddRect(pos + ImVec2(5 * DPI, 5 * DPI),
							  ImVec2(pos.x + size.x - 5 * DPI, pos.y + size.y - 5 * DPI),
							  ImColor(lv_colors.beige.x, lv_colors.beige.y, lv_colors.beige.z, 0.2f),
							  4.0f * DPI, 0, 1.0f * DPI);
			}
			else
			{
				if (gui->button("进入自瞄高级设置", ImVec2(180 * DPI, 45 * DPI)))
				{
					show_aim_advanced_settings = true;
					strcpy(aim_advanced_submenu_title, "自瞄高级设置 注:设置完请返回上级");
					aim_advanced_parent_tab = YuanerSet->selection_count;
				}

				//gui->checkbox("自瞄准心最近部位", &globalConfig.NearestBoneAim, 字体加粗);
				//gui->checkbox("显示自瞄控件", &globalConfig.ShowAimControl, 字体加粗);

				const char *AimingPart[3] = {"头部", "脖子", "屁股"};
				gui->dropdown("自瞄部位", &globalConfig.AimingPart, AimingPart, 3);

				//const char *AimTriggerModes[] = {"仅开火自瞄", "仅开镜自瞄", "开火或开镜自瞄", "开火且开镜自瞄"};
				//gui->dropdown("自瞄触发模式", &globalConfig.AimTriggerMode, AimTriggerModes, 4);

				gui->checkbox("调整触摸", &globalConfig.SetTouch, 字体加粗);
				if (globalConfig.SetTouch)
				{
					gui->slider_float("触摸位置 X", &globalConfig.TouchLocationX, 0.0f, (px * 2.0f), "%.1f");
					gui->slider_float("触摸位置 Y", &globalConfig.TouchLocationY, 0.0f, (py * 2.0f), "%.1f");
					gui->slider_int("触摸大小", &globalConfig.TouchSize, 0, 500, "%.1d");
				}

				// const char *condition[2] = {"准心优先", "距离优先"};
				/*      gui->dropdown("判断条件", &globalConfig.condition, condition, 2);
					  const char* Trollway[2] = { "按下开火", "松手开火"};
					  gui->dropdown("霰弹枪开火方式", &globalConfig.Trollway, Trollway, 2);
					  gui->checkbox("喷子持续锁定", &globalConfig.TrollContinuousLock, 字体加粗);
					  gui->slider_float("喷子持续锁定距离限制", &globalConfig.TrollDislimit, 1.0f, 100.0f, "%.1f");
					  */
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::EndGroup();
}

void DrawLuxuryItemsTab(float child_width)
{
	ImGui::BeginGroup();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("预警设置", ImVec2(child_width, 0), true);
		{
			gui->checkbox("投掷物", &globalConfig.materialSwitch[Warning], 字体加粗);
			gui->color_edit("预警文字颜色", (float *)&globalConfig.ScarletWarning, ImGuiColorEditFlags_AlphaBar, true);
			gui->checkbox("载具", &globalConfig.materialSwitch[Vehicle], 字体加粗);
			gui->color_edit("载具图标颜色", (float *)&globalConfig.PeachColor, ImGuiColorEditFlags_AlphaBar, true);
			gui->checkbox("信号枪", &globalConfig.materialSwitch[FlareGun], 字体加粗);
			gui->color_edit("信号枪图标颜色", (float *)&globalConfig.PeachSignalGun, ImGuiColorEditFlags_AlphaBar, true);
			gui->checkbox("自定义物资绘制", &globalConfig.Custom, 字体加粗);
			if (globalConfig.Custom)
			{
				readText(ImColor(gui->get_clr(clr->TextColored)),
						 ImColor(gui->get_clr(clr->Texticon)),
						 YuanerSet->Texticon,
						 "说明:变更配置文件后需手动刷新");
				if (gui->button("更新列表", ImVec2(120 * DPI, 35 * DPI)))
					LoadConfigOnce();
				gui->checkbox("自定义物资距离无限制", &globalConfig.UnlimitedCustomMaterialDis, 字体加粗);
				if (!globalConfig.UnlimitedCustomMaterialDis)
				{
					gui->slider_float("自定义物资距离限制", &globalConfig.CustomMaterialDis, 0.0f, 600.0f, "%.fM");
				}
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::SameLine();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("盒子类", ImVec2(child_width, 0), true);
		{
			gui->checkbox("人物盒子", &globalConfig.materialSwitch[PlayerAirdrop], 字体加粗);
			gui->checkbox("空投物资箱", &globalConfig.materialSwitch[Airdrop], 字体加粗);
			gui->checkbox("地铁物资箱", &globalConfig.materialSwitch[SupplyAirdrop], 字体加粗);
			gui->checkbox("地铁武器箱", &globalConfig.materialSwitch[WeaponAirdrop], 字体加粗);
			gui->color_edit("盒子图标颜色", (float *)&globalConfig.VerdigrisColor, ImGuiColorEditFlags_AlphaBar, true);
			if (globalConfig.UnlimitedmaterialDis)
			{
				readText(ImColor(gui->get_clr(clr->TextColored)),
						 ImColor(gui->get_clr(clr->Texticon)),
						 YuanerSet->Texticon,
						 "状态:物资 距离无限制");
			}
			else
			{
				readText(ImColor(gui->get_clr(clr->TextColored)),
						 ImColor(gui->get_clr(clr->Texticon)),
						 YuanerSet->Texticon,
						 "状态:物资 限制距离");
				gui->slider_float("物资距离限制", &globalConfig.materialDis, 0.0, 601.0, "%.fM");
			}
			gui->checkbox("物资距离无限制", &globalConfig.UnlimitedmaterialDis, 字体加粗);
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::EndGroup();
}

void DrawLuxurySystemTab(float child_width)
{
	ImGui::BeginGroup();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("界面设置", ImVec2(child_width, 0 * DPI), true);
		{
			gui->slider_float("UI大小", &NewDPI, 1.0, 2.0, "%.1f");
			if (gui->button("应用UI大小", ImVec2(120 * DPI, 35 * DPI)))
			{
				DPI = NewDPI;
				ChangeFontSize();
			}

			//gui->checkbox("显示水印", &globalConfig.showWatermark, 字体加粗);

			if (gui->button("保存配置", ImVec2(120 * DPI, 35 * DPI)))
				Write_config_json();
			if (gui->button("重置配置", ImVec2(120 * DPI, 35 * DPI)))
			{
				// 删除配置文件
				remove("配置.json");
				/*   // 重置全局配置为默认值
				   globalConfig = Config();
				   // 重新应用默认DPI
				   DPI = 1.1f;
				   NewDPI = DPI;
				   ChangeFontSize();
				   // 重新初始化颜色主题
				   clr->currentTheme = 0;
				   clr->themeTransition = 1.0f;
				   clr->updateColors();
				   // 可以添加一个提示消息
				   // AddSimpleNotification("配置已重置为默认值", 2.0f);*/
			}

			if (gui->button("退出辅助", ImVec2(120 * DPI, 35 * DPI)))
			{
				Touch_Close();
				exit(0);
			}

			gui->checkbox("调试模式", &globalConfig.DeBug, 字体加粗);
			if (globalConfig.DeBug)
			{
				gui->checkbox("调试模式距离无限制", &globalConfig.UnlimitedDemoDis, 字体加粗);
				if (!globalConfig.UnlimitedDemoDis)
				{
					gui->slider_float("DeBug距离限制", &globalConfig.DemoDis, 0.0, 600.0, "%.fM");
				}
			}
			// if (gui->button("直出DataOffset", ImVec2(150 * DPI, 35 * DPI)))
			// 	exportation();
			ImGui::Spacing();
			static bool show_kernel_decrypt_panel = false;
			static bool kernel_decrypt_done = false;
			if (gui->button("内核算法解密", ImVec2(150 * DPI, 35 * DPI)))
			{
				show_kernel_decrypt_panel = !show_kernel_decrypt_panel;
				if (show_kernel_decrypt_panel)
				{
					kernel_decrypt_done = true;
				}
			}
			if (show_kernel_decrypt_panel)
			{
				ImGui::Spacing();
				if (gui->button("重新解密", ImVec2(150 * DPI, 35 * DPI)))
				{
					kernel_decrypt_done = true;
				}
				ImGui::Spacing();
				ImGui::TextColored(ImColor(lv_colors.brown), "可用的解密数组:");
				if (kernel_decrypt_done)
				{
					ImGui::TextColored(ImVec4(0.15f, 0.70f, 0.20f, 1.0f), "ok 解密完成，共找到 0 个数组");
				}
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::SameLine();

	ImGui::BeginGroup();
	{
		ImGui::BeginChild("免责声明", ImVec2(child_width, 260 * DPI), true);
		{
			ImVec4 textColor = clr->currentTheme == 0 ? ImVec4(0.0f, 0.0f, 0.0f, 1.0f) : // 白天
								   ImVec4(1.0f, 1.0f, 1.0f, 1.0f);						 // 夜晚

			ImGui::PushStyleColor(ImGuiCol_Text, textColor);

			ImGui::TextWrapped("• 本程序为LOUIS VUITTON公益内核，仅供学习交流参考");
			ImGui::TextWrapped("• 下载后请于24小时内删除，严禁用于商业用途");
			ImGui::Spacing();

			ImGui::TextWrapped("用户使用此程序需确认并接受以下全部风险：");
			ImGui::Spacing();

			ImGui::TextWrapped("• 可能违反相关软件的服务条款");
			ImGui::TextWrapped("• 可能导致账号封禁或其他处罚");
			ImGui::TextWrapped("• 开发者不承担任何因使用造成的损失");
			ImGui::TextWrapped("• 用户需自行承担所有法律和安全风险");
			ImGui::TextWrapped("• 严禁将本程序用于非法用途");

			// 恢复
			ImGui::PopStyleColor();
		}
		ImGui::EndChild();

		ImGui::Spacing();
		ImGui::BeginChild("网络雷达", ImVec2(child_width, 160 * DPI), true);
		{
			static bool networkRadarConnected = false;
			static int networkRadarRoom = 0;
			const float buttonWidth = ImGui::GetContentRegionAvail().x;
			if (gui->button("连接网络雷达", ImVec2(buttonWidth, 35 * DPI)))
			{
				// TODO: 接入网络雷达逻辑
				networkRadarConnected = true;
				networkRadarRoom = 692832;
			}

			ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(lv_colors.dark_brown.x, lv_colors.dark_brown.y, lv_colors.dark_brown.z, 1.0f));
			ImGui::Text("状态：%s", networkRadarConnected ? "已开启网络雷达" : "未开启网络雷达");
			ImGui::Text("连接状态：%s", networkRadarConnected ? "已连接" : "未初始化");
			ImGui::Text("房间号：%s", networkRadarConnected ? "692832" : "-");
			ImGui::PopStyleColor();

			if (gui->button("复制房间号及地址", ImVec2(buttonWidth, 35 * DPI)))
			{
				ImGui::SetClipboardText(networkRadarConnected ? "房间号:692832 地址:-" : "房间号:- 地址:-");
			}
		}
		ImGui::EndChild();
	}
	ImGui::EndGroup();

	ImGui::EndGroup();
}