Skip to content

Commit

Permalink
Reintroduce and utilize VisibilityXY method for UI updates
Browse files Browse the repository at this point in the history
The commented-out call to `VisibilityXY()` has been uncommented, making it active. The `VisibilityXY` method has been reintroduced to handle the visibility of UI elements based on the state of "X Axis Percentage Adjustment" and "Y Axis Percentage Adjustment" toggles.

The method is now called in various parts of the code, including when these toggles are clicked, when the "X Axis Percentage Adjustment" and "Y Axis Percentage Adjustment" cases are handled in a switch statement, and when the `ToggleAimConfig` method is called.

Additionally, minor formatting changes have been made for better readability. These changes enhance the dynamic behavior of the UI, making it more responsive to user interactions and configuration changes.
  • Loading branch information
TaylorIsBlue committed Aug 13, 2024
1 parent 754b22f commit c696bbf
Showing 1 changed file with 51 additions and 78 deletions.
129 changes: 51 additions & 78 deletions Aimmy2/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public MainWindow()
LoadDropdownStates();

LoadMenuMinimizers();
//VisibilityXY();
VisibilityXY();
PropertyChanger.ReceiveNewConfig = LoadConfig;

ActualFOV = Dictionary.sliderSettings["FOV Size"];
Expand All @@ -119,35 +119,6 @@ public MainWindow()
}

private async void LoadStoreMenuAsync() => await LoadStoreMenu();
//private void VisibilityXY()
//{
// // X/Y Percentage Adjustment Toggles
// bool xPercentageAdjustment = Dictionary.toggleState["X Axis Percentage Adjustment"];
// bool yPercentageAdjustment = Dictionary.toggleState["Y Axis Percentage Adjustment"];

// Application.Current.Dispatcher.Invoke(() =>
// {
// if (uiManager?.S_XOffset != null)
// {
// uiManager.S_XOffset.Visibility = xPercentageAdjustment ? Visibility.Collapsed : Visibility.Visible;
// }

// if (uiManager?.S_XOffsetPercent != null)
// {
// uiManager.S_XOffsetPercent.Visibility = xPercentageAdjustment ? Visibility.Visible : Visibility.Collapsed;
// }

// if (uiManager?.S_YOffset != null)
// {
// uiManager.S_YOffset.Visibility = yPercentageAdjustment ? Visibility.Collapsed : Visibility.Visible;
// }

// if (uiManager?.S_YOffsetPercent != null)
// {
// uiManager.S_YOffsetPercent.Visibility = yPercentageAdjustment ? Visibility.Visible : Visibility.Collapsed;
// }
// });
//}
private void Window_Loaded(object sender, RoutedEventArgs e) => AboutSpecs.Content = $"{GetProcessorName()}{GetVideoControllerName()}{GetFormattedMemorySize()}GB RAM";

private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => DragMove();
Expand Down Expand Up @@ -346,11 +317,11 @@ private void Toggle_Action(string title)
case "Show AI Confidence":
DPWindow.DetectedPlayerConfidence.Visibility = Dictionary.toggleState[title] ? Visibility.Visible : Visibility.Collapsed;
break;

case "Show FPS":
DPWindow.FpsLabel.Visibility = Dictionary.toggleState[title] ? Visibility.Visible : Visibility.Collapsed;
break;

case "Mouse Background Effect":
if (!Dictionary.toggleState[title]) { RotaryGradient.Angle = 0; }
break;
Expand All @@ -362,12 +333,12 @@ private void Toggle_Action(string title)
case "EMA Smoothening":
MouseManager.IsEMASmoothingEnabled = Dictionary.toggleState[title];
break;
//case "X Axis Percentage Adjustment":
// VisibilityXY();
// break;
//case "Y Axis Percentage Adjustment":
// VisibilityXY();
// break;
case "X Axis Percentage Adjustment":
VisibilityXY();
break;
case "Y Axis Percentage Adjustment":
VisibilityXY();
break;
}
}

Expand Down Expand Up @@ -845,19 +816,11 @@ private void LoadSettingsMenu()
SelectMouseEvent();
}
};

//uiManager.DDI_ddxoft = AddDropdownItem(uiManager.D_MouseMovementMethod, "ddxoft Virtual Input Driver");
//uiManager.DDI_ddxoft.Selected += async (sender, e) =>
//{
// if (!await DdxoftMain.Load())
// {
// SelectMouseEvent();
// }
//};



//uiManager.D_ScreenCaptureMethod = AddDropdown(SettingsConfig, "Screen Capture Method");
//AddDropdownItem(uiManager.D_ScreenCaptureMethod, "DirectX");

//AddDropdownItem(uiManager.D_ScreenCaptureMethod, "GDI+");

uiManager.S_AIMinimumConfidence = AddSlider(SettingsConfig, "AI Minimum Confidence", "% Confidence", 1, 1, 1, 100);
Expand All @@ -877,34 +840,12 @@ private void LoadSettingsMenu()

uiManager.AT_XYPercentageAdjustmentEnabler = AddTitle(XYPercentageEnablerMenu, "X/Y Percentage Adjustment", true);
uiManager.T_XAxisPercentageAdjustment = AddToggle(XYPercentageEnablerMenu, "X Axis Percentage Adjustment");
uiManager.T_YAxisPercentageAdjustment = AddToggle(XYPercentageEnablerMenu, "Y Axis Percentage Adjustment");

//uiManager.T_XAxisPercentageAdjustment.Reader.Click += (s, e) =>
//{
// bool isPercentageAdjustmentOn = Dictionary.toggleState["X Axis Percentage Adjustment"];
// if (uiManager?.S_XOffset != null && uiManager?.S_XOffsetPercent != null)
// {
// uiManager.S_XOffset.Visibility = isPercentageAdjustmentOn ? Visibility.Collapsed : Visibility.Visible;
// uiManager.S_XOffsetPercent.Visibility = isPercentageAdjustmentOn ? Visibility.Visible : Visibility.Collapsed;
// }
//};

//uiManager.T_YAxisPercentageAdjustment.Reader.Click += (s, e) =>
//{
// bool isPercentageAdjustmentOn = Dictionary.toggleState["Y Axis Percentage Adjustment"];
// if (uiManager?.S_YOffset != null && uiManager?.S_YOffsetPercent != null)
// {
// uiManager.S_YOffset.Visibility = isPercentageAdjustmentOn ? Visibility.Collapsed : Visibility.Visible;
// uiManager.S_YOffsetPercent.Visibility = isPercentageAdjustmentOn ? Visibility.Visible : Visibility.Collapsed;
// }
//};
uiManager.T_YAxisPercentageAdjustment = AddToggle(XYPercentageEnablerMenu, "Y Axis Percentage Adjustment");

AddSeparator(XYPercentageEnablerMenu);
uiManager.T_XAxisPercentageAdjustment.Reader.Click += (s, e) => VisibilityXY();
uiManager.T_YAxisPercentageAdjustment.Reader.Click += (s, e) => VisibilityXY();

// ddxoft Menu
//AddTitle(SSP2, "ddxoft Configurator");
//uiManager.AFL_ddxoftDLLLocator = AddFileLocator(SSP2, "ddxoft DLL Location", "ddxoft dll (*.dll)|*.dll");
//AddSeparator(SSP2);
AddSeparator(XYPercentageEnablerMenu);
}

private void LoadCreditsMenu()
Expand Down Expand Up @@ -980,10 +921,41 @@ private void DownloadGateway(StackPanel Scroller, HashSet<string> entries, strin
#endregion Menu Loading

#region Menu Minizations
private void VisibilityXY()
{
bool isMenuMinimized = Dictionary.minimizeState["Aim Config"];

bool xPercentageAdjustment = Dictionary.toggleState["X Axis Percentage Adjustment"];
bool yPercentageAdjustment = Dictionary.toggleState["Y Axis Percentage Adjustment"];

if (uiManager?.S_XOffset != null && uiManager?.S_XOffsetPercent != null)
{
if (isMenuMinimized == false)
{
uiManager.S_XOffset.Visibility = xPercentageAdjustment ? Visibility.Collapsed : Visibility.Visible;
uiManager.S_XOffsetPercent.Visibility = xPercentageAdjustment ? Visibility.Visible : Visibility.Collapsed;
}
}


if (uiManager?.S_YOffset != null && uiManager?.S_YOffsetPercent != null)
{
if (isMenuMinimized)
{
uiManager.S_YOffset.Visibility = yPercentageAdjustment ? Visibility.Collapsed : Visibility.Visible;
uiManager.S_YOffsetPercent.Visibility = yPercentageAdjustment ? Visibility.Visible : Visibility.Collapsed;
}
}
}

private void ToggleAimMenu() => SetMenuVisibility(AimAssist, !Dictionary.minimizeState["Aim Assist"]);

private void ToggleAimConfig() => SetMenuVisibility(AimConfig, !Dictionary.minimizeState["Aim Config"]);

private void ToggleAimConfig()
{
SetMenuVisibility(AimConfig, !Dictionary.minimizeState["Aim Config"]);
VisibilityXY();
}

private void ToggleAutoTrigger() => SetMenuVisibility(TriggerBot, !Dictionary.minimizeState["Auto Trigger"]);

Expand Down Expand Up @@ -1043,6 +1015,7 @@ private static void SetMenuVisibility(StackPanel panel, bool isVisible)
child.Visibility = Visibility.Visible;
}
}

}

#endregion Menu Minizations
Expand Down Expand Up @@ -1081,8 +1054,8 @@ private void LoadConfig(string path = "bin\\configs\\Default.cfg", bool loading_
uiManager.S_AIMinimumConfidence!.Slider.Value = MainWindow.GetValueOrDefault(Dictionary.sliderSettings, "AI Minimum Confidence", 50);
}
}
catch(Exception e)

catch (Exception e)
{
FileManager.LogError("Error loading config " + e);
MessageBox.Show($"Error loading config, possibly outdated\n{e}");
Expand Down

0 comments on commit c696bbf

Please sign in to comment.