From 524dc9e002d86e81c1e38827a2303cc83b71eba7 Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Sun, 28 Feb 2016 22:16:32 -0500 Subject: expose some private fields for modding --- BobberBar Private Fields.txt | 40 +++ Game1 Static Fields.txt | 329 +++++++++++++++++++++ Release/StardewModdingAPI.exe | Bin 38912 -> 40960 bytes StardewModdingAPI/Extensions.cs | 4 +- StardewModdingAPI/Inheritance/Menus/SBobberBar.cs | 33 +++ .../Inheritance/Minigames/SMinigameBase.cs | 38 +++ StardewModdingAPI/Inheritance/SGame.cs | 75 +++++ StardewModdingAPI/Program.cs | 18 ++ StardewModdingAPI/SGame.cs | 66 ----- StardewModdingAPI/StardewModdingAPI.csproj | 5 +- 10 files changed, 539 insertions(+), 69 deletions(-) create mode 100644 BobberBar Private Fields.txt create mode 100644 Game1 Static Fields.txt create mode 100644 StardewModdingAPI/Inheritance/Menus/SBobberBar.cs create mode 100644 StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs create mode 100644 StardewModdingAPI/Inheritance/SGame.cs delete mode 100644 StardewModdingAPI/SGame.cs diff --git a/BobberBar Private Fields.txt b/BobberBar Private Fields.txt new file mode 100644 index 00000000..2784f0e7 --- /dev/null +++ b/BobberBar Private Fields.txt @@ -0,0 +1,40 @@ +Single difficulty +Int32 motionType +Int32 whichFish +Single bobberPosition +Single bobberSpeed +Single bobberAcceleration +Single bobberTargetPosition +Single scale +Single everythingShakeTimer +Single floaterSinkerAcceleration +Single treasurePosition +Single treasureCatchLevel +Single treasureAppearTimer +Single treasureScale +Boolean bobberInBar +Boolean buttonPressed +Boolean flipBubble +Boolean fadeIn +Boolean fadeOut +Boolean treasure +Boolean treasureCaught +Boolean perfect +Boolean bossFish +Int32 bobberBarHeight +Int32 fishSize +Int32 fishQuality +Int32 minFishSize +Int32 maxFishSize +Int32 fishSizeReductionTimer +Int32 whichBobber +Microsoft.Xna.Framework.Vector2 barShake +Microsoft.Xna.Framework.Vector2 fishShake +Microsoft.Xna.Framework.Vector2 everythingShake +Microsoft.Xna.Framework.Vector2 treasureShake +Single reelRotation +StardewValley.BellsAndWhistles.SparklingText sparkleText +Single bobberBarPos +Single bobberBarSpeed +Single bobberBarAcceleration +Single distanceFromCatching \ No newline at end of file diff --git a/Game1 Static Fields.txt b/Game1 Static Fields.txt new file mode 100644 index 00000000..4580f95f --- /dev/null +++ b/Game1 Static Fields.txt @@ -0,0 +1,329 @@ +Int32 pixelZoom +Int32 tileSize +System.String version +Microsoft.Xna.Framework.GraphicsDeviceManager graphics +Microsoft.Xna.Framework.Content.ContentManager content +Microsoft.Xna.Framework.Content.ContentManager temporaryContent +Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch +Microsoft.Xna.Framework.Input.GamePadState oldPadState +Single thumbStickSensitivity +Single runThreshold +Microsoft.Xna.Framework.Input.KeyboardState oldKBState +Microsoft.Xna.Framework.Input.MouseState oldMouseState +System.Collections.Generic.List`1[StardewValley.GameLocation] locations +StardewValley.GameLocation currentLocation +StardewValley.GameLocation locationAfterWarp +xTile.Display.IDisplayDevice mapDisplayDevice +StardewValley.Farmer player +StardewValley.Farmer serverHost +xTile.Dimensions.Rectangle viewport +Microsoft.Xna.Framework.Graphics.Texture2D objectSpriteSheet +Microsoft.Xna.Framework.Graphics.Texture2D toolSpriteSheet +Microsoft.Xna.Framework.Graphics.Texture2D cropSpriteSheet +Microsoft.Xna.Framework.Graphics.Texture2D mailboxTexture +Microsoft.Xna.Framework.Graphics.Texture2D emoteSpriteSheet +Microsoft.Xna.Framework.Graphics.Texture2D debrisSpriteSheet +Microsoft.Xna.Framework.Graphics.Texture2D toolIconBox +Microsoft.Xna.Framework.Graphics.Texture2D rainTexture +Microsoft.Xna.Framework.Graphics.Texture2D bigCraftableSpriteSheet +Microsoft.Xna.Framework.Graphics.Texture2D swordSwipe +Microsoft.Xna.Framework.Graphics.Texture2D swordSwipeDark +Microsoft.Xna.Framework.Graphics.Texture2D buffsIcons +Microsoft.Xna.Framework.Graphics.Texture2D daybg +Microsoft.Xna.Framework.Graphics.Texture2D nightbg +Microsoft.Xna.Framework.Graphics.Texture2D logoScreenTexture +Microsoft.Xna.Framework.Graphics.Texture2D tvStationTexture +Microsoft.Xna.Framework.Graphics.Texture2D cloud +Microsoft.Xna.Framework.Graphics.Texture2D menuTexture +Microsoft.Xna.Framework.Graphics.Texture2D lantern +Microsoft.Xna.Framework.Graphics.Texture2D windowLight +Microsoft.Xna.Framework.Graphics.Texture2D sconceLight +Microsoft.Xna.Framework.Graphics.Texture2D cauldronLight +Microsoft.Xna.Framework.Graphics.Texture2D shadowTexture +Microsoft.Xna.Framework.Graphics.Texture2D mouseCursors +Microsoft.Xna.Framework.Graphics.Texture2D indoorWindowLight +Microsoft.Xna.Framework.Graphics.Texture2D animations +Microsoft.Xna.Framework.Graphics.Texture2D titleScreenBG +Microsoft.Xna.Framework.Graphics.Texture2D logo +Microsoft.Xna.Framework.Graphics.RenderTarget2D lightmap +Microsoft.Xna.Framework.Graphics.Texture2D fadeToBlackRect +Microsoft.Xna.Framework.Graphics.Texture2D staminaRect +Microsoft.Xna.Framework.Graphics.Texture2D currentCoopTexture +Microsoft.Xna.Framework.Graphics.Texture2D currentBarnTexture +Microsoft.Xna.Framework.Graphics.Texture2D currentHouseTexture +Microsoft.Xna.Framework.Graphics.Texture2D greenhouseTexture +Microsoft.Xna.Framework.Graphics.Texture2D littleEffect +Microsoft.Xna.Framework.Graphics.SpriteFont dialogueFont +Microsoft.Xna.Framework.Graphics.SpriteFont smallFont +Microsoft.Xna.Framework.Graphics.SpriteFont borderFont +Microsoft.Xna.Framework.Graphics.SpriteFont tinyFont +Microsoft.Xna.Framework.Graphics.SpriteFont tinyFontBorder +Microsoft.Xna.Framework.Graphics.SpriteFont smoothFont +Single fadeToBlackAlpha +Single pickToolInterval +Single screenGlowAlpha +Single flashAlpha +Single starCropShimmerPause +Single noteBlockTimer +Single globalFadeSpeed +Boolean fadeToBlack +Boolean fadeIn +Boolean dialogueUp +Boolean dialogueTyping +Boolean pickingTool +Boolean isQuestion +Boolean nonWarpFade +Boolean particleRaining +Boolean newDay +Boolean inMine +Boolean isEating +Boolean menuUp +Boolean eventUp +Boolean viewportFreeze +Boolean eventOver +Boolean nameSelectUp +Boolean screenGlow +Boolean screenGlowHold +Boolean screenGlowUp +Boolean progressBar +Boolean isRaining +Boolean isSnowing +Boolean killScreen +Boolean coopDwellerBorn +Boolean messagePause +Boolean isDebrisWeather +Boolean boardingBus +Boolean listeningForKeyControlDefinitions +Boolean weddingToday +Boolean exitToTitle +Boolean debugMode +Boolean isLightning +Boolean displayHUD +Boolean displayFarmer +Boolean showKeyHelp +Boolean inputMode +Boolean shippingTax +Boolean dialogueButtonShrinking +Boolean jukeboxPlaying +Boolean drawLighting +Boolean bloomDay +Boolean quit +Boolean isChatting +Boolean globalFade +Boolean drawGrid +Boolean freezeControls +Boolean saveOnNewDay +Boolean panMode +Boolean showingEndOfNightStuff +Boolean wasRainingYesterday +Boolean hasLoadedGame +Boolean isActionAtCurrentCursorTile +Boolean isInspectionAtCurrentCursorTile +Boolean paused +Boolean lastCursorMotionWasMouse +System.String currentSeason +System.String debugOutput +System.String nextMusicTrack +System.String selectedItemsType +System.String nameSelectType +System.String messageAfterPause +System.String fertilizer +System.String samBandName +System.String elliottBookName +System.String slotResult +System.String keyHelpString +System.String debugInput +System.String loadingMessage +System.String errorMessage +System.Collections.Generic.Queue`1[System.String] currentObjectDialogue +System.Collections.Generic.Queue`1[System.String] mailbox +System.Collections.Generic.List`1[System.String] questionChoices +Int32 xLocationAfterWarp +Int32 yLocationAfterWarp +Int32 gameTimeInterval +Int32 currentQuestionChoice +Int32 currentDialogueCharacterIndex +Int32 dialogueTypingInterval +Int32 dayOfMonth +Int32 year +Int32 timeOfDay +Int32 numberOfSelectedItems +Int32 priceOfSelectedItem +Int32 currentWallpaper +Int32 farmerWallpaper +Int32 wallpaperPrice +Int32 currentFloor +Int32 FarmerFloor +Int32 floorPrice +Int32 dialogueWidth +Int32 countdownToWedding +Int32 menuChoice +Int32 tvStation +Int32 currentBillboard +Int32 facingDirectionAfterWarp +Int32 tmpTimeOfDay +Int32 percentageToWinStardewHero +Int32 mouseClickPolling +Int32 weatherIcon +Int32 hitShakeTimer +Int32 staminaShakeTimer +Int32 pauseThenDoFunctionTimer +Int32 weatherForTomorrow +Int32 currentSongIndex +Int32 cursorTileHintCheckTimer +Int32 timerUntilMouseFade +Int32 minecartHighScore +System.Collections.Generic.List`1[System.Int32] dealerCalicoJackTotal +Microsoft.Xna.Framework.Color morningColor +Microsoft.Xna.Framework.Color eveningColor +Microsoft.Xna.Framework.Color unselectedOptionColor +Microsoft.Xna.Framework.Color screenGlowColor +StardewValley.NPC currentSpeaker +System.Random random +System.Random recentMultiplayerRandom +System.Collections.Generic.Dictionary`2[System.Int32,System.String] objectInformation +System.Collections.Generic.Dictionary`2[System.Int32,System.String] bigCraftablesInformation +System.Collections.Generic.List`1[StardewValley.Object] shippingBin +StardewValley.Locations.MineShaft mine +System.Collections.Generic.List`1[StardewValley.HUDMessage] hudMessages +System.Collections.Generic.Dictionary`2[System.String,System.Boolean] eventConditions +System.Collections.Generic.Dictionary`2[System.String,System.String] NPCGiftTastes +Single musicPlayerVolume +Single pauseAccumulator +Single pauseTime +Single upPolling +Single downPolling +Single rightPolling +Single leftPolling +Single debrisSoundInterval +Single toolHold +Single windGust +Single dialogueButtonScale +Single creditsTimer +Single globalOutdoorLighting +Microsoft.Xna.Framework.Audio.Cue currentSong +Microsoft.Xna.Framework.Audio.AudioCategory musicCategory +Microsoft.Xna.Framework.Audio.AudioCategory soundCategory +Microsoft.Xna.Framework.PlayerIndex playerOneIndex +Microsoft.Xna.Framework.Audio.AudioEngine audioEngine +Microsoft.Xna.Framework.Audio.WaveBank waveBank +Microsoft.Xna.Framework.Audio.SoundBank soundBank +Microsoft.Xna.Framework.Vector2 shiny +Microsoft.Xna.Framework.Vector2 previousViewportPosition +Microsoft.Xna.Framework.Vector2 currentCursorTile +Microsoft.Xna.Framework.Vector2 lastCursorTile +StardewValley.RainDrop[] rainDrops +Double chanceToRainTomorrow +Microsoft.Xna.Framework.Audio.Cue fuseSound +Microsoft.Xna.Framework.Audio.Cue chargeUpSound +Microsoft.Xna.Framework.Audio.Cue wind +Double dailyLuck +System.Collections.Generic.List`1[StardewValley.WeatherDebris] debrisWeather +System.Collections.Generic.List`1[StardewValley.TemporaryAnimatedSprite] screenOverlayTempSprites +Byte gameMode +Byte multiplayerMode +System.Collections.Generic.IEnumerator`1[System.Int32] currentLoader +UInt64 uniqueIDForThisGame +StardewValley.LoadGameScreen loadGameScreen +StardewValley.Stats stats +Int32[] cropsOfTheWeek +StardewValley.Quests.Quest questOfTheDay +StardewValley.MoneyMadeScreen moneyMadeScreen +System.Collections.Generic.HashSet`1[StardewValley.LightSource] currentLightSources +Microsoft.Xna.Framework.Color ambientLight +Microsoft.Xna.Framework.Color outdoorLight +Microsoft.Xna.Framework.Color textColor +Microsoft.Xna.Framework.Color textShadowColor +StardewValley.Menus.IClickableMenu activeClickableMenu +StardewValley.Minigames.IMinigame currentMinigame +System.Collections.Generic.List`1[StardewValley.Menus.IClickableMenu] onScreenMenus +StardewValley.BloomComponent bloom +System.Collections.Generic.Dictionary`2[System.Int32,System.String] achievements +StardewValley.Object dishOfTheDay +StardewValley.Menus.BuffsDisplay buffsDisplay +StardewValley.Menus.DayTimeMoneyBox dayTimeMoneyBox +System.Collections.Generic.Dictionary`2[System.Int64,StardewValley.Farmer] otherFarmers +StardewValley.Network.Server server +StardewValley.Network.Client client +StardewValley.KeyboardDispatcher keyboardDispatcher +StardewValley.Background background +StardewValley.Events.FarmEvent farmEvent +afterFadeFunction afterFade +afterFadeFunction afterDialogues +afterFadeFunction afterViewport +afterFadeFunction viewportReachedTarget +afterFadeFunction afterPause +Microsoft.Xna.Framework.GameTime currentGameTime +System.Collections.Generic.List`1[StardewValley.DelayedAction] delayedActions +System.Collections.Generic.Stack`1[StardewValley.Menus.IClickableMenu] endOfNightMenus +StardewValley.Options options +StardewValley.Game1 game1 +Microsoft.Xna.Framework.Point lastMousePositionBeforeFade +Microsoft.Xna.Framework.Point viewportCenter +Microsoft.Xna.Framework.Vector2 viewportTarget +Single viewportSpeed +Int32 viewportHold +Boolean toggleFullScreen +Boolean isFullscreen +Boolean setToWindowedMode +Boolean setToFullscreen +System.String whereIsTodaysFest +Boolean farmerShouldPassOut +Microsoft.Xna.Framework.Vector2 currentViewportTarget +Microsoft.Xna.Framework.Vector2 viewportPositionLerp +Single screenGlowRate +Single screenGlowMax +Boolean haltAfterCheck +Int32 mouseCursor +Single mouseCursorTransparency +StardewValley.NPC objectDialoguePortraitPerson +Int32 defaultResolutionX +Int32 defaultResolutionY +Int32 smallestTileSize +Int32 up +Int32 right +Int32 down +Int32 left +Int32 spriteIndexForOveralls +Int32 colorToleranceForOveralls +Int32 spriteIndexForOverallsBorder +Int32 colorToloranceForOverallsBorder +Int32 dialogueBoxTileHeight +Int32 realMilliSecondsPerGameTenMinutes +Int32 rainDensity +Int32 millisecondsPerDialogueLetterType +Single pickToolDelay +Int32 defaultMinFishingBiteTime +Int32 defaultMaxFishingBiteTime +Int32 defaultMinFishingNibbleTime +Int32 defaultMaxFishingNibbleTime +Int32 minWallpaperPrice +Int32 maxWallpaperPrice +Int32 rainLoopLength +Int32 weather_sunny +Int32 weather_rain +Int32 weather_debris +Int32 weather_lightning +Int32 weather_festival +Int32 weather_snow +Int32 weather_wedding +Byte singlePlayer +Byte multiplayerClient +Byte multiplayerServer +Byte logoScreenGameMode +Byte titleScreenGameMode +Byte loadScreenGameMode +Byte newGameMode +Byte playingGameMode +Byte characterSelectMode +Byte loadingMode +Byte saveMode +Byte saveCompleteMode +Byte selectGameScreen +Byte creditsMode +Byte errorLogMode +Single keyPollingThreshold +Single toolHoldPerPowerupLevel +Single startingMusicVolume +Single thumbstickToMouseModifier +System.String NO_LETTER_MAIL \ No newline at end of file diff --git a/Release/StardewModdingAPI.exe b/Release/StardewModdingAPI.exe index 53745c83..2268d77d 100644 Binary files a/Release/StardewModdingAPI.exe and b/Release/StardewModdingAPI.exe differ diff --git a/StardewModdingAPI/Extensions.cs b/StardewModdingAPI/Extensions.cs index 0078ebe9..b960f027 100644 --- a/StardewModdingAPI/Extensions.cs +++ b/StardewModdingAPI/Extensions.cs @@ -22,9 +22,9 @@ namespace StardewModdingAPI return new Color(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255)); } - public static string ToSingular(this IEnumerable enumerable) + public static string ToSingular(this IEnumerable enumerable, string split = ", ") { - string result = string.Join(", ", enumerable); + string result = string.Join(split, enumerable); return result; } diff --git a/StardewModdingAPI/Inheritance/Menus/SBobberBar.cs b/StardewModdingAPI/Inheritance/Menus/SBobberBar.cs new file mode 100644 index 00000000..9e5f6865 --- /dev/null +++ b/StardewModdingAPI/Inheritance/Menus/SBobberBar.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using StardewValley.Menus; + +namespace StardewModdingAPI.Inheritance.Menus +{ + public class SBobberBar : BobberBar + { + public static FieldInfo[] PrivateFields { get { return GetPrivateFields(); } } + + /// + /// DO NOT CONSTRUCT THIS CLASS + /// This class ONLY provides functionality to access the base BobberBar class fields. + /// + /// + /// + /// + /// + public SBobberBar(int whichFish, float fishSize, bool treasure, int bobber) : base(whichFish, fishSize, treasure, bobber) + { + + } + + public static FieldInfo[] GetPrivateFields() + { + return typeof (BobberBar).GetFields(BindingFlags.Instance | BindingFlags.NonPublic); + } + } +} diff --git a/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs b/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs new file mode 100644 index 00000000..5ce29d8d --- /dev/null +++ b/StardewModdingAPI/Inheritance/Minigames/SMinigameBase.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace StardewModdingAPI.Inheritance.Minigames +{ + abstract class SMinigameBase : StardewValley.Minigames.IMinigame + { + public abstract bool tick(GameTime time); + + public abstract void receiveLeftClick(int x, int y, bool playSound = true); + + public abstract void leftClickHeld(int x, int y); + + public abstract void receiveRightClick(int x, int y, bool playSound = true); + + public abstract void releaseLeftClick(int x, int y); + + public abstract void releaseRightClick(int x, int y); + + public abstract void receiveKeyPress(Keys k); + + public abstract void receiveKeyRelease(Keys k); + + public abstract void draw(SpriteBatch b); + + public abstract void changeScreenSize(); + + public abstract void unload(); + + public abstract void receiveEventPoke(int data); + } +} diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs new file mode 100644 index 00000000..61a0f390 --- /dev/null +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; +using StardewValley; +using StardewValley.Minigames; + +namespace StardewModdingAPI.Inheritance +{ + public class SGame : Game1 + { + public static FieldInfo[] StaticFields { get { return Thing(); } } + + public static FieldInfo[] Thing() + { + return typeof(Game1).GetFields(); + } + + public KeyboardState KStateNow { get; private set; } + public KeyboardState KStatePrior { get; private set; } + + public Keys[] CurrentlyPressedKeys { get; private set; } + public Keys[] PreviouslyPressedKeys { get; private set; } + + public Keys[] FramePressedKeys + { + get { return CurrentlyPressedKeys.Where(x => !PreviouslyPressedKeys.Contains(x)).ToArray(); } + } + + protected override void Initialize() + { + Program.Log("XNA Initialize"); + Events.InvokeInitialize(); + base.Initialize(); + } + + protected override void LoadContent() + { + Program.Log("XNA LoadContent"); + Events.InvokeLoadContent(); + base.LoadContent(); + } + + protected override void Update(GameTime gameTime) + { + KStateNow = Keyboard.GetState(); + CurrentlyPressedKeys = KStateNow.GetPressedKeys(); + + foreach (Keys k in FramePressedKeys) + Events.InvokeKeyPressed(k); + + if (KStateNow != KStatePrior) + { + Events.InvokeKeyboardChanged(KStateNow); + } + + Events.InvokeUpdateTick(); + base.Update(gameTime); + + KStatePrior = KStateNow; + PreviouslyPressedKeys = CurrentlyPressedKeys; + } + + protected override void Draw(GameTime gameTime) + { + Events.InvokeDrawTick(); + base.Draw(gameTime); + } + } +} \ No newline at end of file diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index 52ea76e8..846050ed 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -11,6 +11,7 @@ using System.Windows.Forms; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; +using StardewModdingAPI.Inheritance; using StardewValley; using StardewValley.Menus; using StardewValley.Minigames; @@ -44,6 +45,8 @@ namespace StardewModdingAPI { Console.Title = "Stardew Modding API Console"; + AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); + if (File.Exists(ModPath)) File.Delete(ModPath); if (!Directory.Exists(ModPath)) @@ -62,6 +65,8 @@ namespace StardewModdingAPI LogInfo("Starting SDV..."); gameThread.Start(); + SGame.Thing(); + while (!ready) { @@ -184,7 +189,20 @@ namespace StardewModdingAPI StardewForm.Invoke(a); } + public static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) + { + string dllName = args.Name.Contains(',') ? args.Name.Substring(0, args.Name.IndexOf(',')) : args.Name.Replace(".dll", ""); + + dllName = dllName.Replace(".", "_"); + if (dllName.EndsWith("_resources")) return null; + + System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(Program).Namespace + ".Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly()); + + byte[] bytes = (byte[])rm.GetObject(dllName); + + return System.Reflection.Assembly.Load(bytes); + } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/StardewModdingAPI/SGame.cs b/StardewModdingAPI/SGame.cs deleted file mode 100644 index 6af7689a..00000000 --- a/StardewModdingAPI/SGame.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; -using StardewValley; - -namespace StardewModdingAPI -{ - public class SGame : Game1 - { - public KeyboardState KStateNow { get; private set; } - public KeyboardState KStatePrior { get; private set; } - - public Keys[] CurrentlyPressedKeys { get; private set; } - public Keys[] PreviouslyPressedKeys { get; private set; } - - public Keys[] FramePressedKeys - { - get { return CurrentlyPressedKeys.Where(x => !PreviouslyPressedKeys.Contains(x)).ToArray(); } - } - - protected override void Initialize() - { - Program.Log("XNA Initialize"); - Events.InvokeInitialize(); - base.Initialize(); - } - - protected override void LoadContent() - { - Program.Log("XNA LoadContent"); - Events.InvokeLoadContent(); - base.LoadContent(); - } - - protected override void Update(GameTime gameTime) - { - KStateNow = Keyboard.GetState(); - CurrentlyPressedKeys = KStateNow.GetPressedKeys(); - - foreach (Keys k in FramePressedKeys) - Events.InvokeKeyPressed(k); - - if (KStateNow != KStatePrior) - { - Events.InvokeKeyboardChanged(KStateNow); - } - - Events.InvokeUpdateTick(); - base.Update(gameTime); - - KStatePrior = KStateNow; - PreviouslyPressedKeys = CurrentlyPressedKeys; - } - - protected override void Draw(GameTime gameTime) - { - Events.InvokeDrawTick(); - base.Draw(gameTime); - } - } -} \ No newline at end of file diff --git a/StardewModdingAPI/StardewModdingAPI.csproj b/StardewModdingAPI/StardewModdingAPI.csproj index 39e659bf..a6815f26 100644 --- a/StardewModdingAPI/StardewModdingAPI.csproj +++ b/StardewModdingAPI/StardewModdingAPI.csproj @@ -54,6 +54,7 @@ False ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Stardew Valley.exe + False @@ -68,11 +69,13 @@ + + - + -- cgit