Added command to toggle warnings feature

master
Mohammad Shoaib Khan 2022-08-18 12:37:32 +05:30
parent 895f329b8b
commit 3083ebca84
4 changed files with 34 additions and 22 deletions

View File

@ -15,21 +15,14 @@ namespace stardew_access
if (helper == null) if (helper == null)
return; return;
#region Read Tile
helper.ConsoleCommands.Add("readtile", "Toggle read tile feature.", (string commmand, string[] args) => helper.ConsoleCommands.Add("readtile", "Toggle read tile feature.", (string commmand, string[] args) =>
{ {
MainClass.Config.ReadTile = !MainClass.Config.ReadTile; MainClass.Config.ReadTile = !MainClass.Config.ReadTile;
helper.WriteConfig(MainClass.Config); helper.WriteConfig(MainClass.Config);
MainClass.DebugLog("Read Tile is " + (MainClass.Config.ReadTile ? "on" : "off")); MainClass.DebugLog("Read Tile is " + (MainClass.Config.ReadTile ? "on" : "off"));
}); });
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) =>
{
MainClass.Config.SnapMouse = !MainClass.Config.SnapMouse;
helper.WriteConfig(MainClass.Config);
MainClass.DebugLog("Snap Mouse is " + (MainClass.Config.SnapMouse ? "on" : "off"));
});
helper.ConsoleCommands.Add("flooring", "Toggle flooring in read tile.", (string commmand, string[] args) => helper.ConsoleCommands.Add("flooring", "Toggle flooring in read tile.", (string commmand, string[] args) =>
{ {
@ -46,6 +39,7 @@ namespace stardew_access
MainClass.DebugLog("Watered toggle is " + (MainClass.Config.WateredToggle ? "on" : "off")); MainClass.DebugLog("Watered toggle is " + (MainClass.Config.WateredToggle ? "on" : "off"));
}); });
#endregion
#region Radar Feature #region Radar Feature
helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) => helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) =>
@ -482,12 +476,13 @@ namespace stardew_access
}); });
#endregion #endregion
#region Other
helper.ConsoleCommands.Add("refsr", "Refresh screen reader", (string commmand, string[] args) => helper.ConsoleCommands.Add("refsr", "Refresh screen reader", (string commmand, string[] args) =>
{ {
MainClass.ScreenReader.InitializeScreenReader(); MainClass.ScreenReader.InitializeScreenReader();
MainClass.DebugLog("Screen Reader refreshed!"); MainClass.DebugLog("Screen Reader refreshed!");
}); });
helper.ConsoleCommands.Add("refmc", "Refresh mod config", (string commmand, string[] args) => helper.ConsoleCommands.Add("refmc", "Refresh mod config", (string commmand, string[] args) =>
{ {
@ -510,6 +505,23 @@ namespace stardew_access
MainClass.DebugLog("Speaking in percentage is " + (MainClass.Config.HealthNStaminaInPercentage ? "on" : "off")); MainClass.DebugLog("Speaking in percentage is " + (MainClass.Config.HealthNStaminaInPercentage ? "on" : "off"));
}); });
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) =>
{
MainClass.Config.SnapMouse = !MainClass.Config.SnapMouse;
helper.WriteConfig(MainClass.Config);
MainClass.DebugLog("Snap Mouse is " + (MainClass.Config.SnapMouse ? "on" : "off"));
});
helper.ConsoleCommands.Add("warning", "Toggle warnings feature.", (string commmand, string[] args) =>
{
MainClass.Config.Warning = !MainClass.Config.Warning;
helper.WriteConfig(MainClass.Config);
MainClass.DebugLog("Warnings is " + (MainClass.Config.Warning ? "on" : "off"));
});
#endregion
} }
} }
} }

View File

@ -28,9 +28,6 @@ namespace stardew_access.Features
if (this.shouldPause) if (this.shouldPause)
return; return;
if (!MainClass.Config.ReadTile)
return;
this.isBusy = true; this.isBusy = true;
this.run(); this.run();
Task.Delay(delay).ContinueWith(_ => { this.isBusy = false; }); Task.Delay(delay).ContinueWith(_ => { this.isBusy = false; });

View File

@ -77,6 +77,7 @@ namespace stardew_access
public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q"); // Narrate the time of day, day and date and season public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q"); // Narrate the time of day, day and date and season
public Boolean VerboseCoordinates { get; set; } = true; public Boolean VerboseCoordinates { get; set; } = true;
public Boolean SnapMouse { get; set; } = true; // Toggles the snap mouse feature public Boolean SnapMouse { get; set; } = true; // Toggles the snap mouse feature
public Boolean Warning { get; set; } = true; // Toggles the warnings feature
// TODO add command to toggle warning feature // TODO add command to toggle warning feature
#endregion #endregion

View File

@ -168,9 +168,11 @@ namespace stardew_access
//handle TileCursor update logic //handle TileCursor update logic
TileViewerFeature.update(); TileViewerFeature.update();
WarningsFeature.update(); if (Config.Warning)
WarningsFeature.update();
ReadTileFeature.update(); if (Config.ReadTile)
ReadTileFeature.update();
if (!RadarFeature.isRunning && Config.Radar) if (!RadarFeature.isRunning && Config.Radar)
{ {