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.Input;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;/// <summary>Whether the game is creating the save file and SMAPI has already raised <see cref="SaveEvents.BeforeCreate"/>.</summary>privateboolIsBetweenCreateEvents;/**** ** Game state ****//// <summary>The player input as of the previous tick.</summary>privateInputStatePreviousInput=newInputState();/// <summary>The window size value at last check.</summary>privatePointPreviousWindowSize;/// <summary>The save ID at last check.</summary>privateulongPreviousSaveID;/// <summary>A hash of <see cref="Game1.locations"/> at last check.</summary>privateintPreviousGameLocations;/// <summary>A hash of the current location's <see cref="GameLocation.objects"/> at last check.</summary>privateintPreviousLocationObjects;/// <summary>The player's inventory at last check.</summary>privateIDictionary<Item,