Added keybind for money and time narration
This commit is contained in:
		| @@ -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() | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -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", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user