Skip to content

Commit

Permalink
Add TrackerTimerEnabled option
Browse files Browse the repository at this point in the history
  • Loading branch information
MattEqualsCoder committed Jul 14, 2024
1 parent 33e6cce commit d05bdd9
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/TrackerCouncil.Smz3.Data/Options/GeneralOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class GeneralOptions : INotifyPropertyChanged
public bool TrackerHintsEnabled { get; set; }

public bool TrackerSpoilersEnabled { get; set; }
public bool TrackerTimerEnabled { get; set; } = true;

public EmulatorConnectorType AutoTrackerDefaultConnectionType { get; set; }

Expand Down Expand Up @@ -256,7 +257,8 @@ public bool Validate()
GanonsTowerGuessingGameStyle = GanonsTowerGuessingGameStyle,
SpeechRecognitionMode = SpeechRecognitionMode,
PushToTalkKey = PushToTalkKey,
PushToTalkDevice = PushToTalkDevice
PushToTalkDevice = PushToTalkDevice,
TrackerTimerEnabled = TrackerTimerEnabled
};

protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
Expand Down
5 changes: 5 additions & 0 deletions src/TrackerCouncil.Smz3.Data/Options/TrackerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,9 @@ public record TrackerOptions
/// Device to be used for push to talk mode
/// </summary>
public string PushToTalkDevice { get; set; } = "Default";

/// <summary>
/// Whether the timer should be displayed and timer voice lines should be enabled
/// </summary>
public bool TrackerTimerEnabled { get; set; } = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,8 @@ public class OptionsWindowTrackerOptions
[DynamicFormFieldCheckBox(checkBoxText: "Enable spoilers", groupName: "Bottom", platforms: DynamicFormPlatform.Windows)]
public bool TrackerSpoilersEnabled { get; set; } = true;

[DynamicFormFieldCheckBox(checkBoxText: "Enable timer", groupName: "Bottom")]
public bool TrackerTimerEnabled { get; set; } = true;

public Dictionary<string, string> AudioDevices { get; set; } = new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public OptionsWindowViewModel(GeneralOptions options, Dictionary<string, string>
TrackerOptions.TrackerHintsEnabled = options.TrackerHintsEnabled;
TrackerOptions.TrackerSpoilersEnabled = options.TrackerSpoilersEnabled;
TrackerOptions.AudioDevices = audioInputDevices;
TrackerOptions.TrackerTimerEnabled = options.TrackerTimerEnabled;

TwitchIntegration.TwitchUserName = options.TwitchUserName;
TwitchIntegration.TwitchChannel = options.TwitchChannel;
Expand Down Expand Up @@ -101,6 +102,7 @@ public void UpdateOptions(GeneralOptions options)
options.AutoSaveLookAtEvents = TrackerOptions.AutoSaveLookAtEvents;
options.TrackerHintsEnabled = TrackerOptions.TrackerHintsEnabled;
options.TrackerSpoilersEnabled = TrackerOptions.TrackerSpoilersEnabled;
options.TrackerTimerEnabled = TrackerOptions.TrackerTimerEnabled;

options.TwitchUserName = TwitchIntegration.TwitchUserName;
options.TwitchChannel = TwitchIntegration.TwitchChannel;
Expand Down
25 changes: 14 additions & 11 deletions src/TrackerCouncil.Smz3.Tracking/VoiceCommands/MetaModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,23 @@ public override void AddCommands()
}
});

AddCommand("Pause timer", GetPauseTimerRule(), (_) =>
if (TrackerBase.Options.TrackerTimerEnabled)
{
TrackerBase.PauseTimer();
});
AddCommand("Pause timer", GetPauseTimerRule(), (_) =>
{
TrackerBase.PauseTimer();
});

AddCommand("Start timer", GetResumeTimerRule(), (_) =>
{
TrackerBase.StartTimer();
});
AddCommand("Start timer", GetResumeTimerRule(), (_) =>
{
TrackerBase.StartTimer();
});

AddCommand("Reset timer", GetResetTimerRule(), (_) =>
{
TrackerBase.ResetTimer();
});
AddCommand("Reset timer", GetResetTimerRule(), (_) =>
{
TrackerBase.ResetTimer();
});
}

AddCommand("Mute", GetMuteRule(), (_) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public TrackerWindowViewModel GetViewModel(TrackerWindow parent)
_model.Background = new SolidColorBrush(Color.FromArgb(bytes[0], bytes[1], bytes[2], bytes[3]));
_model.OpenTrackWindow = Options.GeneralOptions.DisplayMsuTrackWindow;
_model.AddShadows = Options.GeneralOptions.TrackerShadows;
_model.DisplayTimer = Options.GeneralOptions.TrackerTimerEnabled;

LocationViewModel.KeyImage = uiService.GetSpritePath("Items", "key.png", out _);
RegionViewModel.ChestImage = uiService.GetSpritePath("Items", "chest.png", out _);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using Avalonia.Media;
using AvaloniaControls.Models;
Expand Down Expand Up @@ -46,7 +47,7 @@ public class TrackerWindowViewModel : ViewModelBase
[ReactiveLinkedProperties(nameof(StatusBarBackground), nameof(StatusBarBorder))]
public bool IsInGoMode { get; set; }

[Reactive] public bool ShowSpeechRecognition { get; set; } = true;
public bool ShowSpeechRecognition => OperatingSystem.IsWindows();

[Reactive] public string SpeechConfidence { get; set; } = "Voice Disabled";

Expand All @@ -55,6 +56,7 @@ public class TrackerWindowViewModel : ViewModelBase
[Reactive]
[ReactiveLinkedProperties(nameof(SpeechToolTip), nameof(SpeechIcon))]
public bool VoiceEnabled { get; set; }
public bool DisplayTimer { get; set; }

public string SpeechToolTip => VoiceEnabled ? "Confidence of last recognized voice command. Double click to disable voice recognition." : "Voice recognition disabled. Double click to attempt to enable voice recognition.";

Expand Down
4 changes: 3 additions & 1 deletion src/TrackerCouncil.Smz3.UI/Views/TrackerWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
PointerPressed="TimeTextBlock_OnPointerPressed"
ToolTip.Tip="Elapsed time. Right click to pause/resume. Double click to reset."
Background="Transparent"
Margin="0 0 10 0"
IsVisible="{Binding DisplayTimer}"
>
<avalonia:MaterialIcon Kind="Clock" Height="16"/>
<TextBlock Name="TimeTextBlock"
Expand All @@ -68,7 +70,7 @@
></TextBlock>
</StackPanel>

<controls:ImageButton Cursor="Hand" Margin="10 0 0 0" Background="Transparent">
<controls:ImageButton Cursor="Hand" Background="Transparent">
<controls:ImageButton.ContextMenu>
<ContextMenu>
<MenuItem Header="Disable Auto Tracker" Name="DisableAutoTrackerMenuItem" Click="DisableAutoTrackerMenuItem_OnClick">
Expand Down

0 comments on commit d05bdd9

Please sign in to comment.