Added keybind for money and time narration

master
shoaib11120 2021-12-20 23:43:24 +05:30
parent 8fe6d37d4b
commit 329154bea6
3 changed files with 58 additions and 24 deletions

View File

@ -52,7 +52,28 @@ namespace stardew_access.Game
public static string getTimeOfDay()
{
int timeOfDay = Game1.timeOfDay;
return timeOfDay.ToString();
int minutes = timeOfDay % 100;
int hours = timeOfDay / 100;
string amOrpm = "A M";
if(hours>=12)
{
amOrpm = "P M";
if (hours > 12)
hours -= 12;
}
return $"{hours}:{minutes} {amOrpm}";
}
public static string getSeason()
{
return Game1.CurrentSeasonDisplayName;
}
public static int getDay()
{
return Game1.dayOfMonth;
}
public static int getMoney()

View File

@ -159,8 +159,9 @@ namespace stardew_access
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
{
if (Game1.activeClickableMenu == null)
{
if (!Context.IsPlayerFree)
return;
// Narrate health and stamina
if (Equals(e.Button, SButton.H))
{
@ -175,6 +176,20 @@ namespace stardew_access
ScreenReader.say(toSpeak, true);
}
// Narrate money at hand
if (Equals(e.Button, SButton.R))
{
string toSpeak = $"You have {CurrentPlayer.getMoney()}g";
ScreenReader.say(toSpeak, true);
}
// Narrate time and season
if (Equals(e.Button, SButton.Q))
{
string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and season is {CurrentPlayer.getSeason()}";
ScreenReader.say(toSpeak, true);
}
if (Equals(e.Button, SButton.J))
{
Game1.pressActionButton(Game1.input.GetKeyboardState(), Game1.input.GetMouseState(), Game1.input.GetGamePadState());
@ -184,8 +199,6 @@ namespace stardew_access
{
Game1.pressUseToolButton();
}
}
}
private void SnapMouseToPlayer()

View File

@ -1,7 +1,7 @@
{
"Name": "Stardew Access",
"Author": "Mohammad Shoaib",
"Version": "1.0.6-beta",
"Version": "1.0.7-beta",
"Description": "An accessibility mod with screen reader support!",
"UniqueID": "shoaib.stardewaccess",
"EntryDll": "stardew-access.dll",