diff --git a/D4Companion.Constants/ScreenCaptureConstants.cs b/D4Companion.Constants/ScreenCaptureConstants.cs index 8a1a9b7c..7e446f98 100644 --- a/D4Companion.Constants/ScreenCaptureConstants.cs +++ b/D4Companion.Constants/ScreenCaptureConstants.cs @@ -2,7 +2,7 @@ { public class ScreenCaptureConstants { - public const int Delay = 50; + public const int DefaultDelay = 50; public const int DelayError = 10000; public const int DelayErrorShort = 1000; public const int DelayMouse = 100; diff --git a/D4Companion.Entities/SettingsD4.cs b/D4Companion.Entities/SettingsD4.cs index 5bcb9b3b..823972a7 100644 --- a/D4Companion.Entities/SettingsD4.cs +++ b/D4Companion.Entities/SettingsD4.cs @@ -20,14 +20,17 @@ public class SettingsD4 public Color DefaultColorAspects { get; set; } = Colors.Green; public bool DevMode { get; set; } = false; public bool DungeonTiers { get; set; } = true; + public bool IsAspectDetectionEnabled { get; set; } = true; public bool IsItemPowerLimitEnabled { get; set; } = false; public int ItemPowerLimit { get; set; } = 925; public bool IsDebugInfoEnabled { get; set; } = false; + public bool IsTemperedAffixDetectionEnabled { get; set; } = true; public bool IsTopMost { get; set; } = false; public int MinimalOcrMatchType { get; set; } = 80; public int OverlayFontSize { get; set; } = 18; public int OverlayIconPosX { get; set; } = 0; public int OverlayIconPosY { get; set; } = 0; + public int ScreenCaptureDelay { get; set; } = 50; public string SelectedAffixLanguage { get; set; } = "enUS"; public string SelectedAppLanguage { get; set; } = "en-US"; public string SelectedAffixPreset { get; set; } = string.Empty; diff --git a/D4Companion.Localization/Resources.Designer.cs b/D4Companion.Localization/Resources.Designer.cs index 66734452..b627de77 100644 --- a/D4Companion.Localization/Resources.Designer.cs +++ b/D4Companion.Localization/Resources.Designer.cs @@ -132,6 +132,15 @@ internal static string rsCapAspectAreaHeightOffsetTop { } } + /// + /// Looks up a localized string similar to Aspect Detection. + /// + internal static string rsCapAspectDetection { + get { + return ResourceManager.GetString("rsCapAspectDetection", resourceCulture); + } + } + /// /// Looks up a localized string similar to OCR Results (Aspect). /// @@ -411,6 +420,15 @@ internal static string rsCapExperimentalfeatures { } } + /// + /// Looks up a localized string similar to Features. + /// + internal static string rsCapFeatures { + get { + return ResourceManager.GetString("rsCapFeatures", resourceCulture); + } + } + /// /// Looks up a localized string similar to File Name: . /// @@ -429,6 +447,15 @@ internal static string rsCapGearAffixPresets { } } + /// + /// Looks up a localized string similar to General. + /// + internal static string rsCapGeneral { + get { + return ResourceManager.GetString("rsCapGeneral", resourceCulture); + } + } + /// /// Looks up a localized string similar to Gloves. /// @@ -870,6 +897,15 @@ internal static string rsCapRogue { } } + /// + /// Looks up a localized string similar to Screencapture Delay. + /// + internal static string rsCapScreenCaptureDelay { + get { + return ResourceManager.GetString("rsCapScreenCaptureDelay", resourceCulture); + } + } + /// /// Looks up a localized string similar to Seasonal. /// @@ -1014,6 +1050,15 @@ internal static string rsCapTempered { } } + /// + /// Looks up a localized string similar to Tempered Affix Detection. + /// + internal static string rsCapTemperedAffixDetection { + get { + return ResourceManager.GetString("rsCapTemperedAffixDetection", resourceCulture); + } + } + /// /// Looks up a localized string similar to Toggle Controller. /// @@ -1149,6 +1194,15 @@ internal static string rsTooltipAddPreset { } } + /// + /// Looks up a localized string similar to Toggle detection of aspects.. + /// + internal static string rsTooltipAspectDetection { + get { + return ResourceManager.GetString("rsTooltipAspectDetection", resourceCulture); + } + } + /// /// Looks up a localized string similar to Check for updates at startup.. /// @@ -1464,6 +1518,15 @@ internal static string rsTooltipRemovePreset { } } + /// + /// Looks up a localized string similar to Time in ms between screencaptures. Default 50ms.. + /// + internal static string rsTooltipScreenCaptureDelay { + get { + return ResourceManager.GetString("rsTooltipScreenCaptureDelay", resourceCulture); + } + } + /// /// Looks up a localized string similar to Seasonal. /// @@ -1536,6 +1599,15 @@ internal static string rsTooltipTakeScreenshot { } } + /// + /// Looks up a localized string similar to Toggle detection of tempered affixes.. + /// + internal static string rsTooltipTemperedAffixDetection { + get { + return ResourceManager.GetString("rsTooltipTemperedAffixDetection", resourceCulture); + } + } + /// /// Looks up a localized string similar to Toggle the controller mode on/off.. /// diff --git a/D4Companion.Localization/Resources.resx b/D4Companion.Localization/Resources.resx index 2cf9cfca..27b17d23 100644 --- a/D4Companion.Localization/Resources.resx +++ b/D4Companion.Localization/Resources.resx @@ -604,4 +604,28 @@ Normal + + General + + + Features + + + Screencapture Delay + + + Time in ms between screencaptures. Default 50ms. + + + Tempered Affix Detection + + + Toggle detection of tempered affixes. + + + Aspect Detection + + + Toggle detection of aspects. + \ No newline at end of file diff --git a/D4Companion.Services/ScreenCaptureHandler.cs b/D4Companion.Services/ScreenCaptureHandler.cs index 45bf2fee..4e190425 100644 --- a/D4Companion.Services/ScreenCaptureHandler.cs +++ b/D4Companion.Services/ScreenCaptureHandler.cs @@ -19,7 +19,7 @@ public class ScreenCaptureHandler : IScreenCaptureHandler private Bitmap? _currentScreen = null; private double _delayUpdateMouse = ScreenCaptureConstants.DelayMouse; - private double _delayUpdateScreen = ScreenCaptureConstants.Delay; + private double _delayUpdateScreen = ScreenCaptureConstants.DefaultDelay; private bool _isEnabled = false; private bool _isSaveScreenshotRequested = false; private ScreenCapture _screenCapture = new ScreenCapture(); @@ -219,7 +219,7 @@ private void UpdateScreen() }); } - _delayUpdateScreen = ScreenCaptureConstants.Delay; + _delayUpdateScreen = _settingsManager.Settings.ScreenCaptureDelay; } else { diff --git a/D4Companion.Services/ScreenProcessHandler.cs b/D4Companion.Services/ScreenProcessHandler.cs index c78da436..a96c5bba 100644 --- a/D4Companion.Services/ScreenProcessHandler.cs +++ b/D4Companion.Services/ScreenProcessHandler.cs @@ -331,8 +331,10 @@ private void ProcessScreen(Bitmap currentScreen) }, () => { - // Only search for aspects when the item tooltip contains one. - if (!_currentTooltip.ItemAspectLocation.IsEmpty && !_currentTooltip.IsUniqueItem) + // Aspect detection should be enabled, + // and only search for aspects when the item tooltip contains one. + if (_settingsManager.Settings.IsAspectDetectionEnabled && + !_currentTooltip.ItemAspectLocation.IsEmpty && !_currentTooltip.IsUniqueItem) { FindItemAspects(); } @@ -815,6 +817,12 @@ private bool FindItemAffixes() bool IsDebugInfoEnabled = _settingsManager.Settings.IsDebugInfoEnabled; + // Delete tempered affixes areas when disabled + if (!_settingsManager.Settings.IsTemperedAffixDetectionEnabled) + { + _currentTooltip.ItemAffixAreas.RemoveAll(a => a.AffixType.Equals(Constants.AffixTypeConstants.Tempered)); + } + // Create image for each area var currentScreenTooltip = _currentScreenTooltipFilter.Convert(); var areaImages = new List>(); diff --git a/D4Companion/ViewModels/Dialogs/OverlayConfigViewModel.cs b/D4Companion/ViewModels/Dialogs/OverlayConfigViewModel.cs index 98b0b227..02619d93 100644 --- a/D4Companion/ViewModels/Dialogs/OverlayConfigViewModel.cs +++ b/D4Companion/ViewModels/Dialogs/OverlayConfigViewModel.cs @@ -61,6 +61,18 @@ public OverlayConfigViewModel(Action closeHandler) public ObservableCollection OverlayMarkerModes { get => _overlayMarkerModes; set => _overlayMarkerModes = value; } public ObservableCollection SigilDisplayModes { get => _sigilDisplayModes; set => _sigilDisplayModes = value; } + public bool IsAspectDetectionEnabled + { + get => _settingsManager.Settings.IsAspectDetectionEnabled; + set + { + _settingsManager.Settings.IsAspectDetectionEnabled = value; + RaisePropertyChanged(nameof(IsAspectDetectionEnabled)); + + _settingsManager.SaveSettings(); + } + } + public bool IsDungeonTiersEnabled { get => _settingsManager.Settings.DungeonTiers; @@ -86,6 +98,18 @@ public bool IsItemPowerLimitEnabled } } + public bool IsTemperedAffixDetectionEnabled + { + get => _settingsManager.Settings.IsTemperedAffixDetectionEnabled; + set + { + _settingsManager.Settings.IsTemperedAffixDetectionEnabled = value; + RaisePropertyChanged(nameof(IsTemperedAffixDetectionEnabled)); + + _settingsManager.SaveSettings(); + } + } + public int ItemPowerLimit { get => _settingsManager.Settings.ItemPowerLimit; @@ -134,6 +158,18 @@ public int OverlayIconPosY } } + public int ScreenCaptureDelay + { + get => _settingsManager.Settings.ScreenCaptureDelay; + set + { + _settingsManager.Settings.ScreenCaptureDelay = value; + RaisePropertyChanged(nameof(ScreenCaptureDelay)); + + _settingsManager.SaveSettings(); + } + } + public string SelectedOverlayMarkerMode { get => _settingsManager.Settings.SelectedOverlayMarkerMode; diff --git a/D4Companion/Views/Dialogs/OverlayConfigView.xaml b/D4Companion/Views/Dialogs/OverlayConfigView.xaml index 520af2cd..8fa5375a 100644 --- a/D4Companion/Views/Dialogs/OverlayConfigView.xaml +++ b/D4Companion/Views/Dialogs/OverlayConfigView.xaml @@ -10,104 +10,185 @@ mah:DialogParticipation.Register="{Binding}" mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="500"> - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + - - - + + - - - - + + + + + + -