usingSystem;usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingSystem.Diagnostics.CodeAnalysis;usingSystem.Linq;usingSystem.Threading;usingSystem.Threading.Tasks;usingMicrosoft.Xna.Framework;usingMicrosoft.Xna.Framework.Graphics;usingMicrosoft.Xna.Framework.Input;usingStardewModdingAPI.Events;usingStardewModdingAPI.Framework.Reflection;usingStardewModdingAPI.Framework.Utilities;usingStardewValley;usingStardewValley.BellsAndWhistles;usingStardewValley.Locations;usingStardewValley.Menus;usingStardewValley.Tools;usingxTile.Dimensions;usingxTile.Layers;namespaceStardewModdingAPI.Framework{/// <summary>SMAPI's extension of the game's core <see cref="Game1"/>, used to inject events.</summary>internalclassSGame:Game1{/********* ** Properties *********//**** ** SMAPI state ****//// <summary>Encapsulates monitoring and logging.</summary>privatereadonlyIMonitorMonitor;/// <summary>The maximum number of consecutive attempts SMAPI should make to recover from a draw error.</summary>privatereadonlyCountdownDrawCrashTimer=newCountdown(60);// 60 ticks = roughly one second/// <summary>The maximum number of consecutive attempts SMAPI should make to recover from an update error.</summary>privatereadonlyCountdownUpdateCrashTimer=newCountdown(60);// 60 ticks = roughly one second/// <summary>The number of ticks until SMAPI should notify mods that the game has loaded.</summary>/// <remarks>Skipping a few frames ensures the game finishes initialising the world before mods try to change it.</remarks>privateintAfterLoadTimer=5;/// <summary>Whether the game is returning to the menu.</summary>privateboolIsExitingToTitle;/// <summary>Whether the game is saving and SMAPI has already raised <see cref="SaveEvents.BeforeSave"/>.</summary>privateboolIsBetweenSaveEvents;/**** ** Game state ****//// <summary>A record of the buttons pressed as of the previous tick.</summary>privateSButton[]PreviousPressedButtons=newSButton[0];/// <summary>A record of the keyboard state (i.e. the up/down state for each button) as of the previous tick.</summary>privateKeyboardStatePreviousKeyState;/// <summary>A record of the controller state (i.e. the up/down state for each button) as of the previous tick.</summary>privateGamePadStatePreviousControllerState;