Settings.cpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #include "Settings.h"
  2. namespace cheat {
  3. static void DrawFPS();
  4. Settings::Settings() {
  5. f_DisableProtection = config::getValue("functions:Settings", "disableProtection", true);
  6. f_DisableLog = config::getValue("functions:Settings", "disableLog", true);
  7. f_SpoofACResult = config::getValue("functions:Settings", "spoofACResult", true);
  8. f_UseSignature = config::getValue("functions:Settings", "useSignature", true);
  9. f_ShowFps = config::getValue("functions:Settings", "showFps", true);
  10. f_ShowRpc = config::getValue("functions:Settings", "showRpc", true);
  11. f_ShowConsole = config::getValue("functions:Settings", "showConsole", true);
  12. f_InitDelay = config::getValue("functions:Settings", "initDelay", 15000);
  13. f_Language = config::getValue("functions:Settings", "language", 0);
  14. f_MobileMode = config::getValue("functions:Settings", "mobileMode", false);
  15. f_StartupArguments = config::getValue<std::string>("functions:Settings", "startupArguments", "");
  16. f_AnimationDuration = config::getValue("functions:Settings", "animationDuration", 0.2f);
  17. f_Status = config::getValue("functions:Settings", "status", true);
  18. f_StatusMove = config::getValue("functions:Settings", "statusMove", true);
  19. f_ShowMenu = config::getValue("functions:Settings", "showMenu", true);
  20. f_Hotkey = Hotkey("functions:Settings:Menu", VK_F12);
  21. f_HotkeyConsole = Hotkey("functions:Settings:Console", VK_HOME);
  22. }
  23. Settings& Settings::getInstance() {
  24. static Settings instance;
  25. return instance;
  26. }
  27. const char* languages[] = { "English", "Russian", "Chinese", "Indonesian" };
  28. void Settings::GUI() {
  29. //ImGui::SeparatorText(_("SETTINGS_LANGUAGE"));
  30. //ConfigComboLanguage(f_Language);
  31. ImGui::SeparatorText(_("SETTINGS_GENERAL"));
  32. f_Hotkey.Draw(_("MENU_HOTKEY_TITLE"));
  33. ConfigCheckbox(_("CONSOLE_HOTKEY_TITLE"), f_ShowConsole, _("CONSOLE_HOTKEY_DESCRIPTION"));
  34. if (f_Status.getValue()) {
  35. ImGui::Indent();
  36. f_HotkeyConsole.Draw();
  37. ImGui::Unindent();
  38. }
  39. ConfigCheckbox(_("DISABLE_PROTECTION_TITLE"), f_DisableProtection, _("DISABLE_PROTECTION_DESCRIPTION"));
  40. ConfigCheckbox(_("DISABLE_LOG_TITLE"), f_DisableLog, _("DISABLE_LOG_DESCRIPTION"));
  41. ConfigCheckbox(_("DISABLE_SPOOF_ANTICHEAT_TITLE"), f_SpoofACResult, _("DISABLE_SPOOF_ANTICHEAT_DESCRIPTION"));
  42. ConfigCheckbox(_("USE_FILE_SIGNATURE_TITLE"), f_UseSignature, _("USE_FILE_SIGNATURE_DESCRIPTION"));
  43. ConfigCheckbox(_("SHOW_STATUS_WINDOW_TITLE"), f_Status, _("SHOW_STATUS_WINDOW_DESCRIPTION"));
  44. if (f_Status.getValue()) {
  45. ImGui::Indent();
  46. ConfigCheckbox(_("MOVE_STATUS_TITLE"), f_StatusMove);
  47. ImGui::Unindent();
  48. }
  49. ConfigCheckbox(_("SHOW_FPS_TITLE"), f_ShowFps, _("SHOW_FPS_DESCRIPTION"));
  50. ConfigCheckbox(_("SHOW_RPC_TITLE"), f_ShowRpc, _("SHOW_RPC_DESCRIPTION"));
  51. ConfigSliderInt(_("INIT_DELAY_TITLE"), f_InitDelay, 0, 60000, _("INIT_DELAY_DESCRIPTION"));
  52. ConfigCheckbox(_("MODILE_MODE_TITLE"), f_MobileMode, _("MODILE_MODE_DESCRIPTION"));
  53. ConfigInputText(_("STARTUP_ARGS_TITLE"), f_StartupArguments, _("STARTUP_ARGS_DESCRIPTION"));
  54. TextURL(_("LIST_UNITY_COMMAND_TITLE"), "https://docs.unity3d.com/Manual/PlayerCommandLineArguments.html", false, false);
  55. ImGui::SeparatorText(_("SETTINGS_THEME"));
  56. static int themeIndex = 1;
  57. if (ImGui::RadioButton(_("THEME_DARK_TITLE"), &themeIndex, 1))
  58. setTheme(1);
  59. if (ImGui::RadioButton(_("THEME_LIGHT_TITLE"), &themeIndex, 2))
  60. setTheme(2);
  61. ImGui::SeparatorText(_("SETTINGS_STYLE"));
  62. static int styleIndex = 1;
  63. if (ImGui::RadioButton(_("STYLE_COZY_TITLE"), &styleIndex, 1))
  64. setStyle(1);
  65. if (ImGui::RadioButton(_("STYLE_COZY_SQUARED_TITLE"), &styleIndex, 2))
  66. setStyle(2);
  67. ImGui::SeparatorText(_("SETTINGS_FONT"));
  68. static int fontIndex = 1;
  69. if (ImGui::RadioButton(_("FONT_NORMAL_TITLE"), &fontIndex, 1))
  70. setFont(1);
  71. if (ImGui::RadioButton(_("FONT_BOLD_TITLE"), &fontIndex, 2))
  72. setFont(2);
  73. ImGui::SeparatorText(_("SETTINGS_CUSTOMIZE"));
  74. ConfigSliderFloat(_("DURATION_ANIMATION_TITLE"), f_AnimationDuration, 0, 5.0f, _("DURATION_ANIMATION_DESCRIPTION"));
  75. ImGui::Checkbox(_("SHOW_STYLE_EDITOR_TITLE"), &show_style_editor);
  76. }
  77. void Settings::Outer() {
  78. if (f_Hotkey.IsPressed()) {
  79. f_ShowMenu.setValue(!f_ShowMenu.getValue());
  80. config::setValue("functions:Settings", "showMenu", f_ShowMenu.getValue());
  81. }
  82. if (f_HotkeyConsole.IsPressed())
  83. f_ShowConsole.setValue(!f_ShowConsole.getValue());
  84. if (f_ShowConsole.getValue())
  85. ShowWindow(GetConsoleWindow(), SW_SHOW);
  86. else
  87. ShowWindow(GetConsoleWindow(), SW_HIDE);
  88. if (f_ShowFps.getValue())
  89. DrawFPS();
  90. if (show_style_editor) {
  91. ImGui::Begin(_("STYLE_EDITOR_TITLE"), &show_style_editor);
  92. ImGui::ShowStyleEditor();
  93. ImGui::End();
  94. }
  95. }
  96. std::string Settings::getModule() {
  97. return _("MODULE_SETTINGS");
  98. }
  99. void DrawFPS() {
  100. ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus |
  101. ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize;
  102. ImGui::Begin("##FPS", NULL, flags);
  103. ImGui::Text("%s: %.1f", _("FPS_TITLE"), ImGui::GetIO().Framerate);
  104. ImGui::End();
  105. }
  106. }