|
@ -13,6 +13,7 @@
|
|||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -22,6 +23,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
@ -30,11 +32,47 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -61,13 +99,16 @@
|
|||
<Name>StardustCore</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -6,6 +6,7 @@ using StardewValley.Characters;
|
|||
using StardewValley.Menus;
|
||||
using StardewValley.Objects;
|
||||
using StardewValley.TerrainFeatures;
|
||||
using StardustCore.UIUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -47,7 +48,7 @@ namespace StardewValley
|
|||
|
||||
public int experienceGainWhenHarvesting;
|
||||
|
||||
public Texture2D spriteSheet;
|
||||
public Texture2DExtended spriteSheet;
|
||||
public string spriteSheetName;
|
||||
public string dataFileName;
|
||||
|
||||
|
@ -68,12 +69,12 @@ namespace StardewValley
|
|||
this.currentPhase = 5;
|
||||
}
|
||||
|
||||
public ModularCrop(int SeedIndex, int tileX, int tileY, string DataFileName, string cropTextureSheet,string AssociatedObjectTextureSheet,string AssociatedObjectDataFile)
|
||||
public ModularCrop(IModHelper helper,int SeedIndex, int tileX, int tileY, string DataFileName, string cropTextureSheet,string AssociatedObjectTextureSheet,string AssociatedObjectDataFile)
|
||||
{
|
||||
this.seedIndex = SeedIndex;
|
||||
this.forageCrop = false;
|
||||
this.dataFileName = DataFileName;
|
||||
this.spriteSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, cropTextureSheet));
|
||||
this.spriteSheet = new Texture2DExtended(helper, Path.Combine(Utilities.EntensionsFolderName, cropTextureSheet));
|
||||
this.spriteSheetName = cropTextureSheet;
|
||||
this.experienceGainWhenHarvesting = 0;
|
||||
cropObjectTexture = AssociatedObjectTextureSheet;
|
||||
|
@ -193,11 +194,11 @@ namespace StardewValley
|
|||
if (this.whichForageCrop == 1)
|
||||
//@object = new ModularCropObject(399, 1, false, -1, 0);
|
||||
if (Game1.player.professions.Contains(16))
|
||||
@object.quality = 4;
|
||||
@object.Quality = 4;
|
||||
else if (Game1.random.NextDouble() < (double)Game1.player.ForagingLevel / 30.0)
|
||||
@object.quality = 2;
|
||||
@object.Quality = 2;
|
||||
else if (Game1.random.NextDouble() < (double)Game1.player.ForagingLevel / 15.0)
|
||||
@object.quality = 1;
|
||||
@object.Quality = 1;
|
||||
Game1.stats.ItemsForaged += (uint)@object.Stack;
|
||||
if (junimoHarvester != null)
|
||||
{
|
||||
|
@ -229,7 +230,7 @@ namespace StardewValley
|
|||
if (this.indexOfHarvest == 0)
|
||||
return true;
|
||||
Random random = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame);
|
||||
switch (soil.fertilizer)
|
||||
switch (soil.fertilizer.Value)
|
||||
{
|
||||
case 368:
|
||||
num3 = 1;
|
||||
|
@ -262,9 +263,9 @@ namespace StardewValley
|
|||
for (int index = 0; index < num1; ++index)
|
||||
{
|
||||
if (junimoHarvester != null)
|
||||
junimoHarvester.tryToAddItemToHut((Item)new ModularCropObject(this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData));
|
||||
junimoHarvester.tryToAddItemToHut((Item)new ModularCropObject( this.spriteSheet.getHelper(), this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData));
|
||||
else
|
||||
AdditionalCropsFramework.Utilities.createObjectDebris((Item)new ModularCropObject(this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData), xTile, yTile, xTile, yTile, -1, this.getQualityOfCrop(), 1);
|
||||
AdditionalCropsFramework.Utilities.createObjectDebris((Item)new ModularCropObject(this.spriteSheet.getHelper(),this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData), xTile, yTile, xTile, yTile, -1, this.getQualityOfCrop(), 1);
|
||||
|
||||
//Game1.createObjectDebris(this.indexOfHarvest, xTile, yTile, -1, num2, 1f, (GameLocation)null);
|
||||
}
|
||||
|
@ -278,7 +279,7 @@ namespace StardewValley
|
|||
if (junimoHarvester == null)
|
||||
{
|
||||
Farmer player = Game1.player;
|
||||
ModularCropObject @object= new ModularCropObject(this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData);
|
||||
ModularCropObject @object= new ModularCropObject(this.spriteSheet.getHelper(),this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData);
|
||||
int num7 = 0;
|
||||
if (!player.addItemToInventoryBool((Item)@object, num7 != 0))
|
||||
{
|
||||
|
@ -295,7 +296,7 @@ namespace StardewValley
|
|||
else
|
||||
{
|
||||
JunimoHarvester junimoHarvester1 = junimoHarvester;
|
||||
ModularCropObject @object = new ModularCropObject(this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData);
|
||||
ModularCropObject @object = new ModularCropObject(this.spriteSheet.getHelper() ,this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData);
|
||||
junimoHarvester1.tryToAddItemToHut((Item)@object);
|
||||
}
|
||||
if (random.NextDouble() < (double)Game1.player.LuckLevel / 1500.0 + Game1.dailyLuck / 1200.0 + 9.99999974737875E-05)
|
||||
|
@ -324,9 +325,9 @@ namespace StardewValley
|
|||
for (int index = 0; index < num1 - 1; ++index)
|
||||
{
|
||||
if (junimoHarvester == null)
|
||||
AdditionalCropsFramework.Utilities.createObjectDebris((Item)new ModularCropObject(this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData), xTile, yTile, xTile, yTile, -1, this.getQualityOfCrop(), 1);
|
||||
AdditionalCropsFramework.Utilities.createObjectDebris((Item)new ModularCropObject(this.spriteSheet.getHelper() ,this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData), xTile, yTile, xTile, yTile, -1, this.getQualityOfCrop(), 1);
|
||||
else
|
||||
junimoHarvester.tryToAddItemToHut((Item)new ModularCropObject(this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData));
|
||||
junimoHarvester.tryToAddItemToHut((Item)new ModularCropObject(this.spriteSheet.getHelper(),this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData));
|
||||
}
|
||||
float num8 = (float)(16.0 * Math.Log(0.018 * (double)Convert.ToInt32(this.experienceGainWhenHarvesting + 1.0), Math.E));
|
||||
if (junimoHarvester == null)
|
||||
|
@ -388,7 +389,7 @@ namespace StardewValley
|
|||
|
||||
public void newDay(int state, int fertilizer, int xTile, int yTile, GameLocation environment)
|
||||
{
|
||||
if (!environment.name.Equals("Greenhouse") && (this.dead || !this.seasonsToGrowIn.Contains(Game1.currentSeason)))
|
||||
if (!environment.Name.Equals("Greenhouse") && (this.dead || !this.seasonsToGrowIn.Contains(Game1.currentSeason)))
|
||||
{
|
||||
this.dead = true;
|
||||
}
|
||||
|
@ -413,7 +414,7 @@ namespace StardewValley
|
|||
for (int index2 = yTile - 1; index2 <= yTile + 1; ++index2)
|
||||
{
|
||||
Vector2 key = new Vector2((float)index1, (float)index2);
|
||||
if (!environment.terrainFeatures.ContainsKey(key) || !(environment.terrainFeatures[key] is HoeDirt) || ((environment.terrainFeatures[key] as HoeDirt).crop == null || (environment.terrainFeatures[key] as HoeDirt).crop.indexOfHarvest != this.indexOfHarvest))
|
||||
if (!environment.terrainFeatures.ContainsKey(key) || !(environment.terrainFeatures[key] is HoeDirt) || ((environment.terrainFeatures[key] as HoeDirt).crop == null || (environment.terrainFeatures[key] as HoeDirt).crop.indexOfHarvest.Value != this.indexOfHarvest))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -449,8 +450,8 @@ namespace StardewValley
|
|||
break;
|
||||
}
|
||||
ModularCropObject @object = this.getRandomWildCropForSeason(season);
|
||||
@object.isSpawnedObject = true;
|
||||
@object.canBeGrabbed = true;
|
||||
@object.IsSpawnedObject = true;
|
||||
@object.CanBeGrabbed = true;
|
||||
environment.objects.Add(index, this.getRandomWildCropForSeason(season));
|
||||
|
||||
|
||||
|
@ -474,23 +475,23 @@ namespace StardewValley
|
|||
}
|
||||
else
|
||||
{
|
||||
b.Draw(this.spriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(this.getSourceRect((int)tileLocation.X * 7 + (int)tileLocation.Y * 11)), toTint, rotation, new Vector2(8f, 24f), (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0 / (this.currentPhase != 0 || this.raisedSeeds ? 1.0 : 2.0)));
|
||||
b.Draw(this.spriteSheet.texture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(this.getSourceRect((int)tileLocation.X * 7 + (int)tileLocation.Y * 11)), toTint, rotation, new Vector2(8f, 24f), (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0 / (this.currentPhase != 0 || this.raisedSeeds ? 1.0 : 2.0)));
|
||||
|
||||
//Log.AsyncG((float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0 / (this.currentPhase != 0 || this.raisedSeeds ? 1.0 : 2.0)));
|
||||
|
||||
if (this.tintColor.Equals(Color.White) || this.currentPhase != this.phaseDays.Count - 1 || this.dead)
|
||||
return;
|
||||
b.Draw(this.spriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((this.fullyGrown ? (this.dayOfCurrentPhase <= 0 ? 6 : 7) : this.currentPhase + 1 + 1) * 16 + (this.rowInSpriteSheet % 2 != 0 ? 128 : 0), this.rowInSpriteSheet / 2 * 16 * 2, 16, 32)), this.tintColor, rotation, new Vector2(8f, 24f), (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0 / (this.currentPhase != 0 || this.raisedSeeds ? 1.0 : 2.0)));
|
||||
b.Draw(this.spriteSheet.texture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (this.raisedSeeds || this.currentPhase >= this.phaseDays.Count - 1 ? 0.0 : ((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((this.fullyGrown ? (this.dayOfCurrentPhase <= 0 ? 6 : 7) : this.currentPhase + 1 + 1) * 16 + (this.rowInSpriteSheet % 2 != 0 ? 128 : 0), this.rowInSpriteSheet / 2 * 16 * 2, 16, 32)), this.tintColor, rotation, new Vector2(8f, 24f), (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0 / (this.currentPhase != 0 || this.raisedSeeds ? 1.0 : 2.0)));
|
||||
}
|
||||
|
||||
}
|
||||
public void drawWhenPlanterBoxHeld(PlanterBox p, SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
|
||||
{
|
||||
spriteBatch.Draw(this.spriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(Game1.player.GetBoundingBox().Center.X-Game1.tileSize/2, (Game1.player.GetBoundingBox().Center.Y- Game1.tileSize * 4 / 3)-(Game1.tileSize*2))), this.getSourceRect(this.rowInSpriteSheet), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(p.boundingBox.Bottom + 1) / 10000f);
|
||||
spriteBatch.Draw(this.spriteSheet.texture, Game1.GlobalToLocal(Game1.viewport, new Vector2(Game1.player.GetBoundingBox().Center.X-Game1.tileSize/2, (Game1.player.GetBoundingBox().Center.Y- Game1.tileSize * 4 / 3)-(Game1.tileSize*2))), this.getSourceRect(this.rowInSpriteSheet), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(p.boundingBox.Bottom + 1) / 10000f);
|
||||
}
|
||||
public void drawInMenu(PlanterBox p,SpriteBatch b, Vector2 screenPosition, Color toTint, float rotation, float scale, float layerDepth)
|
||||
{
|
||||
b.Draw(this.spriteSheet,new Vector2(screenPosition.X, screenPosition.Y-(Game1.tileSize/2)), new Rectangle?(getSourceRect(this.rowInSpriteSheet)), Color.White, 0f, new Vector2((float)(p.defaultSourceRect.Width / 2), (float)(p.defaultSourceRect.Height / 2)), 1f * (2) * scale, SpriteEffects.None, layerDepth);
|
||||
b.Draw(this.spriteSheet.texture,new Vector2(screenPosition.X, screenPosition.Y-(Game1.tileSize/2)), new Rectangle?(getSourceRect(this.rowInSpriteSheet)), Color.White, 0f, new Vector2((float)(p.defaultSourceRect.Width / 2), (float)(p.defaultSourceRect.Height / 2)), 1f * (2) * scale, SpriteEffects.None, layerDepth);
|
||||
}
|
||||
|
||||
public int getQualityOfCrop()
|
||||
|
|
|
@ -102,11 +102,12 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
e.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.ToString();
|
||||
this.description = "Some seeds! Maybe you should plant them.";
|
||||
}
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, 1, 1);
|
||||
|
@ -126,7 +127,7 @@ namespace AdditionalCropsFramework
|
|||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.defaultSourceRect = this.sourceRect;
|
||||
}
|
||||
this.defaultBoundingBox = new Rectangle((int)this.tileLocation.X, (int)this.tileLocation.Y, 1, 1);
|
||||
this.defaultBoundingBox = new Rectangle((int)this.TileLocation.X, (int)this.TileLocation.Y, 1, 1);
|
||||
if (array[3].Equals("-1"))
|
||||
{
|
||||
}
|
||||
|
@ -140,13 +141,13 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
' '
|
||||
})[1]);
|
||||
this.boundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.defaultBoundingBox = this.boundingBox;
|
||||
this.boundingBox.Value = new Rectangle((int)this.TileLocation.X * Game1.tileSize, (int)this.TileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.defaultBoundingBox = this.boundingBox.Value;
|
||||
}
|
||||
this.updateDrawPosition();
|
||||
this.rotations = Convert.ToInt32(array[4]);
|
||||
this.price = Convert.ToInt32(array[5]);
|
||||
this.parentSheetIndex = which;
|
||||
this.Price = Convert.ToInt32(array[5]);
|
||||
this.ParentSheetIndex = which;
|
||||
|
||||
}
|
||||
|
||||
|
@ -178,21 +179,6 @@ namespace AdditionalCropsFramework
|
|||
if (mState.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
|
||||
{
|
||||
return this.RightClicked(who);
|
||||
|
||||
// Game1.showRedMessage("YOOO");
|
||||
//do some stuff when the right button is down
|
||||
// rotate();
|
||||
if (this.heldObject != null)
|
||||
{
|
||||
// Game1.player.addItemByMenuIfNecessary(this.heldObject);
|
||||
// this.heldObject = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this.heldObject = Game1.player.ActiveObject;
|
||||
// Game1.player.removeItemFromInventory(heldObject);
|
||||
}
|
||||
//this.minutesUntilReady = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -268,7 +254,7 @@ namespace AdditionalCropsFramework
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual bool RightClicked(StardewValley.Farmer who)
|
||||
public override bool RightClicked(StardewValley.Farmer who)
|
||||
{
|
||||
|
||||
|
||||
|
@ -337,7 +323,7 @@ namespace AdditionalCropsFramework
|
|||
this.addLights(thisLocation, lightColor);
|
||||
}
|
||||
|
||||
public override bool performObjectDropInAction(StardewValley.Object dropIn, bool probe, StardewValley.Farmer who)
|
||||
public override bool performObjectDropInAction(Item dropIn, bool probe, StardewValley.Farmer who)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -363,7 +349,7 @@ namespace AdditionalCropsFramework
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void updateDrawPosition()
|
||||
public override void updateDrawPosition()
|
||||
{
|
||||
this.drawPosition = new Vector2((float)this.boundingBox.X, (float)(this.boundingBox.Y - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)));
|
||||
}
|
||||
|
@ -386,12 +372,12 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public override int salePrice()
|
||||
{
|
||||
return this.price;
|
||||
return this.Price;
|
||||
}
|
||||
|
||||
public override int getStack()
|
||||
{
|
||||
return this.stack;
|
||||
return this.Stack;
|
||||
}
|
||||
|
||||
|
||||
|
@ -421,10 +407,10 @@ namespace AdditionalCropsFramework
|
|||
public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, StardewValley.Farmer f)
|
||||
{
|
||||
|
||||
spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(GameLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
if (f.ActiveObject != null && f.ActiveObject.Name.Contains("="))
|
||||
{
|
||||
spriteBatch.Draw(Game1.objectSpriteSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
spriteBatch.Draw(Game1.objectSpriteSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(GameLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
if (Math.Abs(Game1.starCropShimmerPause) <= 0.05f && Game1.random.NextDouble() < 0.97)
|
||||
{
|
||||
return;
|
||||
|
@ -437,18 +423,18 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
}
|
||||
|
||||
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
|
||||
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawWithShadows)
|
||||
{
|
||||
//spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize, SpriteEffects.None, layerDepth);
|
||||
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize * 1.5f, SpriteEffects.None, layerDepth);
|
||||
|
||||
|
||||
if (drawStackNumber && this.maximumStackSize() > 1 && ((double)scaleSize > 0.3 && this.Stack != int.MaxValue) && this.Stack > 1)
|
||||
Utility.drawTinyDigits(this.stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(this.stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White);
|
||||
if (drawStackNumber && this.quality > 0)
|
||||
Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(this.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White);
|
||||
if (drawStackNumber && this.Quality > 0)
|
||||
{
|
||||
float num = this.quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581);
|
||||
spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth);
|
||||
float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581);
|
||||
spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,15 +448,15 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)))), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
|
||||
}
|
||||
if (this.heldObject != null)
|
||||
if (this.heldObject.Value != null)
|
||||
{
|
||||
if (this.heldObject is ModularSeeds)
|
||||
if (this.heldObject.Value is ModularSeeds)
|
||||
{
|
||||
(this.heldObject as ModularSeeds).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject as ModularSeeds).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
|
||||
(this.heldObject.Value as ModularSeeds).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject.Value as ModularSeeds).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
|
||||
return;
|
||||
}
|
||||
spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 5 / 6)), new Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)this.boundingBox.Bottom / 10000f);
|
||||
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.heldObject.ParentSheetIndex)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
|
||||
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(GameLocation.getSourceRectForObject(this.heldObject.Value.ParentSheetIndex)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +467,7 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public override Item getOne()
|
||||
{
|
||||
ModularSeeds ExtraSeeds = new ModularSeeds(this.parentSheetIndex, this.texturePath, this.dataFilePath,this.cropTextureFilePath,this.cropDataFilePath,this.cropObjectTextureFilePath,this.cropObjectDataFilePath);
|
||||
ModularSeeds ExtraSeeds = new ModularSeeds(this.ParentSheetIndex, this.texturePath, this.dataFilePath,this.cropTextureFilePath,this.cropDataFilePath,this.cropObjectTextureFilePath,this.cropObjectDataFilePath);
|
||||
/*
|
||||
drawPosition = this.drawPosition;
|
||||
defaultBoundingBox = this.defaultBoundingBox;
|
||||
|
@ -594,128 +580,7 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public static Item ParseIntoInventory(string s)
|
||||
{
|
||||
// PlanterBox p = new PlanterBox();
|
||||
// return p;
|
||||
|
||||
|
||||
|
||||
dynamic obj = JObject.Parse(s);
|
||||
|
||||
ModularSeeds d = new ModularSeeds();
|
||||
|
||||
d.dataFilePath = obj.dataFilePath;
|
||||
d.cropDataFilePath = obj.cropDataFilePath;
|
||||
d.cropObjectDataFilePath = obj.cropObjectDataFilePath;
|
||||
|
||||
|
||||
|
||||
d.texturePath = obj.texturePath;
|
||||
d.cropTextureFilePath = obj.cropTextureFilePath;
|
||||
d.cropObjectTextureFilePath = obj.cropObjectTextureFilePath;
|
||||
|
||||
d.price = obj.price;
|
||||
d.Decoration_type = obj.Decoration_type;
|
||||
d.rotations = obj.rotations;
|
||||
d.currentRotation = obj.currentRotation;
|
||||
string s1 = Convert.ToString(obj.sourceRect);
|
||||
d.sourceRect = Utilities.parseRectFromJson(s1);
|
||||
string s2 = Convert.ToString(obj.defaultSourceRect);
|
||||
d.defaultSourceRect = Utilities.parseRectFromJson(s2);
|
||||
string s3 = Convert.ToString(obj.defaultBoundingBox);
|
||||
d.defaultBoundingBox = Utilities.parseRectFromJson(s3);
|
||||
d.description = obj.description;
|
||||
d.flipped = obj.flipped;
|
||||
d.flaggedForPickUp = obj.flaggedForPickUp;
|
||||
d.tileLocation = obj.tileLocation;
|
||||
d.parentSheetIndex = obj.parentSheetIndex;
|
||||
d.owner = obj.owner;
|
||||
d.name = obj.name;
|
||||
d.type = obj.type;
|
||||
d.canBeSetDown = obj.canBeSetDown;
|
||||
d.canBeGrabbed = obj.canBeGrabbed;
|
||||
d.isHoedirt = obj.isHoedirt;
|
||||
d.isSpawnedObject = obj.isSpawnedObject;
|
||||
d.questItem = obj.questItem;
|
||||
d.isOn = obj.isOn;
|
||||
d.fragility = obj.fragility;
|
||||
d.edibility = obj.edibility;
|
||||
d.stack = obj.stack;
|
||||
d.quality = obj.quality;
|
||||
d.bigCraftable = obj.bigCraftable;
|
||||
d.setOutdoors = obj.setOutdoors;
|
||||
d.setIndoors = obj.setIndoors;
|
||||
d.readyForHarvest = obj.readyForHarvest;
|
||||
d.showNextIndex = obj.showNextIndex;
|
||||
d.hasBeenPickedUpByFarmer = obj.hasBeenPickedUpByFarmer;
|
||||
d.isRecipe = obj.isRecipe;
|
||||
d.isLamp = obj.isLamp;
|
||||
d.heldObject = obj.heldObject;
|
||||
d.minutesUntilReady = obj.minutesUntilReady;
|
||||
string s4 = Convert.ToString(obj.boundingBox);
|
||||
d.boundingBox = Utilities.parseRectFromJson(s4);
|
||||
d.scale = obj.scale;
|
||||
d.lightSource = obj.lightSource;
|
||||
d.shakeTimer = obj.shakeTimer;
|
||||
d.internalSound = obj.internalSound;
|
||||
d.specialVariable = obj.specialVariable;
|
||||
d.category = obj.category;
|
||||
d.specialItem = obj.specialItem;
|
||||
d.hasBeenInInventory = obj.hasBeenInInventory;
|
||||
|
||||
|
||||
string t = obj.texturePath;
|
||||
d.TextureSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, t));
|
||||
d.texturePath = t;
|
||||
d.itemReadyForHarvest = obj.itemReadyForHarvest;
|
||||
d.lightsOn = obj.lightsOn;
|
||||
d.lightColor = obj.lightColor;
|
||||
d.thisType = obj.thisType;
|
||||
d.removable = obj.removable;
|
||||
d.locationsName = obj.locationsName;
|
||||
|
||||
d.drawColor = obj.drawColor;
|
||||
d.serializationName = obj.serializationName;
|
||||
|
||||
/*
|
||||
//ANIMATIONS
|
||||
var q = obj.animationManager;
|
||||
dynamic obj1 = q;
|
||||
string name = Convert.ToString(obj1.currentAnimationName);
|
||||
int frame = Convert.ToInt32(obj1.currentAnimationListIndex);
|
||||
PlanterBox dummy = new PlanterBox(d.parentSheetIndex, d.tileLocation, d.texturePath, d.dataPath, d.removable, d.IsSolid);
|
||||
d.animationManager = dummy.animationManager;
|
||||
bool f = d.animationManager.setAnimation(name, frame);
|
||||
bool f2;
|
||||
if (f == false)
|
||||
{
|
||||
f2 = d.animationManager.setAnimation(name, 0);
|
||||
if (f2 == false) d.animationManager.currentAnimation = d.animationManager.defaultDrawFrame;
|
||||
}
|
||||
// Log.AsyncC(d.cropInformationString);
|
||||
*/
|
||||
|
||||
//ModularCrop f= j.ToObject<ModularCrop>();
|
||||
//ModularCrop f = obj.modularCrop;
|
||||
|
||||
// Log.AsyncG("THIS IS CROP: " + c.indexOfHarvest);
|
||||
//Log.AsyncG(cropString);
|
||||
|
||||
|
||||
// d.crop = obj.crop;
|
||||
// d.modularCrop = obj.modularCrop;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
return d;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Log.AsyncM(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
//return base.ParseIntoInventory();
|
||||
return AdditionalCropsFramework.ModCore.ModHelper.ReadJsonFile<ModularSeeds>(s);
|
||||
}
|
||||
|
||||
public static void SerializeFromWorld(Item I)
|
||||
|
|
|
@ -9,6 +9,7 @@ using StardewValley.Menus;
|
|||
using StardewValley.Objects;
|
||||
using StardustCore;
|
||||
using StardustCore.Animations;
|
||||
using StardustCore.UIUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -22,26 +23,7 @@ namespace AdditionalCropsFramework
|
|||
public class PlanterBox : CoreObject
|
||||
{
|
||||
|
||||
public int Decoration_type;
|
||||
|
||||
public int rotations;
|
||||
|
||||
public int currentRotation;
|
||||
|
||||
private int sourceIndexOffset;
|
||||
|
||||
public Vector2 drawPosition;
|
||||
|
||||
public Rectangle sourceRect;
|
||||
|
||||
public Rectangle defaultSourceRect;
|
||||
|
||||
public Rectangle defaultBoundingBox;
|
||||
|
||||
|
||||
public string description;
|
||||
|
||||
public Texture2D TextureSheet;
|
||||
public Texture2DExtended TextureSheet;
|
||||
|
||||
public new bool flipped;
|
||||
|
||||
|
@ -92,50 +74,51 @@ namespace AdditionalCropsFramework
|
|||
/// <param name="isRemovable"></param>
|
||||
/// <param name="price"></param>
|
||||
/// <param name="isSolid"></param>
|
||||
public PlanterBox(int which, Vector2 tile, bool isRemovable = true, int price = 0, bool isSolid = false)
|
||||
public PlanterBox(IModHelper modHelper,int which, Vector2 tile, bool isRemovable = true, int price = 0, bool isSolid = false)
|
||||
{
|
||||
this.cropInformationString = "";
|
||||
removable = isRemovable;
|
||||
this.serializationName =Convert.ToString(GetType());
|
||||
// this.thisType = GetType();
|
||||
this.tileLocation = tile;
|
||||
this.TileLocation = tile;
|
||||
this.InitializeBasics(0, tile);
|
||||
if (TextureSheet == null)
|
||||
{
|
||||
TextureSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, "PlanterBox.png")); //Game1.content.Load<Texture2D>("TileSheets\\furniture");
|
||||
Texture2D text = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, "PlanterBox.png")); //Game1.content.Load<Texture2D>("TileSheets\\furniture");
|
||||
this.TextureSheet = new Texture2DExtended(modHelper, Path.Combine(Utilities.EntensionsFolderName, "PlanterBox.png"));
|
||||
texturePath = "PlanterBoxGraphic";
|
||||
}
|
||||
dataPath = "";
|
||||
|
||||
this.name = "Planter Box";
|
||||
this.description = "A planter box that can be used to grow many different crops in many different locations.";
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, 1, 1);
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.texture.Width, which * 16 / TextureSheet.texture.Width * 16, 1, 1);
|
||||
|
||||
this.defaultSourceRect.Width = 1;
|
||||
this.defaultSourceRect.Height = 1;
|
||||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.texture.Width, which * 16 / TextureSheet.texture.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.defaultSourceRect = this.sourceRect;
|
||||
|
||||
this.animationManager = new StardustCore.Animations.AnimationManager(this.TextureSheet, new StardustCore.Animations.Animation(this.defaultSourceRect, -1));
|
||||
|
||||
this.defaultBoundingBox = new Rectangle((int)this.tileLocation.X, (int)this.tileLocation.Y, 1, 1);
|
||||
this.defaultBoundingBox = new Rectangle((int)this.TileLocation.X, (int)this.TileLocation.Y, 1, 1);
|
||||
|
||||
this.defaultBoundingBox.Width = 1;
|
||||
this.defaultBoundingBox.Height = 1;
|
||||
IsSolid = isSolid;
|
||||
if (isSolid == true)
|
||||
{
|
||||
this.boundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.boundingBox.Value = new Rectangle((int)this.TileLocation.X * Game1.tileSize, (int)this.TileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.boundingBox = new Rectangle(int.MinValue, (int)this.tileLocation.Y * Game1.tileSize, 0, 0); //Throw the bounding box away as far as possible.
|
||||
this.boundingBox.Value = new Rectangle(int.MinValue, (int)this.TileLocation.Y * Game1.tileSize, 0, 0); //Throw the bounding box away as far as possible.
|
||||
}
|
||||
// this.cropBoundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.defaultBoundingBox = this.boundingBox;
|
||||
// this.cropBoundingBox = new Rectangle((int)this.TileLocation.X * Game1.tileSize, (int)this.TileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.defaultBoundingBox = this.boundingBox.Value;
|
||||
this.updateDrawPosition();
|
||||
this.price = price;
|
||||
this.parentSheetIndex = which;
|
||||
this.Price = price;
|
||||
this.ParentSheetIndex = which;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -147,18 +130,21 @@ namespace AdditionalCropsFramework
|
|||
/// <param name="isRemovable"></param>
|
||||
/// <param name="price"></param>
|
||||
/// <param name="isSolid"></param>
|
||||
public PlanterBox(int which, Vector2 tile, string ObjectTexture, bool isRemovable = true, int price = 0, bool isSolid = false)
|
||||
public PlanterBox(IModHelper helper,int which, Vector2 tile, string ObjectTexture, bool isRemovable = true, int price = 0, bool isSolid = false)
|
||||
{
|
||||
|
||||
this.cropInformationString = "";
|
||||
removable = isRemovable;
|
||||
this.serializationName = Convert.ToString(GetType());
|
||||
// this.thisType = GetType();
|
||||
this.tileLocation = tile;
|
||||
this.TileLocation = tile;
|
||||
this.InitializeBasics(0, tile);
|
||||
if (TextureSheet == null)
|
||||
{
|
||||
TextureSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, ObjectTexture)); //Game1.content.Load<Texture2D>("TileSheets\\furniture");
|
||||
Texture2D text = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, ObjectTexture)); //Game1.content.Load<Texture2D>("TileSheets\\furniture");
|
||||
|
||||
this.TextureSheet = new Texture2DExtended(helper, Path.Combine(Utilities.EntensionsFolderName, ObjectTexture));
|
||||
|
||||
texturePath = ObjectTexture;
|
||||
}
|
||||
this.dataPath = "";
|
||||
|
@ -168,42 +154,43 @@ namespace AdditionalCropsFramework
|
|||
|
||||
|
||||
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, 1, 1);
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.texture.Width, which * 16 / TextureSheet.texture.Width * 16, 1, 1);
|
||||
|
||||
this.defaultSourceRect.Width = 1;
|
||||
this.defaultSourceRect.Height = 1;
|
||||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.texture.Width, which * 16 / TextureSheet.texture.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.defaultSourceRect = this.sourceRect;
|
||||
|
||||
this.defaultBoundingBox = new Rectangle((int)this.tileLocation.X, (int)this.tileLocation.Y, 1, 1);
|
||||
this.defaultBoundingBox = new Rectangle((int)this.TileLocation.X, (int)this.TileLocation.Y, 1, 1);
|
||||
|
||||
this.defaultBoundingBox.Width = 1;
|
||||
this.defaultBoundingBox.Height = 1;
|
||||
IsSolid = isSolid;
|
||||
if (isSolid == true)
|
||||
{
|
||||
this.boundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.boundingBox.Value = new Rectangle((int)this.TileLocation.X * Game1.tileSize, (int)this.TileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.boundingBox = new Rectangle(int.MinValue, (int)this.tileLocation.Y * Game1.tileSize, 0, 0); //Throw the bounding box away as far as possible.
|
||||
this.boundingBox.Value = new Rectangle(int.MinValue, (int)this.TileLocation.Y * Game1.tileSize, 0, 0); //Throw the bounding box away as far as possible.
|
||||
}
|
||||
this.defaultBoundingBox = this.boundingBox;
|
||||
this.defaultBoundingBox = this.boundingBox.Value;
|
||||
this.updateDrawPosition();
|
||||
this.price = price;
|
||||
this.parentSheetIndex = which;
|
||||
this.Price = price;
|
||||
this.ParentSheetIndex = which;
|
||||
}
|
||||
|
||||
|
||||
public PlanterBox(int which, Vector2 tile, string ObjectTexture, string DataPath, bool isRemovable = true, bool isSolid = false)
|
||||
public PlanterBox(IModHelper helper,int which, Vector2 tile, string ObjectTexture, string DataPath, bool isRemovable = true, bool isSolid = false)
|
||||
{
|
||||
this.cropInformationString = "";
|
||||
this.serializationName = Convert.ToString(GetType());
|
||||
removable = isRemovable;
|
||||
// this.thisType = GetType();
|
||||
this.tileLocation = tile;
|
||||
this.TileLocation = tile;
|
||||
this.InitializeBasics(0, tile);
|
||||
TextureSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, ObjectTexture)); //Game1.content.Load<Texture2D>("TileSheets\\furniture");
|
||||
Texture2D text = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, ObjectTexture)); //Game1.content.Load<Texture2D>("TileSheets\\furniture");
|
||||
TextureSheet = new Texture2DExtended(helper, Path.Combine(Utilities.EntensionsFolderName, ObjectTexture));
|
||||
texturePath = ObjectTexture;
|
||||
Dictionary<int, string> dictionary;
|
||||
try
|
||||
|
@ -218,11 +205,11 @@ namespace AdditionalCropsFramework
|
|||
string[] array = s.Split('/');
|
||||
this.name = array[0];
|
||||
this.description = array[1];
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, 1, 1);
|
||||
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.texture.Width, which * 16 / TextureSheet.texture.Width * 16, 1, 1);
|
||||
|
||||
this.defaultSourceRect.Width = 1;
|
||||
this.defaultSourceRect.Height = 1;
|
||||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.sourceRect = new Rectangle(which * 16 % TextureSheet.texture.Width, which * 16 / TextureSheet.texture.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
||||
this.defaultSourceRect = this.sourceRect;
|
||||
try
|
||||
{
|
||||
|
@ -232,25 +219,26 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
catch (Exception errr)
|
||||
{
|
||||
errr.ToString();
|
||||
this.animationManager = new StardustCore.Animations.AnimationManager(this.TextureSheet, new StardustCore.Animations.Animation(this.defaultSourceRect, -1));
|
||||
}
|
||||
this.defaultBoundingBox = new Rectangle((int)this.tileLocation.X, (int)this.tileLocation.Y, 1, 1);
|
||||
this.defaultBoundingBox = new Rectangle((int)this.TileLocation.X, (int)this.TileLocation.Y, 1, 1);
|
||||
|
||||
this.defaultBoundingBox.Width = 1;
|
||||
this.defaultBoundingBox.Height = 1;
|
||||
IsSolid = isSolid;
|
||||
if (isSolid == true)
|
||||
{
|
||||
this.boundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
this.boundingBox.Value = new Rectangle((int)this.TileLocation.X * Game1.tileSize, (int)this.TileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.boundingBox = new Rectangle(int.MinValue, (int)this.tileLocation.Y * Game1.tileSize, 0, 0); //Throw the bounding box away as far as possible.
|
||||
this.boundingBox.Value = new Rectangle(int.MinValue, (int)this.TileLocation.Y * Game1.tileSize, 0, 0); //Throw the bounding box away as far as possible.
|
||||
}
|
||||
this.defaultBoundingBox = this.boundingBox;
|
||||
this.defaultBoundingBox = this.boundingBox.Value;
|
||||
this.updateDrawPosition();
|
||||
this.price = Convert.ToInt32(array[2]);
|
||||
this.parentSheetIndex = which;
|
||||
this.Price = Convert.ToInt32(array[2]);
|
||||
this.ParentSheetIndex = which;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -258,7 +246,7 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
||||
e.ToString();
|
||||
this.selfWatering = false;
|
||||
}
|
||||
try
|
||||
|
@ -267,13 +255,14 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
e.ToString();
|
||||
this.greenHouseEffect = false;
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.ToString();
|
||||
// Log.AsyncC(e);
|
||||
}
|
||||
|
||||
|
@ -344,8 +333,8 @@ namespace AdditionalCropsFramework
|
|||
if (Utilities.isCropFullGrown(this.crop) == true)
|
||||
{
|
||||
//this.crop.harvest();
|
||||
bool f= Utilities.harvestCrop(this.crop, (int)this.tileLocation.X, (int)this.tileLocation.Y, 0);
|
||||
if (f == true && this.crop.regrowAfterHarvest == -1) this.crop = null;
|
||||
bool f= Utilities.harvestCrop(this.crop, (int)this.TileLocation.X, (int)this.TileLocation.Y, 0);
|
||||
if (f == true && this.crop.regrowAfterHarvest.Value == -1) this.crop = null;
|
||||
}
|
||||
}
|
||||
if (this.modularCrop != null)
|
||||
|
@ -354,7 +343,7 @@ namespace AdditionalCropsFramework
|
|||
if (this.modularCrop.isFullyGrown() == true)
|
||||
{
|
||||
|
||||
bool f = Utilities.harvestModularCrop(this.modularCrop, (int)this.tileLocation.X, (int)this.tileLocation.Y, 0);
|
||||
bool f = Utilities.harvestModularCrop(this.modularCrop, (int)this.TileLocation.X, (int)this.TileLocation.Y, 0);
|
||||
if (f == true)
|
||||
{
|
||||
//this.modularCrop = null;
|
||||
|
@ -379,7 +368,7 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (this.parentSheetIndex == 1402)
|
||||
if (this.ParentSheetIndex == 1402)
|
||||
{
|
||||
Game1.activeClickableMenu = new Billboard(false);
|
||||
}
|
||||
|
@ -389,7 +378,7 @@ namespace AdditionalCropsFramework
|
|||
public void plantModdedCrop(ModularSeeds seeds)
|
||||
{
|
||||
if (this.modularCrop != null) return;
|
||||
this.modularCrop = new ModularCrop(seeds.parentSheetIndex, (int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y, seeds.cropDataFilePath, seeds.cropTextureFilePath, seeds.cropObjectTextureFilePath, seeds.cropObjectDataFilePath);
|
||||
this.modularCrop = new ModularCrop(this.TextureSheet.getHelper(),seeds.ParentSheetIndex, (int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y, seeds.cropDataFilePath, seeds.cropTextureFilePath, seeds.cropObjectTextureFilePath, seeds.cropObjectDataFilePath);
|
||||
Game1.player.reduceActiveItemByOne();
|
||||
Game1.playSound("dirtyHit");
|
||||
}
|
||||
|
@ -398,15 +387,16 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (this.crop != null) return;
|
||||
this.normalCropSeedName = Game1.player.CurrentItem.Name;
|
||||
this.normalCropSeedIndex = Game1.player.CurrentItem.parentSheetIndex;
|
||||
this.normalCropSeedIndex = Game1.player.CurrentItem.ParentSheetIndex;
|
||||
|
||||
try
|
||||
{
|
||||
this.crop = new Crop(Game1.player.CurrentItem.parentSheetIndex, (int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y);
|
||||
this.crop = new Crop(Game1.player.CurrentItem.ParentSheetIndex, (int)Game1.currentCursorTile.X, (int)Game1.currentCursorTile.Y);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// Log.AsyncM(e);
|
||||
// Log.AsyncM(e);
|
||||
e.ToString();
|
||||
}
|
||||
|
||||
foreach (var v in this.crop.phaseDays)
|
||||
|
@ -422,9 +412,9 @@ namespace AdditionalCropsFramework
|
|||
public override bool clicked(StardewValley.Farmer who)
|
||||
{
|
||||
int range = 2;
|
||||
if (StardustCore.Utilities.isWithinRange(range, this.tileLocation) == false) return false;
|
||||
if (StardustCore.Utilities.isWithinRange(range, this.TileLocation) == false) return false;
|
||||
|
||||
if (StardustCore.Utilities.isWithinDirectionRange(Game1.player.FacingDirection, range, this.tileLocation))
|
||||
if (StardustCore.Utilities.isWithinDirectionRange(Game1.player.FacingDirection, range, this.TileLocation))
|
||||
{
|
||||
if (Game1.player.CurrentItem != null)
|
||||
{
|
||||
|
@ -450,7 +440,7 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
if (this.crop != null)
|
||||
{
|
||||
if (this.crop.dead == true)
|
||||
if (this.crop.dead.Value == true)
|
||||
{
|
||||
this.crop = null;
|
||||
return false;
|
||||
|
@ -466,12 +456,12 @@ namespace AdditionalCropsFramework
|
|||
if (removable == false) return false;
|
||||
// Game1.showRedMessage("THIS IS CLICKED!!!");
|
||||
Game1.haltAfterCheck = false;
|
||||
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null)
|
||||
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject.Value == null)
|
||||
{
|
||||
// Game1.showRedMessage("Why1?");
|
||||
return false;
|
||||
}
|
||||
if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is PlanterBox)))
|
||||
if (this.heldObject.Value == null && (who.ActiveObject == null || !(who.ActiveObject is PlanterBox)))
|
||||
{
|
||||
if (Game1.player.currentLocation is FarmHouse)
|
||||
{
|
||||
|
@ -488,29 +478,23 @@ namespace AdditionalCropsFramework
|
|||
// return true;
|
||||
|
||||
this.flaggedForPickUp = true;
|
||||
if (this is TV)
|
||||
{
|
||||
this.heldObject = new TV(parentSheetIndex, Vector2.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// this.heldObject = new PlanterBox(parentSheetIndex, Vector2.Zero);
|
||||
Utilities.addItemToInventoryAndCleanTrackedList(this);
|
||||
// this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
|
||||
// this.heldObject.performRemoveAction(this.TileLocation, who.currentLocation);
|
||||
// this.heldObject = null;
|
||||
Game1.playSound("coin");
|
||||
this.thisLocation = null;
|
||||
this.locationsName = "";
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false))
|
||||
if (this.heldObject.Value != null && who.addItemToInventoryBool(this.heldObject.Value, false))
|
||||
{
|
||||
// Game1.showRedMessage("Why3?");
|
||||
this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
|
||||
this.heldObject = null;
|
||||
this.heldObject.Value.performRemoveAction(this.TileLocation, who.currentLocation);
|
||||
this.heldObject.Value = null;
|
||||
Utilities.addItemToInventoryAndCleanTrackedList(this);
|
||||
Game1.playSound("coin");
|
||||
this.thisLocation = null;
|
||||
|
@ -543,7 +527,7 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (this.crop != null)
|
||||
{
|
||||
if (this.crop.dead) this.crop = null;
|
||||
if (this.crop.dead.Value) this.crop = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -554,7 +538,7 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
|
||||
|
||||
if (this.selfWatering == true ||(this.thisLocation.isOutdoors && Game1.isRaining))
|
||||
if (this.selfWatering == true ||(this.thisLocation.IsOutdoors && Game1.isRaining))
|
||||
{
|
||||
this.isWatered = true;
|
||||
this.animationManager.setAnimation("Watered", 0);
|
||||
|
@ -565,13 +549,13 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (this.crop != null)
|
||||
{
|
||||
Utilities.cropNewDay(this,this.crop,1, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation);
|
||||
Utilities.cropNewDay(this,this.crop,1, 0, (int)this.TileLocation.X, (int)this.TileLocation.Y, this.thisLocation);
|
||||
|
||||
}
|
||||
|
||||
if (this.modularCrop != null)
|
||||
{
|
||||
Utilities.cropNewDayModded(this,this.modularCrop,1, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation);
|
||||
Utilities.cropNewDayModded(this,this.modularCrop,1, 0, (int)this.TileLocation.X, (int)this.TileLocation.Y, this.thisLocation);
|
||||
}
|
||||
if (this.selfWatering == false)
|
||||
{
|
||||
|
@ -583,13 +567,13 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (this.crop != null)
|
||||
{
|
||||
Utilities.cropNewDay(this, this.crop, 0, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation);
|
||||
Utilities.cropNewDay(this, this.crop, 0, 0, (int)this.TileLocation.X, (int)this.TileLocation.Y, this.thisLocation);
|
||||
|
||||
}
|
||||
|
||||
if (this.modularCrop != null)
|
||||
{
|
||||
Utilities.cropNewDayModded(this, this.modularCrop, 0, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation);
|
||||
Utilities.cropNewDayModded(this, this.modularCrop, 0, 0, (int)this.TileLocation.X, (int)this.TileLocation.Y, this.thisLocation);
|
||||
}
|
||||
if (this.selfWatering == false)
|
||||
{
|
||||
|
@ -602,7 +586,7 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (this.crop != null)
|
||||
{
|
||||
if (this.crop.dead) this.crop = null;
|
||||
if (this.crop.dead.Value) this.crop = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -610,7 +594,7 @@ namespace AdditionalCropsFramework
|
|||
|
||||
}
|
||||
|
||||
public void resetOnPlayerEntry(GameLocation environment)
|
||||
public override void resetOnPlayerEntry(GameLocation environment)
|
||||
{
|
||||
this.removeLights(environment);
|
||||
if (Game1.isDarkOut())
|
||||
|
@ -619,31 +603,12 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
}
|
||||
|
||||
public override bool performObjectDropInAction(StardewValley.Object dropIn, bool probe, StardewValley.Farmer who)
|
||||
public override bool performObjectDropInAction(Item dropIn, bool probe, StardewValley.Farmer who)
|
||||
{
|
||||
if ((this.Decoration_type == 11 || this.Decoration_type == 5) && this.heldObject == null && !dropIn.bigCraftable && (!(dropIn is PlanterBox) || ((dropIn as PlanterBox).getTilesWide() == 1 && (dropIn as PlanterBox).getTilesHigh() == 1)))
|
||||
{
|
||||
this.heldObject = (StardewValley.Object)dropIn.getOne();
|
||||
this.heldObject.tileLocation = this.tileLocation;
|
||||
this.heldObject.boundingBox.X = this.boundingBox.X;
|
||||
this.heldObject.boundingBox.Y = this.boundingBox.Y;
|
||||
// Log.AsyncO(getDefaultBoundingBoxForType((dropIn as PlanterBox).Decoration_type));
|
||||
this.heldObject.performDropDownAction(who);
|
||||
if (!probe)
|
||||
{
|
||||
Game1.playSound("woodyStep");
|
||||
// Log.AsyncC("HUH?");
|
||||
if (who != null)
|
||||
{
|
||||
who.reduceActiveItemByOne();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return base.performObjectDropInAction(dropIn, probe, who);
|
||||
}
|
||||
|
||||
private void addLights(GameLocation environment)
|
||||
public override void addLights(GameLocation environment)
|
||||
{
|
||||
// this.lightSource.lightTexture = Game1.content.Load<Texture2D>("LooseSprites\\Lighting\\lantern");
|
||||
|
||||
|
@ -657,8 +622,8 @@ namespace AdditionalCropsFramework
|
|||
this.sourceIndexOffset = 1;
|
||||
if (this.lightSource == null)
|
||||
{
|
||||
Utility.removeLightSource((int)(this.tileLocation.X * 2000f + this.tileLocation.Y));
|
||||
this.lightSource = new LightSource(4, new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y - Game1.tileSize)), 2f, Color.Black, (int)(this.tileLocation.X * 2000f + this.tileLocation.Y));
|
||||
Utility.removeLightSource((int)(this.TileLocation.X * 2000f + this.TileLocation.Y));
|
||||
this.lightSource = new LightSource(4, new Vector2((float)(this.boundingBox.X + Game1.tileSize / 2), (float)(this.boundingBox.Y - Game1.tileSize)), 2f, Color.Black, (int)(this.TileLocation.X * 2000f + this.TileLocation.Y));
|
||||
Game1.currentLightSources.Add(this.lightSource);
|
||||
return;
|
||||
}
|
||||
|
@ -702,7 +667,7 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
base.performRemoveAction(tileLocation, environment);
|
||||
}
|
||||
public bool isGroundFurniture()
|
||||
public override bool isGroundFurniture()
|
||||
{
|
||||
return this.Decoration_type != 13 && this.Decoration_type != 6 && this.Decoration_type != 13;
|
||||
}
|
||||
|
@ -723,18 +688,18 @@ namespace AdditionalCropsFramework
|
|||
Vector2 vector = tile * (float)Game1.tileSize + new Vector2((float)i, (float)j) * (float)Game1.tileSize;
|
||||
vector.X += (float)(Game1.tileSize / 2);
|
||||
vector.Y += (float)(Game1.tileSize / 2);
|
||||
foreach (KeyValuePair<Vector2, StardewValley.Object> something in l.objects)
|
||||
foreach (KeyValuePair<Vector2, StardewValley.Object> something in l.objects.Pairs)
|
||||
{
|
||||
StardewValley.Object obj = something.Value;
|
||||
if ((obj.GetType()).ToString().Contains("PlanterBox"))
|
||||
{
|
||||
PlanterBox current = (PlanterBox)obj;
|
||||
if (current.Decoration_type == 11 && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y) && current.heldObject == null && this.getTilesWide() == 1)
|
||||
if (current.Decoration_type == 11 && current.getBoundingBox(current.TileLocation).Contains((int)vector.X, (int)vector.Y) && current.heldObject.Value == null && this.getTilesWide() == 1)
|
||||
{
|
||||
bool result = true;
|
||||
return result;
|
||||
}
|
||||
if ((current.Decoration_type != 12 || this.Decoration_type == 12) && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y))
|
||||
if ((current.Decoration_type != 12 || this.Decoration_type == 12) && current.getBoundingBox(current.TileLocation).Contains((int)vector.X, (int)vector.Y))
|
||||
{
|
||||
bool result = false;
|
||||
return result;
|
||||
|
@ -776,17 +741,17 @@ namespace AdditionalCropsFramework
|
|||
}
|
||||
}
|
||||
|
||||
public void updateDrawPosition()
|
||||
public override void updateDrawPosition()
|
||||
{
|
||||
this.drawPosition = new Vector2((float)this.boundingBox.X, (float)(this.boundingBox.Y - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)));
|
||||
}
|
||||
|
||||
public int getTilesWide()
|
||||
public override int getTilesWide()
|
||||
{
|
||||
return this.boundingBox.Width / Game1.tileSize;
|
||||
}
|
||||
|
||||
public int getTilesHigh()
|
||||
public override int getTilesHigh()
|
||||
{
|
||||
return this.boundingBox.Height / Game1.tileSize;
|
||||
}
|
||||
|
@ -797,16 +762,15 @@ namespace AdditionalCropsFramework
|
|||
Point point = new Point(x / Game1.tileSize, y / Game1.tileSize);
|
||||
|
||||
|
||||
this.tileLocation = new Vector2((float)point.X, (float)point.Y);
|
||||
bool flag = false;
|
||||
this.TileLocation = new Vector2((float)point.X, (float)point.Y);
|
||||
|
||||
if (this.IsSolid)
|
||||
{
|
||||
this.boundingBox = new Rectangle(x / Game1.tileSize * Game1.tileSize, y / Game1.tileSize * Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height);
|
||||
this.boundingBox.Value = new Rectangle(x / Game1.tileSize * Game1.tileSize, y / Game1.tileSize * Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.boundingBox = new Rectangle(int.MinValue, y / Game1.tileSize * Game1.tileSize, 0, 0);
|
||||
this.boundingBox.Value = new Rectangle(int.MinValue, y / Game1.tileSize * Game1.tileSize, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -824,7 +788,7 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
while (enumerator3.MoveNext())
|
||||
{
|
||||
if (enumerator3.Current.GetBoundingBox().Intersects(this.boundingBox))
|
||||
if (enumerator3.Current.GetBoundingBox().Intersects(this.boundingBox.Value))
|
||||
{
|
||||
Game1.showRedMessage("Can't place on top of a person.");
|
||||
bool result = false;
|
||||
|
@ -848,12 +812,12 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public override Rectangle getBoundingBox(Vector2 tileLocation)
|
||||
{
|
||||
return this.boundingBox;
|
||||
return this.boundingBox.Value;
|
||||
}
|
||||
|
||||
public override int salePrice()
|
||||
{
|
||||
return this.price;
|
||||
return this.Price;
|
||||
}
|
||||
|
||||
public override int maximumStackSize()
|
||||
|
@ -863,7 +827,7 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public override int getStack()
|
||||
{
|
||||
return this.stack;
|
||||
return this.Stack;
|
||||
}
|
||||
|
||||
public override int addToStack(int amount)
|
||||
|
@ -875,16 +839,16 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (animationManager == null)
|
||||
{
|
||||
spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
spriteBatch.Draw(this.TextureSheet.texture, objectPosition, new Microsoft.Xna.Framework.Rectangle?(GameLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteBatch.Draw(this.TextureSheet, objectPosition,this.animationManager.currentAnimation.sourceRectangle, Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
spriteBatch.Draw(this.TextureSheet.texture, objectPosition,this.animationManager.currentAnimation.sourceRectangle, Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
}
|
||||
|
||||
if (f.ActiveObject != null && f.ActiveObject.Name.Contains("="))
|
||||
{
|
||||
spriteBatch.Draw(this.TextureSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
spriteBatch.Draw(this.TextureSheet.texture, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(GameLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
||||
if (Math.Abs(Game1.starCropShimmerPause) <= 0.05f && Game1.random.NextDouble() < 0.97)
|
||||
{
|
||||
return;
|
||||
|
@ -899,12 +863,12 @@ namespace AdditionalCropsFramework
|
|||
//base.drawWhenHeld(spriteBatch, objectPosition, f);
|
||||
}
|
||||
|
||||
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
|
||||
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadows)
|
||||
{
|
||||
if(animationManager==null) spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * (3) * scaleSize, SpriteEffects.None, layerDepth);
|
||||
if(animationManager==null) spriteBatch.Draw(TextureSheet.texture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * (3) * scaleSize, SpriteEffects.None, layerDepth);
|
||||
else
|
||||
{
|
||||
spriteBatch.Draw(animationManager.objectTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(animationManager.currentAnimation.sourceRectangle), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * (3) * scaleSize, SpriteEffects.None, layerDepth);
|
||||
spriteBatch.Draw(animationManager.objectTexture.texture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(animationManager.currentAnimation.sourceRectangle), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * (3) * scaleSize, SpriteEffects.None, layerDepth);
|
||||
|
||||
|
||||
//this.modularCrop.drawInMenu(spriteBatch, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), Color.White, 0f,true);
|
||||
|
@ -917,21 +881,21 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public void drawCropWhenPlanterBoxHeld(PlanterBox p, SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
|
||||
{
|
||||
spriteBatch.Draw(Game1.cropSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(Game1.player.GetBoundingBox().Center.X - Game1.tileSize / 2, (Game1.player.GetBoundingBox().Center.Y - Game1.tileSize * 4 / 3) - (Game1.tileSize * 2))), getCropSourceRect(this.crop.rowInSpriteSheet,this.crop), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(p.boundingBox.Bottom + 1) / 10000f);
|
||||
spriteBatch.Draw(Game1.cropSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(Game1.player.GetBoundingBox().Center.X - Game1.tileSize / 2, (Game1.player.GetBoundingBox().Center.Y - Game1.tileSize * 4 / 3) - (Game1.tileSize * 2))), getCropSourceRect(this.crop.rowInSpriteSheet.Value,this.crop), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(p.boundingBox.Bottom + 1) / 10000f);
|
||||
}
|
||||
|
||||
private Rectangle getCropSourceRect(int number, Crop c)
|
||||
{
|
||||
if (c.dead)
|
||||
if (c.dead.Value)
|
||||
return new Rectangle(192 + number % 4 * 16, 384, 16, 32);
|
||||
return new Rectangle(Math.Min(240, (c.fullyGrown ? (c.dayOfCurrentPhase <= 0 ? 6 : 7) : (c.phaseToShow != -1 ? c.phaseToShow : c.currentPhase) + ((c.phaseToShow != -1 ? c.phaseToShow : c.currentPhase) != 0 || number % 2 != 0 ? 0 : -1) + 1) * 16 + (c.rowInSpriteSheet % 2 != 0 ? 128 : 0)), c.rowInSpriteSheet / 2 * 16 * 2, 16, 32);
|
||||
return new Rectangle(Math.Min(240, (c.fullyGrown.Value ? (c.dayOfCurrentPhase.Value <= 0 ? 6 : 7) : (c.phaseToShow.Value!= -1 ? c.phaseToShow : c.currentPhase) + ((c.phaseToShow.Value != -1 ? c.phaseToShow : c.currentPhase) != 0 || number % 2 != 0 ? 0 : -1) + 1) * 16 + (c.rowInSpriteSheet.Value % 2 != 0 ? 128 : 0)), c.rowInSpriteSheet.Value / 2 * 16 * 2, 16, 32);
|
||||
}
|
||||
|
||||
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
||||
{
|
||||
if (x == -1)
|
||||
{
|
||||
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
|
||||
spriteBatch.Draw(TextureSheet.texture, Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
|
||||
this.drawCrops(Game1.spriteBatch,(int) Game1.GlobalToLocal(Game1.viewport, this.drawPosition).X,(int) Game1.GlobalToLocal(Game1.viewport, this.drawPosition).Y);
|
||||
}
|
||||
else
|
||||
|
@ -939,14 +903,14 @@ namespace AdditionalCropsFramework
|
|||
//The actual planter box being drawn.
|
||||
if (animationManager == null)
|
||||
{
|
||||
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
spriteBatch.Draw(TextureSheet.texture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
// Log.AsyncG("ANIMATION IS NULL?!?!?!?!");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//Log.AsyncC("Animation Manager is working!");
|
||||
spriteBatch.Draw(animationManager.objectTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(animationManager.currentAnimation.sourceRectangle), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
this.animationManager.draw(spriteBatch,animationManager.objectTexture.texture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(animationManager.currentAnimation.sourceRectangle), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
try
|
||||
{
|
||||
this.animationManager.tickAnimation();
|
||||
|
@ -960,15 +924,15 @@ namespace AdditionalCropsFramework
|
|||
|
||||
// spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0));
|
||||
|
||||
if (this.heldObject != null)
|
||||
if (this.heldObject.Value != null)
|
||||
{
|
||||
if (this.heldObject is PlanterBox)
|
||||
if (this.heldObject.Value is PlanterBox)
|
||||
{
|
||||
(this.heldObject as PlanterBox).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject as PlanterBox).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
|
||||
(this.heldObject.Value as PlanterBox).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject.Value as PlanterBox).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
|
||||
return;
|
||||
}
|
||||
spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 5 / 6)), new Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)this.boundingBox.Bottom / 10000f);
|
||||
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.heldObject.ParentSheetIndex)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
|
||||
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(GameLocation.getSourceRectForObject(this.heldObject.Value.ParentSheetIndex)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
|
||||
}
|
||||
this.drawCrops(Game1.spriteBatch, (int)x, (int)y);
|
||||
|
||||
|
@ -985,7 +949,7 @@ namespace AdditionalCropsFramework
|
|||
{
|
||||
if (this.modularCrop != null)
|
||||
{
|
||||
this.modularCrop.draw(Game1.spriteBatch, this.tileLocation, Color.White, 0);
|
||||
this.modularCrop.draw(Game1.spriteBatch, this.TileLocation, Color.White, 0);
|
||||
// Log.AsyncM("draw a modular crop now");
|
||||
}
|
||||
// Log.AsyncC("wait WTF");
|
||||
|
@ -993,7 +957,7 @@ namespace AdditionalCropsFramework
|
|||
if (this.crop != null)
|
||||
{
|
||||
|
||||
this.crop.draw(Game1.spriteBatch, this.tileLocation, Color.White, 0);
|
||||
this.crop.draw(Game1.spriteBatch, this.TileLocation, Color.White, 0);
|
||||
//Log.AsyncG("COWS GO MOO");
|
||||
}
|
||||
}
|
||||
|
@ -1035,21 +999,21 @@ namespace AdditionalCropsFramework
|
|||
|
||||
public void drawCropInMenu(PlanterBox p, SpriteBatch b, Vector2 screenPosition, Color c, float roation, float scale, float layerDepth)
|
||||
{
|
||||
b.Draw(Game1.cropSpriteSheet, new Vector2(screenPosition.X, screenPosition.Y - (Game1.tileSize / 2)), new Rectangle?(this.getCropSourceRect(this.crop.rowInSpriteSheet,this.crop)), Color.White, 0f, new Vector2((float)(p.defaultSourceRect.Width / 2), (float)(p.defaultSourceRect.Height / 2)), 1f * (2) * scale, SpriteEffects.None, layerDepth);
|
||||
b.Draw(Game1.cropSpriteSheet, new Vector2(screenPosition.X, screenPosition.Y - (Game1.tileSize / 2)), new Rectangle?(this.getCropSourceRect(this.crop.rowInSpriteSheet.Value,this.crop)), Color.White, 0f, new Vector2((float)(p.defaultSourceRect.Width / 2), (float)(p.defaultSourceRect.Height / 2)), 1f * (2) * scale, SpriteEffects.None, layerDepth);
|
||||
}
|
||||
|
||||
public new void drawAtNonTileSpot(SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
|
||||
{
|
||||
spriteBatch.Draw(TextureSheet, location, new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
|
||||
spriteBatch.Draw(TextureSheet.texture, location, new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
|
||||
|
||||
// this.drawCrops(spriteBatch, (int)location.X*Game1.tileSize, (int)location.Y*Game1.tileSize, 1, true);
|
||||
}
|
||||
|
||||
public override Item getOne()
|
||||
public override Item getOne(IModHelper helper)
|
||||
{
|
||||
|
||||
if (this.dataPath == "") return new PlanterBox(this.parentSheetIndex, this.tileLocation);
|
||||
else return new PlanterBox(this.parentSheetIndex, this.tileLocation,this.texturePath,this.dataPath);
|
||||
if (this.dataPath == "") return new PlanterBox(helper,this.ParentSheetIndex, this.TileLocation);
|
||||
else return new PlanterBox(helper,this.ParentSheetIndex, this.TileLocation,this.texturePath,this.dataPath);
|
||||
|
||||
/*
|
||||
drawPosition = this.drawPosition;
|
||||
|
@ -1083,204 +1047,15 @@ namespace AdditionalCropsFramework
|
|||
makeCropInformationString(I);
|
||||
StardustCore.ModCore.SerializationManager.WriteToJsonFile(Path.Combine(s, I.Name + ".json"), (PlanterBox)I);
|
||||
}
|
||||
|
||||
public static Item ParseIntoInventory(string s)
|
||||
|
||||
/// <summary>
|
||||
/// Needs to be rewritten.......
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public static PlanterBox ParseIntoInventory(string s)
|
||||
{
|
||||
// PlanterBox p = new PlanterBox();
|
||||
// return p;
|
||||
|
||||
|
||||
|
||||
dynamic obj = JObject.Parse(s);
|
||||
|
||||
PlanterBox d = new PlanterBox();
|
||||
|
||||
d.dataPath = obj.dataPath;
|
||||
d.price = obj.price;
|
||||
d.Decoration_type = obj.Decoration_type;
|
||||
d.rotations = obj.rotations;
|
||||
d.currentRotation = obj.currentRotation;
|
||||
string s1 = Convert.ToString(obj.sourceRect);
|
||||
d.sourceRect = Utilities.parseRectFromJson(s1);
|
||||
string s2 = Convert.ToString(obj.defaultSourceRect);
|
||||
d.defaultSourceRect = Utilities.parseRectFromJson(s2);
|
||||
string s3 = Convert.ToString(obj.defaultBoundingBox);
|
||||
d.defaultBoundingBox = Utilities.parseRectFromJson(s3);
|
||||
d.description = obj.description;
|
||||
d.flipped = obj.flipped;
|
||||
d.flaggedForPickUp = obj.flaggedForPickUp;
|
||||
d.tileLocation = obj.tileLocation;
|
||||
d.parentSheetIndex = obj.parentSheetIndex;
|
||||
d.owner = obj.owner;
|
||||
d.name = obj.name;
|
||||
d.type = obj.type;
|
||||
d.canBeSetDown = obj.canBeSetDown;
|
||||
d.canBeGrabbed = obj.canBeGrabbed;
|
||||
d.isHoedirt = obj.isHoedirt;
|
||||
d.isSpawnedObject = obj.isSpawnedObject;
|
||||
d.questItem = obj.questItem;
|
||||
d.isOn = obj.isOn;
|
||||
d.fragility = obj.fragility;
|
||||
d.edibility = obj.edibility;
|
||||
d.stack = obj.stack;
|
||||
d.quality = obj.quality;
|
||||
d.bigCraftable = obj.bigCraftable;
|
||||
d.setOutdoors = obj.setOutdoors;
|
||||
d.setIndoors = obj.setIndoors;
|
||||
d.readyForHarvest = obj.readyForHarvest;
|
||||
d.showNextIndex = obj.showNextIndex;
|
||||
d.hasBeenPickedUpByFarmer = obj.hasBeenPickedUpByFarmer;
|
||||
d.isRecipe = obj.isRecipe;
|
||||
d.isLamp = obj.isLamp;
|
||||
d.heldObject = obj.heldObject;
|
||||
d.minutesUntilReady = obj.minutesUntilReady;
|
||||
string s4 = Convert.ToString(obj.boundingBox);
|
||||
d.boundingBox = Utilities.parseRectFromJson(s4);
|
||||
d.scale = obj.scale;
|
||||
d.lightSource = obj.lightSource;
|
||||
d.shakeTimer = obj.shakeTimer;
|
||||
d.internalSound = obj.internalSound;
|
||||
d.specialVariable = obj.specialVariable;
|
||||
d.category = obj.category;
|
||||
d.specialItem = obj.specialItem;
|
||||
d.hasBeenInInventory = obj.hasBeenInInventory;
|
||||
|
||||
|
||||
string t = obj.texturePath;
|
||||
d.TextureSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, t));
|
||||
d.texturePath = t;
|
||||
JArray array = obj.inventory;
|
||||
d.inventory = array.ToObject<List<Item>>();
|
||||
d.inventoryMaxSize = obj.inventoryMaxSize;
|
||||
d.itemReadyForHarvest = obj.itemReadyForHarvest;
|
||||
d.lightsOn = obj.lightsOn;
|
||||
d.lightColor = obj.lightColor;
|
||||
d.thisType = obj.thisType;
|
||||
d.removable = obj.removable;
|
||||
d.locationsName = obj.locationsName;
|
||||
|
||||
d.drawColor = obj.drawColor;
|
||||
d.normalCropSeedIndex = obj.normalCropSeedIndex;
|
||||
d.cropInformationString = obj.cropInformationString;
|
||||
d.serializationName = obj.serializationName;
|
||||
d.IsSolid = obj.IsSolid;
|
||||
d.selfWatering = obj.selfWatering;
|
||||
d.greenHouseEffect = obj.greenHouseEffect;
|
||||
string IsWatered = obj.isWatered;
|
||||
// Log.AsyncC("AM I WATERED OR NOT?!?!?: "+IsWatered);
|
||||
d.isWatered = Convert.ToBoolean(IsWatered);
|
||||
//ANIMATIONS
|
||||
var q = obj.animationManager;
|
||||
dynamic obj1 = q;
|
||||
string name =Convert.ToString( obj1.currentAnimationName);
|
||||
int frame = Convert.ToInt32(obj1.currentAnimationListIndex);
|
||||
PlanterBox dummy = new PlanterBox(d.parentSheetIndex, d.tileLocation, d.texturePath, d.dataPath, d.removable, d.IsSolid);
|
||||
d.animationManager = dummy.animationManager;
|
||||
bool f = d.animationManager.setAnimation(name, frame);
|
||||
bool f2;
|
||||
if (f == false)
|
||||
{
|
||||
f2 = d.animationManager.setAnimation(name, 0);
|
||||
if (f2 == false) d.animationManager.currentAnimation = d.animationManager.defaultDrawFrame;
|
||||
}
|
||||
// Log.AsyncC(d.cropInformationString);
|
||||
|
||||
try
|
||||
{
|
||||
string[] cropInfo = d.cropInformationString.Split('/');
|
||||
|
||||
foreach (var v in cropInfo)
|
||||
{
|
||||
// Log.AsyncM(v);
|
||||
|
||||
}
|
||||
|
||||
if (cropInfo[0] == "true") //modular crop
|
||||
{
|
||||
ModularCrop c = new ModularCrop(Convert.ToInt32(cropInfo[1]), Convert.ToInt32(cropInfo[2]), Convert.ToInt32(cropInfo[3]), cropInfo[4], cropInfo[5], cropInfo[6], cropInfo[7]);
|
||||
c.currentPhase = Convert.ToInt32(cropInfo[8]);
|
||||
c.dayOfCurrentPhase = Convert.ToInt32(cropInfo[9]);
|
||||
try
|
||||
{
|
||||
c.fullyGrown = Convert.ToBoolean(cropInfo[10]);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
d.modularCrop = c;
|
||||
// Log.AsyncM("PARSED MODULAR CROP!");
|
||||
// Log.AsyncG(cropInfo[8]);
|
||||
// Log.AsyncG(cropInfo[9]);
|
||||
// Log.AsyncG(cropInfo[10]);
|
||||
}
|
||||
if (cropInfo[0] == "false") //non-modular crop
|
||||
{
|
||||
Crop c = new Crop(Convert.ToInt32(d.normalCropSeedIndex), Convert.ToInt32(cropInfo[2]), Convert.ToInt32(cropInfo[3]));
|
||||
|
||||
Dictionary<int, string> dictionary = Game1.content.Load<Dictionary<int, string>>("Data\\Crops");
|
||||
if (dictionary.ContainsKey(Convert.ToInt32(cropInfo[1])))
|
||||
{
|
||||
string[] strArray1 = dictionary[Convert.ToInt32(cropInfo[1])].Split('/');
|
||||
string str1 = strArray1[0];
|
||||
char[] chArray1 = new char[1] { ' ' };
|
||||
c.phaseDays = new List<int>();
|
||||
foreach (string str2 in str1.Split(chArray1))
|
||||
{
|
||||
c.phaseDays.Add(Convert.ToInt32(str2));
|
||||
}
|
||||
c.phaseDays.Add(99999);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
c.currentPhase = Convert.ToInt32(cropInfo[4]);
|
||||
c.dayOfCurrentPhase = Convert.ToInt32(cropInfo[5]);
|
||||
|
||||
try
|
||||
{
|
||||
c.fullyGrown = Convert.ToBoolean(cropInfo[10]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
// Log.AsyncM("PARSED Regular CROP!");
|
||||
// Log.AsyncG(cropInfo[1]);
|
||||
// Log.AsyncG(cropInfo[2]);
|
||||
// Log.AsyncG(cropInfo[3]);
|
||||
// Log.AsyncR(c.phaseDays.Count);
|
||||
// Log.AsyncM("PARSED REGULAR CROP! FINISH");
|
||||
|
||||
d.crop = c;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// Log.AsyncO(err);
|
||||
}
|
||||
//ModularCrop f= j.ToObject<ModularCrop>();
|
||||
//ModularCrop f = obj.modularCrop;
|
||||
|
||||
// Log.AsyncG("THIS IS CROP: " + c.indexOfHarvest);
|
||||
//Log.AsyncG(cropString);
|
||||
|
||||
|
||||
// d.crop = obj.crop;
|
||||
// d.modularCrop = obj.modularCrop;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
return d;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Log.AsyncM(e);
|
||||
return null;
|
||||
}
|
||||
return ModCore.ModHelper.ReadJsonFile<PlanterBox>(s);
|
||||
|
||||
//return base.ParseIntoInventory();
|
||||
}
|
||||
|
@ -1299,13 +1074,13 @@ namespace AdditionalCropsFramework
|
|||
if ((I as PlanterBox).crop != null)
|
||||
{
|
||||
Crop c = (I as PlanterBox).crop;
|
||||
(I as PlanterBox).cropInformationString = "false" + "/" + (I as PlanterBox).normalCropSeedIndex + "/" + (I as PlanterBox).tileLocation.X + "/" + (I as PlanterBox).tileLocation.Y + "/" + c.currentPhase + "/" + c.dayOfCurrentPhase + "/" + c.fullyGrown; ;
|
||||
(I as PlanterBox).cropInformationString = "false" + "/" + (I as PlanterBox).normalCropSeedIndex + "/" + (I as PlanterBox).TileLocation.X + "/" + (I as PlanterBox).TileLocation.Y + "/" + c.currentPhase.Value + "/" + c.dayOfCurrentPhase.Value + "/" + c.fullyGrown.Value; ;
|
||||
}
|
||||
|
||||
if ((I as PlanterBox).modularCrop != null)
|
||||
{
|
||||
ModularCrop m = (I as PlanterBox).modularCrop;
|
||||
(I as PlanterBox).cropInformationString = "true" + "/" + m.seedIndex + "/" + (I as PlanterBox).tileLocation.X + "/" + (I as PlanterBox).tileLocation.Y + "/" + m.dataFileName + "/" + m.spriteSheetName + "/" + m.cropObjectTexture + "/" + m.cropObjectData + "/" + m.currentPhase + "/" + m.dayOfCurrentPhase+"/"+m.fullyGrown;
|
||||
(I as PlanterBox).cropInformationString = "true" + "/" + m.seedIndex + "/" + (I as PlanterBox).TileLocation.X + "/" + (I as PlanterBox).TileLocation.Y + "/" + m.dataFileName + "/" + m.spriteSheetName + "/" + m.cropObjectTexture + "/" + m.cropObjectData + "/" + m.currentPhase + "/" + m.dayOfCurrentPhase+"/"+m.fullyGrown;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -8,7 +8,7 @@
|
|||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Omegasis.SaveBackup</RootNamespace>
|
||||
<AssemblyName>SaveBackup</AssemblyName>
|
||||
<AssemblyName>AdvancedSaveBackup</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
|
@ -31,6 +31,42 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
|
@ -50,13 +86,16 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Name": "Advanced Save Backup",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.5.0",
|
||||
"Description": "Backs up your save files when loading SMAPI and every in game night when saving.",
|
||||
"UniqueID": "Omegasis.AdvancedSaveBackup",
|
||||
"EntryDll": "AdvancedSaveBackup.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ "Nexus:435" ]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -31,6 +31,42 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -48,13 +84,16 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Auto Speed",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.4.1",
|
||||
"Version": "1.5.0",
|
||||
"Description": "Got to go fast!",
|
||||
"UniqueID": "Omegasis.AutoSpeed",
|
||||
"EntryDll": "AutoSpeed.dll",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -31,6 +31,42 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -50,13 +86,16 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Billboard Anywhere",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.4.1",
|
||||
"Version": "1.5.0",
|
||||
"Description": "Lets you view the billboard from anywhere.",
|
||||
"UniqueID": "Omegasis.BillboardAnywhere",
|
||||
"EntryDll": "BillboardAnywhere.dll",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -18,7 +18,7 @@ namespace Omegasis.BuildEndurance
|
|||
private string DataFilePath => Path.Combine("data", $"{Constants.SaveFolderName}.json");
|
||||
|
||||
/// <summary>The absolute path for the current player's legacy data file.</summary>
|
||||
private string LegacyDataFilePath => Path.Combine(this.Helper.DirectoryPath, "PlayerData", $"BuildEndurance_data_{Game1.player.name}.txt");
|
||||
private string LegacyDataFilePath => Path.Combine(this.Helper.DirectoryPath, "PlayerData", $"BuildEndurance_data_{Game1.player.Name}.txt");
|
||||
|
||||
/// <summary>The mod settings.</summary>
|
||||
private ModConfig Config;
|
||||
|
@ -39,6 +39,9 @@ namespace Omegasis.BuildEndurance
|
|||
private bool WasEating;
|
||||
|
||||
|
||||
public IModHelper ModHelper;
|
||||
public IMonitor ModMonitor;
|
||||
|
||||
/*********
|
||||
** Public methods
|
||||
*********/
|
||||
|
@ -52,6 +55,9 @@ namespace Omegasis.BuildEndurance
|
|||
GameEvents.OneSecondTick += this.GameEvents_OneSecondTick;
|
||||
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
|
||||
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
|
||||
|
||||
this.ModHelper = this.Helper;
|
||||
this.ModMonitor = this.Monitor;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +83,7 @@ namespace Omegasis.BuildEndurance
|
|||
return;
|
||||
|
||||
// give XP when player finishes eating
|
||||
if (Game1.isEating)
|
||||
if (Game1.player.isEating)
|
||||
this.WasEating = true;
|
||||
else if (this.WasEating)
|
||||
{
|
||||
|
@ -86,7 +92,7 @@ namespace Omegasis.BuildEndurance
|
|||
}
|
||||
|
||||
// give XP when player uses tool
|
||||
if (!this.HasRecentToolExp && Game1.player.usingTool)
|
||||
if (!this.HasRecentToolExp && Game1.player.UsingTool)
|
||||
{
|
||||
this.PlayerData.CurrentExp += this.Config.ExpForToolUse;
|
||||
this.HasRecentToolExp = true;
|
||||
|
@ -97,7 +103,7 @@ namespace Omegasis.BuildEndurance
|
|||
{
|
||||
this.PlayerData.CurrentExp += this.Config.ExpForExhaustion;
|
||||
this.WasExhausted = true;
|
||||
this.Monitor.Log("The player is exhausted");
|
||||
//this.Monitor.Log("The player is exhausted");
|
||||
}
|
||||
|
||||
// give XP when player stays up too late or collapses
|
||||
|
@ -105,7 +111,7 @@ namespace Omegasis.BuildEndurance
|
|||
{
|
||||
this.PlayerData.CurrentExp += this.Config.ExpForCollapsing;
|
||||
this.WasCollapsed = true;
|
||||
this.Monitor.Log("The player has collapsed!");
|
||||
//this.Monitor.Log("The player has collapsed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,42 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -49,13 +85,16 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Build Endurance",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.4.1",
|
||||
"Version": "1.5.0",
|
||||
"Description": "Increase your health as you play.",
|
||||
"UniqueID": "Omegasis.BuildEndurance",
|
||||
"EntryDll": "BuildEndurance.dll",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -18,7 +18,7 @@ namespace Omegasis.BuildHealth
|
|||
private string DataFilePath => Path.Combine("data", $"{Constants.SaveFolderName}.json");
|
||||
|
||||
/// <summary>The absolute path for the current player's legacy data file.</summary>
|
||||
private string LegacyDataFilePath => Path.Combine(this.Helper.DirectoryPath, "PlayerData", $"BuildHealth_data_{Game1.player.name}.txt");
|
||||
private string LegacyDataFilePath => Path.Combine(this.Helper.DirectoryPath, "PlayerData", $"BuildHealth_data_{Game1.player.Name}.txt");
|
||||
|
||||
/// <summary>The mod settings and player data.</summary>
|
||||
private ModConfig Config;
|
||||
|
@ -77,7 +77,7 @@ namespace Omegasis.BuildHealth
|
|||
return;
|
||||
|
||||
// give XP when player finishes eating
|
||||
if (Game1.isEating)
|
||||
if (Game1.player.isEating)
|
||||
this.WasEating = true;
|
||||
else if (this.WasEating)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ namespace Omegasis.BuildHealth
|
|||
}
|
||||
|
||||
// give XP when player uses tool
|
||||
if (!this.HasRecentToolExp && Game1.player.usingTool)
|
||||
if (!this.HasRecentToolExp && Game1.player.UsingTool)
|
||||
{
|
||||
this.PlayerData.CurrentExp += this.Config.ExpForToolUse;
|
||||
this.HasRecentToolExp = true;
|
||||
|
|
|
@ -31,6 +31,42 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -49,13 +85,16 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Build Health",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.4.1",
|
||||
"Version": "1.5.0",
|
||||
"Description": "Increase your health as you play.",
|
||||
"UniqueID": "Omegasis.BuildHealth",
|
||||
"EntryDll": "BuildHealth.dll",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -31,6 +31,42 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -51,13 +87,16 @@
|
|||
<None Include="packages.config" />
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -224,6 +224,7 @@ namespace Omegasis.BuyBackCollectables.Framework
|
|||
if (current2.containsPoint(x, y) && this.NewItem != null && Game1.player.money >= this.Value)
|
||||
{
|
||||
Game1.player.money -= this.Value;
|
||||
Game1.playSound("coin");
|
||||
Game1.player.addItemByMenuIfNecessary(this.NewItem);
|
||||
}
|
||||
}
|
||||
|
@ -239,6 +240,7 @@ namespace Omegasis.BuyBackCollectables.Framework
|
|||
{
|
||||
Game1.player.money -= this.Value;
|
||||
Game1.player.addItemByMenuIfNecessary(this.NewItem);
|
||||
Game1.playSound("coin");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Buy Back Collectables",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "1.4.1",
|
||||
"Version": "1.5.0",
|
||||
"Description": "Lets you buy back any obtained collectable.",
|
||||
"UniqueID": "Omegasis.BuyBackCollectables",
|
||||
"EntryDll": "BuyBackCollectables.dll",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|
|
@ -1,7 +1,10 @@
|
|||
using CustomNPCFramework.Framework.Graphics;
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using CustomNPCFramework.Framework.Graphics;
|
||||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ColorCollections;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using CustomNPCFramework.Framework.Utilities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
|
@ -15,69 +18,215 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// BETA VERSION 0.1.0: Lots of ways this can be improved upon.
|
||||
/// TODO:
|
||||
///
|
||||
///
|
||||
/// List all asset managers in use.
|
||||
/// Have all asset managers list what assets they are using.
|
||||
///
|
||||
/// Have asset info have a var called age.
|
||||
/// ...where
|
||||
/// 0=adult
|
||||
/// 1=child
|
||||
///
|
||||
/// /// Have asset info have a var called bodyType.
|
||||
/// ...where
|
||||
/// 0=thin
|
||||
/// 1=normal
|
||||
/// 2=muscular
|
||||
/// 3=big
|
||||
///
|
||||
/// Load in the assets and go go go.
|
||||
/// -Collect a bunch of assets together to test this thing.
|
||||
///
|
||||
/// Find way to make sideways shirts render correctly.
|
||||
///
|
||||
///Get suggestions from modding community on requests and ways to improve the mod.
|
||||
|
||||
/// </summary>
|
||||
|
||||
public class Class1 : Mod
|
||||
{
|
||||
/// <summary>
|
||||
/// The mod helper for the mod.
|
||||
/// </summary>
|
||||
public static IModHelper ModHelper;
|
||||
/// <summary>
|
||||
/// The mod monitor for the mod.
|
||||
/// </summary>
|
||||
public static IMonitor ModMonitor;
|
||||
public static AssetManager assetManager;
|
||||
|
||||
/// <summary>
|
||||
/// The npc tracker for the mod. Keeps track of all npcs added by the custom framework and cleans them up during saving.
|
||||
/// </summary>
|
||||
public static NPCTracker npcTracker;
|
||||
/// <summary>
|
||||
/// Keeps track of all of the asets/textures added in by the framework. Also manages all of the asset managers that are the ones actually managing the textures.
|
||||
/// </summary>
|
||||
public static AssetPool assetPool;
|
||||
|
||||
/// <summary>
|
||||
/// Ran when loading the SMAPI. Used to initialize data.
|
||||
/// </summary>
|
||||
/// <param name="helper"></param>
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = this.Helper;
|
||||
ModMonitor = this.Monitor;
|
||||
assetManager = new AssetManager();
|
||||
initializeExamples();
|
||||
assetManager.loadAssets();
|
||||
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_LoadChar;
|
||||
StardewModdingAPI.Events.LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged;
|
||||
|
||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterSave += SaveEvents_AfterSave;
|
||||
|
||||
StardewModdingAPI.Events.PlayerEvents.Warped += LocationEvents_CurrentLocationChanged;
|
||||
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||
npcTracker = new NPCTracker();
|
||||
assetPool = new AssetPool();
|
||||
var assetManager = new AssetManager();
|
||||
assetPool.addAssetManager(new KeyValuePair<string, AssetManager>("testNPC", assetManager));
|
||||
initializeExamples();
|
||||
initializeAssetPool();
|
||||
assetPool.loadAllAssets();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the asset pool with some test variables.
|
||||
/// </summary>
|
||||
public void initializeAssetPool()
|
||||
{
|
||||
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "NPCS");
|
||||
assetPool.getAssetManager("testNPC").addPathCreateDirectory(new KeyValuePair<string, string>("characters", path));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A function that is called when the game finishes saving.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveEvents_AfterSave(object sender, EventArgs e)
|
||||
{
|
||||
npcTracker.afterSave();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A function that is called when the game is about to load. Used to clean up all the npcs from the game world to prevent it from crashing.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
||||
{
|
||||
npcTracker.cleanUpBeforeSave();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called upon 60 times a second. For testing purposes only. Will remove in future release.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||
{
|
||||
/*
|
||||
if (Game1.player.currentLocation == null) return;
|
||||
if (Game1.activeClickableMenu != null) return;
|
||||
foreach (var v in Game1.player.currentLocation.characters)
|
||||
{
|
||||
v.speed = 5;
|
||||
v.speed = 1;
|
||||
if(v is ExtendedNPC)
|
||||
{
|
||||
(v as ExtendedNPC).SetMovingAndMove(Game1.currentGameTime, Game1.viewport, Game1.player.currentLocation, Direction.right, true);
|
||||
}
|
||||
//v.MovePosition(Game1.currentGameTime, Game1.viewport, Game1.player.currentLocation);
|
||||
ModMonitor.Log(v.sprite.spriteHeight.ToString());
|
||||
//ModMonitor.Log(v.sprite.spriteHeight.ToString());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
|
||||
/// <summary>
|
||||
/// Called when the player's location changes.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsPlayerWarped e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to spawn a custom npc just as an example. Don't keep this code.
|
||||
/// GENERATE NPC AND CALL THE CODE
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveEvents_LoadChar(object sender, EventArgs e)
|
||||
{
|
||||
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "NPCS", "Characters", "RainMan");
|
||||
assetManager.addPathCreateDirectory(new KeyValuePair<string, string>("characters", path));
|
||||
Texture2D tex = ModHelper.Content.Load<Texture2D>(Path.Combine(getShortenedDirectory(path).Remove(0, 1), "character.png"));
|
||||
ModMonitor.Log("PATH???: " + path);
|
||||
ExtendedNPC myNpc3 = new ExtendedNPC(new Framework.ModularNPCS.Sprite(Path.Combine(path,"character.png")),null, new Vector2(14, 14)*Game1.tileSize, 2, "b2");
|
||||
Game1.getLocationFromName("BusStop").addCharacter(myNpc3);
|
||||
myNpc3.SetMovingDown(true);
|
||||
ExtendedNPC myNpc3 = assetPool.generateNPC(Genders.female, 0, 1,new StandardColorCollection(null, null, Color.Blue, null, Color.Yellow, null));
|
||||
MerchantNPC merch = new MerchantNPC(new List<Item>()
|
||||
{
|
||||
new StardewValley.Object(475,999)
|
||||
}, myNpc3);
|
||||
npcTracker.addNewNPCToLocation(Game1.getLocationFromName("BusStop", false), merch,new Vector2(2,23));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to initialize examples for other modders to look at as reference.
|
||||
/// </summary>
|
||||
public void initializeExamples()
|
||||
{
|
||||
return;
|
||||
string dirPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Templates");
|
||||
assetManager.addPathCreateDirectory(new KeyValuePair<string, string>("templates", dirPath));
|
||||
var aManager=assetPool.getAssetManager("testNPC");
|
||||
aManager.addPathCreateDirectory(new KeyValuePair<string, string>("templates", dirPath));
|
||||
string filePath =Path.Combine(dirPath, "Example.json");
|
||||
if (File.Exists(filePath)) return;
|
||||
string getRelativePath = getShortenedDirectory(filePath);
|
||||
ModMonitor.Log("THIS IS THE PATH::: " + getRelativePath);
|
||||
AssetInfo info = new AssetInfo("Example", new Vector2(16, 16), false);
|
||||
info.writeToJson(filePath);
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
string getRelativePath = getShortenedDirectory(filePath);
|
||||
ModMonitor.Log("THIS IS THE PATH::: " + getRelativePath);
|
||||
AssetInfo info = new AssetInfo("MyExample",new NamePairings("StandingExampleL", "StandingExampleR", "StandingExampleU", "StandingExampleD"), new NamePairings("MovingExampleL", "MovingExampleR", "MovingExampleU", "MovingExampleD"), new NamePairings("SwimmingExampleL", "SwimmingExampleR", "SwimmingExampleU", "SwimmingExampleD"), new NamePairings("SittingExampleL", "SittingExampleR", "SittingExampleU", "SittingExampleD"), new Vector2(16, 16), false);
|
||||
info.writeToJson(filePath);
|
||||
|
||||
}
|
||||
string filePath2 = Path.Combine(dirPath, "AdvancedExample.json");
|
||||
if (!File.Exists(filePath2))
|
||||
{
|
||||
|
||||
ExtendedAssetInfo info2 = new ExtendedAssetInfo("AdvancedExample", new NamePairings("AdvancedStandingExampleL", "AdvancedStandingExampleR", "AdvancedStandingExampleU", "AdvancedStandingExampleD"), new NamePairings("AdvancedMovingExampleL", "AdvancedMovingExampleR", "AdvancedMovingExampleU", "AdvancedMovingExampleD"), new NamePairings("AdvancedSwimmingExampleL", "AdvancedSwimmingExampleR", "AdvancedSwimmingExampleU", "AdvancedSwimmingExampleD"), new NamePairings("AdvancedSittingExampleL", "AdvancedSittingExampleR", "AdvancedSittingExampleU", "AdvancedSittingExampleD"), new Vector2(16, 16), false, Genders.female, new List<Seasons>()
|
||||
{
|
||||
Seasons.spring,
|
||||
Seasons.summer
|
||||
}, PartType.hair
|
||||
);
|
||||
info2.writeToJson(filePath2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to splice the mod directory to get relative paths.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static string getShortenedDirectory(string path)
|
||||
{
|
||||
string lol = (string)path.Clone();
|
||||
string[] spliter = lol.Split(new string[] { ModHelper.DirectoryPath },StringSplitOptions.None);
|
||||
return spliter[1];
|
||||
try
|
||||
{
|
||||
return spliter[1];
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
err.ToString();
|
||||
return spliter[0];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to finish cleaning up absolute asset paths into a shortened relative path.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static string getRelativeDirectory(string path)
|
||||
{
|
||||
string s = getShortenedDirectory(path);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -22,6 +23,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
@ -30,6 +32,43 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
|
||||
<OutputPath>bin\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
|
||||
<OutputPath>bin\x86\x86\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
@ -43,32 +82,52 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Framework\Enums\AnimationType.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetInfo.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetManager.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetSheet.cs" />
|
||||
<Compile Include="Framework\Enums\PartType.cs" />
|
||||
<Compile Include="Framework\Enums\Seasons.cs" />
|
||||
<Compile Include="Framework\Graphics\DirectionalTexture.cs" />
|
||||
<Compile Include="Framework\Graphics\ExtendedAssetInfo.cs" />
|
||||
<Compile Include="Framework\Enums\Genders.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetPool.cs" />
|
||||
<Compile Include="Framework\Graphics\TextureGroups\TextureGroup.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\AnimatedSpriteCollection.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\AnimatedSpriteExtended.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\CharacterAnimationBases\StandardCharacterAnimation.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\CharacterAnimationBases\CharacterAnimationBase.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\Direction.cs" />
|
||||
<Compile Include="Framework\Enums\Direction.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\ColorCollections\StandardColorCollection.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\ModularRenderers\AnimationKeys.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\ModularRenderers\BasicRenderer.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\Portrait.cs" />
|
||||
<Compile Include="Framework\ModularNPCS\Sprite.cs" />
|
||||
<Compile Include="Framework\NPCNames.cs" />
|
||||
<Compile Include="Framework\NPCS\ExtendedNPC.cs" />
|
||||
<Compile Include="Framework\NPCS\MerchantNPC.cs" />
|
||||
<Compile Include="Framework\Utilities\NPCTracker.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\StardustCore\StardustCore.csproj">
|
||||
<Project>{0756D36A-95C8-480D-8EA6-4584C03010C6}</Project>
|
||||
<Name>StardustCore</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// A enum of different types of animations supported by the framework.
|
||||
/// </summary>
|
||||
public enum AnimationType
|
||||
{
|
||||
/// <summary>
|
||||
/// A key to be used whenever an npc uses a standing animation.
|
||||
/// </summary>
|
||||
standing,
|
||||
/// <summary>
|
||||
/// A key to be used wheneven an npc uses a walking/moving animation.
|
||||
/// </summary>
|
||||
walking,
|
||||
/// <summary>
|
||||
/// A key to be used whenever an npc uses a swimming animation.
|
||||
/// </summary>
|
||||
swimming,
|
||||
/// <summary>
|
||||
/// A key to be used whenever an npc uses a sitting animation.
|
||||
/// </summary>
|
||||
sitting
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// An enum to be used to signify directions.
|
||||
/// The enum order corresponds to the same order Stardew Valley uses for directions where
|
||||
/// Up=0
|
||||
/// Right=1
|
||||
/// Down=2
|
||||
/// Left=3
|
||||
/// </summary>
|
||||
public enum Direction
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to signify something to face/move up.
|
||||
/// </summary>
|
||||
up,
|
||||
/// <summary>
|
||||
/// Used to signify something to face/move right.
|
||||
/// </summary>
|
||||
right,
|
||||
/// <summary>
|
||||
/// Used to signify something to face/move down.
|
||||
/// </summary>
|
||||
down,
|
||||
/// <summary>
|
||||
/// Used to signify something to face/move left.
|
||||
/// </summary>
|
||||
left
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Gender enum to signify the different genders for npcs.
|
||||
/// Do what you want with this. For code simplicity anything that is non-binary is specified under other.
|
||||
/// </summary>
|
||||
public enum Genders
|
||||
{
|
||||
/// <summary>
|
||||
/// Used for npcs to signify that they are the male gender.
|
||||
/// </summary>
|
||||
male,
|
||||
/// <summary>
|
||||
/// Used for npcs to signify that they are the female gender.
|
||||
/// </summary>
|
||||
female,
|
||||
/// <summary>
|
||||
/// Used for npcs to signify that they are a non gender binary gender.
|
||||
/// </summary>
|
||||
other
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// An enum used to signify the different asset types that can be used for npcs.
|
||||
/// </summary>
|
||||
public enum PartType
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the body part category. Without this the npc is basically a ghost.
|
||||
/// </summary>
|
||||
body,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the eyes part category. The window to the soul.
|
||||
/// </summary>
|
||||
eyes,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the hair part category. Volume looks good in 2D.
|
||||
/// </summary>
|
||||
hair,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the shirt part category.No shirt = no service.
|
||||
/// </summary>
|
||||
shirt,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the pants/bottoms part category. Also known as bottoms, skirts, shorts, etc.
|
||||
/// </summary>
|
||||
pants,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the shoes part category. Lace up those kicks.
|
||||
/// </summary>
|
||||
shoes,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the accessort part category. Got to wear that bling.
|
||||
/// </summary>
|
||||
accessory,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the other part category. Who knows what this really is...
|
||||
/// </summary>
|
||||
other,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the swimsuit part category. Got to be decent when taking a dip.
|
||||
/// </summary>
|
||||
swimsuit,
|
||||
/// <summary>
|
||||
/// Used to signify that the asset is of the amrs part category. Arms need to be rendered above a shirt on npcs otherwise they get covered.
|
||||
/// </summary>
|
||||
arms
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace CustomNPCFramework.Framework.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// An enum signifying the different seasons that are supported when chosing npc graphics.
|
||||
/// </summary>
|
||||
public enum Seasons
|
||||
{
|
||||
/// <summary>
|
||||
/// The spring season. This ensures that a corresponding graphic with this enum in it's seasons list can be chosen in the spring time.
|
||||
/// Also used for functionality to check seasons.
|
||||
/// </summary>
|
||||
spring,
|
||||
/// <summary>
|
||||
/// The summer season. This ensures that a corresponding graphic with this enum in it's seasons list can be chosen in the summer time.
|
||||
/// Also used for functionality to check seasons.
|
||||
/// </summary>
|
||||
summer,
|
||||
/// <summary>
|
||||
/// The fall season. This ensures that a corresponding graphic with this enum in it's seasons list can be chosen in the fall time.
|
||||
/// Also used for functionality to check seasons.
|
||||
/// </summary>
|
||||
fall,
|
||||
/// <summary>
|
||||
/// The winter season. This ensures that a corresponding graphic with this enum in it's seasons list can be chosen in the winter time.
|
||||
/// Also used for functionality to check seasons.
|
||||
/// </summary>
|
||||
winter
|
||||
}
|
||||
}
|
|
@ -7,20 +7,65 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// A class to be used to hold information regarding assets such as the name of the assets and the paths to the images.
|
||||
/// </summary>
|
||||
public class AssetInfo
|
||||
{
|
||||
public string name;
|
||||
public Vector2 assetSize;
|
||||
public bool randomizeUponLoad;
|
||||
/// <summary>
|
||||
/// A constructor use to create asset info which can then be used to create asset sheets.
|
||||
/// The name of the asset to be used in the main asset pool.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the texture sheet. Can be different than the actual file name.</param>
|
||||
/// <param name="assetSize">The size of the individual sprites on the texture sheet. Ex 16x16 pixels.</param>
|
||||
/// <param name="randomizeUponLoad">If true, the index for the asset will be randomized. Good for getting variation from a texture.</param>
|
||||
public AssetInfo(string name, Vector2 assetSize, bool randomizeUponLoad)
|
||||
public string assetName;
|
||||
/// <summary>
|
||||
/// The list of files to be used for the standing animation.
|
||||
/// </summary>
|
||||
public NamePairings standingAssetPaths;
|
||||
/// <summary>
|
||||
/// The list of files to be used for the swimming animation.
|
||||
/// </summary>
|
||||
public NamePairings swimmingAssetPaths;
|
||||
/// <summary>
|
||||
/// The list of files to be used with the moving animation.
|
||||
/// </summary>
|
||||
public NamePairings movingAssetPaths;
|
||||
/// <summary>
|
||||
/// The list of files to be used with the sitting animation.
|
||||
/// </summary>
|
||||
public NamePairings sittingAssetPaths;
|
||||
/// <summary>
|
||||
/// The size of the asset texture. Width and height.
|
||||
/// </summary>
|
||||
public Vector2 assetSize;
|
||||
/// <summary>
|
||||
/// Not really used anymore. More of a legacy feature.
|
||||
/// </summary>
|
||||
public bool randomizeUponLoad;
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor.
|
||||
/// </summary>
|
||||
public AssetInfo()
|
||||
{
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that assigns values to the class.
|
||||
/// </summary>
|
||||
/// <param name="assetName">The name of the asset. This is the name that will be referenced in any asset manager or asset pool.</param>
|
||||
/// <param name="StandingAssetPaths">The name of the files to be used for the standing animation.</param>
|
||||
/// <param name="MovingAssetPaths">The name of the files to be used for the moving animation.</param>
|
||||
/// <param name="SwimmingAssetPaths">The name of the files to be used for the swimming animation.</param>
|
||||
/// <param name="SittingAssetPaths">The name of the files to be used for the sitting animation.</param>
|
||||
/// <param name="assetSize">The size of the asset. Width and height of the texture.</param>
|
||||
/// <param name="randomizeUponLoad">Legacy, not really used anymore.</param>
|
||||
public AssetInfo(string assetName,NamePairings StandingAssetPaths, NamePairings MovingAssetPaths, NamePairings SwimmingAssetPaths, NamePairings SittingAssetPaths, Vector2 assetSize, bool randomizeUponLoad)
|
||||
{
|
||||
this.assetName = assetName;
|
||||
this.sittingAssetPaths = SittingAssetPaths;
|
||||
this.standingAssetPaths = StandingAssetPaths;
|
||||
this.movingAssetPaths = MovingAssetPaths;
|
||||
this.swimmingAssetPaths = SwimmingAssetPaths;
|
||||
this.assetSize = assetSize;
|
||||
this.randomizeUponLoad = randomizeUponLoad;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -7,9 +8,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to hold assets from specified directories.
|
||||
/// </summary>
|
||||
public class AssetManager
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of all of the assets held by this asset manager.
|
||||
/// </summary>
|
||||
public List<AssetSheet> assets;
|
||||
/// <summary>
|
||||
/// A list of all of the directories managed by this asset manager.
|
||||
/// </summary>
|
||||
public Dictionary<string,string> paths;
|
||||
|
||||
/// <summary>
|
||||
|
@ -22,19 +32,64 @@ namespace CustomNPCFramework.Framework.Graphics
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default loading function from paths.
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="assetsPathsToLoadFrom">A list of all directories to be managed by the asset manager. Name, path is the key pair value.</param>
|
||||
public AssetManager(Dictionary<string,string> assetsPathsToLoadFrom)
|
||||
{
|
||||
this.assets = new List<AssetSheet>();
|
||||
this.paths = assetsPathsToLoadFrom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default loading function from hard coded paths.
|
||||
/// </summary>
|
||||
public void loadAssets()
|
||||
{
|
||||
foreach(var path in this.paths)
|
||||
{
|
||||
string[] files= Directory.GetFiles(path.Value, "*.json");
|
||||
foreach(var file in files)
|
||||
{
|
||||
AssetInfo info = AssetInfo.readFromJson(file);
|
||||
AssetSheet sheet = new AssetSheet(info,path.Value);
|
||||
this.assets.Add(sheet);
|
||||
}
|
||||
ProcessDirectory(path.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Taken from Microsoft c# documented webpages.
|
||||
/// Process all .json files in the given directory. If there are more nested directories, keep digging to find more .json files. Also allows us to specify a broader directory like Content/Grahphics/ModularNPC/Hair to have multiple hair styles.
|
||||
/// </summary>
|
||||
/// <param name="targetDirectory"></param>
|
||||
private void ProcessDirectory(string targetDirectory)
|
||||
{
|
||||
// Process the list of files found in the directory.
|
||||
string[] files = Directory.GetFiles(targetDirectory, "*.json");
|
||||
foreach (var file in files)
|
||||
{
|
||||
ProcessFile(file,targetDirectory);
|
||||
}
|
||||
// Recurse into subdirectories of this directory.
|
||||
string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory);
|
||||
foreach (string subdirectory in subdirectoryEntries)
|
||||
ProcessDirectory(subdirectory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Actually load in the asset information.
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <param name="path"></param>
|
||||
private void ProcessFile(string file,string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
ExtendedAssetInfo info = ExtendedAssetInfo.readFromJson(file);
|
||||
AssetSheet sheet = new AssetSheet(info, path);
|
||||
addAsset(sheet);
|
||||
Class1.ModMonitor.Log("Loaded in new modular asset: " + info.assetName + " asset type: " + info.type);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
AssetInfo info = AssetInfo.readFromJson(file);
|
||||
AssetSheet sheet = new AssetSheet(info, path);
|
||||
addAsset(sheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +111,7 @@ namespace CustomNPCFramework.Framework.Graphics
|
|||
{
|
||||
foreach(var v in assets)
|
||||
{
|
||||
if (v.assetInfo.name == s) return v;
|
||||
if (v.assetInfo.assetName == s) return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -94,5 +149,138 @@ namespace CustomNPCFramework.Framework.Graphics
|
|||
Directory.CreateDirectory(Path.Combine(Class1.ModHelper.DirectoryPath,v.Value));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of assets from this manager that match the given critera.
|
||||
/// </summary>
|
||||
/// <param name="gender">The criteria we are searching for this time is gender.</param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfAssetsThatMatchThisCriteria(Genders gender)
|
||||
{
|
||||
List<AssetSheet> aSheet = new List<AssetSheet>();
|
||||
foreach(var v in this.assets)
|
||||
{
|
||||
if(v.assetInfo is ExtendedAssetInfo)
|
||||
{
|
||||
if ((v.assetInfo as ExtendedAssetInfo).gender == gender) aSheet.Add(v);
|
||||
}
|
||||
}
|
||||
return aSheet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of all the assets of this kind of part.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of part to return a list of from this asset manager.</param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfAssetsThatMatchThisCriteria(PartType type)
|
||||
{
|
||||
List<AssetSheet> aSheet = new List<AssetSheet>();
|
||||
foreach (var v in this.assets)
|
||||
{
|
||||
if (v.assetInfo is ExtendedAssetInfo)
|
||||
{
|
||||
if ((v.assetInfo as ExtendedAssetInfo).type == type) aSheet.Add(v);
|
||||
}
|
||||
}
|
||||
return aSheet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of assets that match the critera.
|
||||
/// </summary>
|
||||
/// <param name="gender">The gender criteria for this asset, such as if this part belongs to either a female or male character.</param>
|
||||
/// <param name="type">The type of asset to return. Hair eyes, shoes, etc.</param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfAssetsThatMatchThisCriteria(Genders gender,PartType type)
|
||||
{
|
||||
List<AssetSheet> aSheet = new List<AssetSheet>();
|
||||
foreach (var v in this.assets)
|
||||
{
|
||||
if (v.assetInfo is ExtendedAssetInfo)
|
||||
{
|
||||
if ((v.assetInfo as ExtendedAssetInfo).type == type && (v.assetInfo as ExtendedAssetInfo).gender == gender) aSheet.Add(v);
|
||||
}
|
||||
}
|
||||
return aSheet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of assets from this manager that match the given critera.
|
||||
/// </summary>
|
||||
/// <param name="gender">The criteria we are searching for this time is gender.</param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfAssetsThatMatchThisCriteria(Seasons season)
|
||||
{
|
||||
List<AssetSheet> aSheet = new List<AssetSheet>();
|
||||
foreach (var v in this.assets)
|
||||
{
|
||||
if (v.assetInfo is ExtendedAssetInfo)
|
||||
{
|
||||
foreach (var sea in (v.assetInfo as ExtendedAssetInfo).seasons) {
|
||||
if (sea == season) aSheet.Add(v);
|
||||
break; //Only need to find first validation that this is a valid asset.
|
||||
}
|
||||
}
|
||||
}
|
||||
return aSheet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of assets that match this criteria of gender and seasons.
|
||||
/// </summary>
|
||||
/// <param name="gender"></param>
|
||||
/// <param name="season"></param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfAssetsThatMatchThisCriteria(Genders gender,Seasons season)
|
||||
{
|
||||
List<AssetSheet> aSheet = new List<AssetSheet>();
|
||||
foreach (var v in this.assets)
|
||||
{
|
||||
if (v.assetInfo is ExtendedAssetInfo)
|
||||
{
|
||||
foreach (var sea in (v.assetInfo as ExtendedAssetInfo).seasons)
|
||||
{
|
||||
if (sea == season && (v.assetInfo as ExtendedAssetInfo).gender==gender) aSheet.Add(v);
|
||||
break; //Only need to find first validation that this is a valid asset.
|
||||
}
|
||||
}
|
||||
}
|
||||
return aSheet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of asssets that match certain critera.
|
||||
/// </summary>
|
||||
/// <param name="gender">The gengder certain assets belong to, such as male or female.</param>
|
||||
/// <param name="season">The season that an asset can be displayed in. Good for seasonal assets.</param>
|
||||
/// <param name="type">The type of part to return a list of such as hair, eyes, or pants.</param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfAssetsThatMatchThisCriteria(Genders gender, Seasons season, PartType type)
|
||||
{
|
||||
List<AssetSheet> aSheet = new List<AssetSheet>();
|
||||
foreach (var v in this.assets)
|
||||
{
|
||||
if (v.assetInfo is ExtendedAssetInfo)
|
||||
{
|
||||
foreach (var sea in (v.assetInfo as ExtendedAssetInfo).seasons)
|
||||
{
|
||||
//Class1.ModMonitor.Log("Searching: seasons");
|
||||
if (sea == season && (v.assetInfo as ExtendedAssetInfo).gender == gender && (v.assetInfo as ExtendedAssetInfo).type == type)
|
||||
{
|
||||
aSheet.Add(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Class1.ModMonitor.Log("Not what I was looking for.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Class1.ModMonitor.Log("ok it's over: "+aSheet.Count.ToString());
|
||||
return aSheet;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,432 @@
|
|||
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ColorCollections;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Used to hold a collection of strings.
|
||||
/// </summary>
|
||||
public class NamePairings
|
||||
{
|
||||
public string leftString;
|
||||
public string rightString;
|
||||
public string upString;
|
||||
public string downString;
|
||||
public NamePairings(string LeftString,string RightString, string UpString, string DownString)
|
||||
{
|
||||
this.leftString = LeftString;
|
||||
this.rightString = RightString;
|
||||
this.upString = UpString;
|
||||
this.downString = DownString;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to contain all of the asset managers.
|
||||
/// </summary>
|
||||
public class AssetPool
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary holding all of the asset managers. (Name, AssetManager)
|
||||
/// </summary>
|
||||
public Dictionary<string, AssetManager> assetPool;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public AssetPool()
|
||||
{
|
||||
this.assetPool = new Dictionary<string, AssetManager>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an asset manager to the asset pool.
|
||||
/// </summary>
|
||||
/// <param name="pair">A key value pair with the convention being (Manager Name, Asset Manager)</param>
|
||||
public void addAssetManager(KeyValuePair<string, AssetManager> pair)
|
||||
{
|
||||
this.assetPool.Add(pair.Key, pair.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an asset manager to the asset pool.
|
||||
/// </summary>
|
||||
/// <param name="assetManagerName">The name of the asset manager to be added.</param>
|
||||
/// <param name="assetManager">The asset manager object to be added to the asset pool.</param>
|
||||
public void addAssetManager(string assetManagerName, AssetManager assetManager)
|
||||
{
|
||||
this.assetPool.Add(assetManagerName, assetManager);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an asset manager from the asset pool from a name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the asset manager to return.</param>
|
||||
/// <returns></returns>
|
||||
public AssetManager getAssetManager(string name)
|
||||
{
|
||||
assetPool.TryGetValue(name, out AssetManager asset);
|
||||
return asset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an asset manager from the asset pool.
|
||||
/// </summary>
|
||||
/// <param name="key">The name of the asset manager to remove.</param>
|
||||
public void removeAssetManager(string key)
|
||||
{
|
||||
assetPool.Remove(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Go through all of the asset managers and load assets according to their respective paths.
|
||||
/// </summary>
|
||||
public void loadAllAssets()
|
||||
{
|
||||
foreach (KeyValuePair<string, AssetManager> assetManager in this.assetPool)
|
||||
{
|
||||
assetManager.Value.loadAssets();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an extended animated sprite object given the asset name in the asset manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public AnimatedSpriteExtended getAnimatedSpriteFromAsset(string name)
|
||||
{
|
||||
assetPool.TryGetValue(name, out AssetManager asset);
|
||||
var assetSheet = asset.getAssetByName(name);
|
||||
return new AnimatedSpriteExtended(assetSheet.path.Clone().ToString(),assetSheet.index, (int)assetSheet.assetInfo.assetSize.X, (int)assetSheet.assetInfo.assetSize.Y);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generates a new AnimatedSpriteCollection object from the data held in an asset sheet.
|
||||
/// </summary>
|
||||
/// <param name="assetSheet">An asset sheet that holds the data for textures.</param>
|
||||
/// <param name="type">The type of asset to get from the sheet. Hair, eyes, shoes, etc.</param>
|
||||
/// <returns></returns>
|
||||
public AnimatedSpriteCollection getSpriteCollectionFromSheet(AssetSheet assetSheet, AnimationType type)
|
||||
{
|
||||
var left = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.left, type),assetSheet);
|
||||
var right = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.right, type), assetSheet);
|
||||
var up = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.up, type), assetSheet);
|
||||
var down = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.down, type), assetSheet);
|
||||
return new AnimatedSpriteCollection(left, right, up, down, Direction.down);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets an animated sprite collection (ie a hair style facing all four directions) from a list of asset names.
|
||||
/// </summary>
|
||||
/// <param name="left">The name of the asset for the left facing sprite.</param>
|
||||
/// <param name="right">The name of the asset for the right facing sprite.</param>
|
||||
/// <param name="up">The name of the asset for the up facing sprite.</param>
|
||||
/// <param name="down">The name of the asset for the down facing sprite.</param>
|
||||
/// <param name="startingDirection"></param>
|
||||
/// <returns></returns>
|
||||
public AnimatedSpriteCollection getAnimatedSpriteCollectionFromAssets(string left, string right, string up, string down, Direction startingDirection = Direction.down)
|
||||
{
|
||||
var Left = getAnimatedSpriteFromAsset(left);
|
||||
var Right = getAnimatedSpriteFromAsset(right);
|
||||
var Up = getAnimatedSpriteFromAsset(up);
|
||||
var Down = getAnimatedSpriteFromAsset(down);
|
||||
return new AnimatedSpriteCollection(Left, Right, Up, Down, startingDirection);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an AnimatedSpriteCollection from a name pairing.
|
||||
/// </summary>
|
||||
/// <param name="pair">A collection of strings that hold information on directional textures.</param>
|
||||
/// <param name="startingDirection">The direction in which the sprite should face.</param>
|
||||
/// <returns></returns>
|
||||
public AnimatedSpriteCollection getAnimatedSpriteCollectionFromAssets(NamePairings pair, Direction startingDirection = Direction.down)
|
||||
{
|
||||
return getAnimatedSpriteCollectionFromAssets(pair.leftString, pair.rightString, pair.upString, pair.downString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a collection of sprites to generate a collective animated sprite.
|
||||
/// </summary>
|
||||
/// <param name="BodySprites">The collection of sprites to be used for the boyd of the npc.</param>
|
||||
/// <param name="EyeSprites">The collection of sprites to be used for the eye of the npc.</param>
|
||||
/// <param name="HairSprites">The collection of sprites to be used for the hair of the npc.</param>
|
||||
/// <param name="ShirtsSprites">The collection of sprites to be used for the shirts of the npc.</param>
|
||||
/// <param name="PantsSprites">The collection of sprites to be used for the pants of the npc.</param>
|
||||
/// <param name="ShoesSprites">The collection of sprites to be used for the shoes of the npc.</param>
|
||||
/// <param name="AccessoriesSprites">The collection of sprites to be used for the accessories of the npc.</param>
|
||||
/// <param name="DrawColors">The collection of collors to be used for chaing the color of an individual asset.</param>
|
||||
/// <returns></returns>
|
||||
public StandardCharacterAnimation GetStandardCharacterAnimation(NamePairings BodySprites, NamePairings EyeSprites, NamePairings HairSprites, NamePairings ShirtsSprites, NamePairings PantsSprites, NamePairings ShoesSprites,List<NamePairings> AccessoriesSprites,StandardColorCollection DrawColors=null)
|
||||
{
|
||||
var body = getAnimatedSpriteCollectionFromAssets(BodySprites);
|
||||
var eyes = getAnimatedSpriteCollectionFromAssets(EyeSprites);
|
||||
var hair = getAnimatedSpriteCollectionFromAssets(HairSprites);
|
||||
var shirts = getAnimatedSpriteCollectionFromAssets(ShirtsSprites);
|
||||
var pants = getAnimatedSpriteCollectionFromAssets(PantsSprites);
|
||||
var shoes = getAnimatedSpriteCollectionFromAssets(ShoesSprites);
|
||||
List<AnimatedSpriteCollection> accessories = new List<AnimatedSpriteCollection>();
|
||||
foreach(var v in AccessoriesSprites)
|
||||
{
|
||||
accessories.Add(getAnimatedSpriteCollectionFromAssets(v));
|
||||
}
|
||||
if (DrawColors == null) DrawColors = new StandardColorCollection();
|
||||
return new StandardCharacterAnimation(body,eyes,hair,shirts,pants,shoes,accessories,DrawColors);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of parts that can apply for this criteria.
|
||||
/// </summary>
|
||||
/// <param name="assetManagerName">The name of the asset manager.</param>
|
||||
/// <param name="gender">The gender critera.</param>
|
||||
/// <param name="season">The season critera.</param>
|
||||
/// <param name="type">The part type critera.</param>
|
||||
/// <returns></returns>
|
||||
public List<AssetSheet> getListOfApplicableBodyParts(string assetManagerName,Genders gender, Seasons season, PartType type)
|
||||
{
|
||||
var parts = this.getAssetManager(assetManagerName).getListOfAssetsThatMatchThisCriteria(gender, season, type);
|
||||
return parts;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate a basic npc based off of all all of the NPC data here.
|
||||
/// </summary>
|
||||
/// <param name="gender"></param>
|
||||
/// <param name="minNumOfAccessories"></param>
|
||||
/// <param name="maxNumOfAccessories"></param>
|
||||
public ExtendedNPC generateNPC(Genders gender, int minNumOfAccessories, int maxNumOfAccessories ,StandardColorCollection DrawColors=null)
|
||||
{
|
||||
Seasons myseason=Seasons.spring;
|
||||
|
||||
if (Game1.currentSeason == "spring") myseason = Seasons.spring;
|
||||
if (Game1.currentSeason == "summer") myseason = Seasons.summer;
|
||||
if (Game1.currentSeason == "fall") myseason = Seasons.fall;
|
||||
if (Game1.currentSeason == "winter") myseason = Seasons.winter;
|
||||
|
||||
List<AssetSheet> bodyList = new List<AssetSheet>();
|
||||
List<AssetSheet> eyesList = new List<AssetSheet>();
|
||||
List<AssetSheet> hairList = new List<AssetSheet>();
|
||||
List<AssetSheet> shirtList = new List<AssetSheet>();
|
||||
List<AssetSheet> shoesList = new List<AssetSheet>();
|
||||
List<AssetSheet> pantsList = new List<AssetSheet>();
|
||||
List<AssetSheet> accessoryList = new List<AssetSheet>();
|
||||
|
||||
//Get all applicable parts from this current asset manager
|
||||
foreach (var assetManager in this.assetPool)
|
||||
{
|
||||
var body = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.body);
|
||||
foreach (var piece in body) bodyList.Add(piece);
|
||||
|
||||
var eyes = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.eyes);
|
||||
foreach (var piece in eyes) eyesList.Add(piece);
|
||||
|
||||
var hair = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.hair);
|
||||
foreach (var piece in hair) hairList.Add(piece);
|
||||
|
||||
var shirt = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.shirt);
|
||||
foreach (var piece in shirt) shirtList.Add(piece);
|
||||
|
||||
var pants = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.pants);
|
||||
foreach (var piece in pants) pantsList.Add(piece);
|
||||
|
||||
var shoes = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.shoes);
|
||||
foreach (var piece in shoes) shoesList.Add(piece);
|
||||
|
||||
var accessory = getListOfApplicableBodyParts(assetManager.Key, gender, myseason, PartType.accessory);
|
||||
foreach (var piece in accessory) accessoryList.Add(piece);
|
||||
}
|
||||
|
||||
|
||||
Random r = new Random(System.DateTime.Now.Millisecond);
|
||||
int amount = 0;
|
||||
|
||||
amount = r.Next(minNumOfAccessories,maxNumOfAccessories + 1); //Necessary since r.next returns a num between min and (max-1)
|
||||
|
||||
int bodyIndex = 0;
|
||||
int eyesIndex = 0;
|
||||
int hairIndex = 0;
|
||||
int shirtIndex = 0;
|
||||
int pantsIndex = 0;
|
||||
int shoesIndex = 0;
|
||||
|
||||
if (bodyList.Count != 0) {
|
||||
bodyIndex = r.Next(0, bodyList.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Class1.ModMonitor.Log("Error: Not enough body templates to generate an npc. Aborting", StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (eyesList.Count != 0) {
|
||||
eyesIndex = r.Next(0, eyesList.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Class1.ModMonitor.Log("Error: Not enough eyes templates to generate an npc. Aborting", StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (hairList.Count != 0) {
|
||||
hairIndex = r.Next(0, hairList.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Class1.ModMonitor.Log("Error: Not enough hair templates to generate an npc. Aborting", StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (shirtList.Count != 0) {
|
||||
shirtIndex = r.Next(0, shirtList.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Class1.ModMonitor.Log("Error: Not enough shirt templates to generate an npc. Aborting", StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pantsList.Count != 0) {
|
||||
pantsIndex = r.Next(0, pantsList.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Class1.ModMonitor.Log("Error: Not enough pants templates to generate an npc. Aborting", StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (shoesList.Count != 0) {
|
||||
shoesIndex = r.Next(0, shoesList.Count - 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Class1.ModMonitor.Log("Error: Not enough shoes templates to generate an npc. Aborting", StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
List<int> accIntList = new List<int>();
|
||||
if (accessoryList.Count != 0)
|
||||
{
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
int acc = r.Next(0, accessoryList.Count - 1);
|
||||
accIntList.Add(acc);
|
||||
}
|
||||
}
|
||||
|
||||
//Get a single sheet to pull from.
|
||||
AssetSheet bodySheet;
|
||||
AssetSheet eyesSheet;
|
||||
AssetSheet hairSheet;
|
||||
AssetSheet shirtSheet;
|
||||
AssetSheet shoesSheet;
|
||||
AssetSheet pantsSheet;
|
||||
|
||||
bodySheet = bodyList.ElementAt(bodyIndex);
|
||||
eyesSheet = eyesList.ElementAt(eyesIndex);
|
||||
hairSheet = hairList.ElementAt(hairIndex);
|
||||
shirtSheet = shirtList.ElementAt(shirtIndex);
|
||||
pantsSheet = pantsList.ElementAt(pantsIndex);
|
||||
shoesSheet = shoesList.ElementAt(shoesIndex);
|
||||
|
||||
|
||||
List<AssetSheet> accessorySheet = new List<AssetSheet>();
|
||||
|
||||
foreach (var v in accIntList)
|
||||
{
|
||||
accessorySheet.Add(accessoryList.ElementAt(v));
|
||||
}
|
||||
if (DrawColors == null) DrawColors = new StandardColorCollection();
|
||||
var render = generateBasicRenderer(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet,DrawColors);
|
||||
ExtendedNPC npc = new ExtendedNPC(new Sprite(getDefaultSpriteImage(bodySheet)), render, new Microsoft.Xna.Framework.Vector2(0,0) * Game1.tileSize, 2, NPCNames.getRandomNPCName(gender));
|
||||
return npc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a character renderer (a collection of textures) from a bunch of different asset sheets.
|
||||
/// </summary>
|
||||
/// <param name="bodySheet">The textures for the npc's body.</param>
|
||||
/// <param name="eyesSheet">The textures for the npc's eyes.</param>
|
||||
/// <param name="hairSheet">The textures for the npc's hair.</param>
|
||||
/// <param name="shirtSheet">The textures for the npc's shirt.</param>
|
||||
/// <param name="pantsSheet">The textures for the npc's pants.</param>
|
||||
/// <param name="shoesSheet">The textures for the npc's shoes.</param>
|
||||
/// <param name="accessorySheet">The textures for the npc's accessories.</param>
|
||||
/// <param name="DrawColors">The colors for the npc's different assets.</param>
|
||||
/// <returns></returns>
|
||||
public virtual BasicRenderer generateBasicRenderer(AssetSheet bodySheet, AssetSheet eyesSheet, AssetSheet hairSheet, AssetSheet shirtSheet, AssetSheet pantsSheet, AssetSheet shoesSheet, List<AssetSheet> accessorySheet, StandardColorCollection DrawColors=null)
|
||||
{
|
||||
if (DrawColors == null) DrawColors = new StandardColorCollection();
|
||||
//Get all of the appropriate animations.
|
||||
AnimationType type = AnimationType.standing;
|
||||
var standingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type,DrawColors);
|
||||
type = AnimationType.walking;
|
||||
var movingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type,DrawColors);
|
||||
type = AnimationType.swimming;
|
||||
var swimmingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type,DrawColors);
|
||||
|
||||
BasicRenderer render = new BasicRenderer(standingAnimation, movingAnimation, swimmingAnimation);
|
||||
return render;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a Standard Character Animation from some asset sheets.
|
||||
/// (collection of textures to animations)
|
||||
/// </summary>
|
||||
/// <param name="body">The textures for the npc's body.</param>
|
||||
/// <param name="eyes">The textures for the npc's eyes.</param>
|
||||
/// <param name="hair">The textures for the npc's hair.</param>
|
||||
/// <param name="shirt">The textures for the npc's shirt.</param>
|
||||
/// <param name="pants">The textures for the npc's pants.</param>
|
||||
/// <param name="shoes">The textures for the npc's shoes.</param>
|
||||
/// <param name="accessoryType">The textures for the npc's accessories.</param>
|
||||
/// <param name="DrawColors">The colors for the npc's different assets.</param>
|
||||
/// <returns></returns>
|
||||
public virtual StandardCharacterAnimation generateCharacterAnimation(AssetSheet body, AssetSheet eyes, AssetSheet hair, AssetSheet shirt, AssetSheet pants, AssetSheet shoes,List<AssetSheet> accessories, AnimationType animationType, StandardColorCollection DrawColors=null)
|
||||
{
|
||||
var bodySprite = getSpriteCollectionFromSheet(body, animationType);
|
||||
var eyesSprite = getSpriteCollectionFromSheet(eyes, animationType);
|
||||
var hairSprite = getSpriteCollectionFromSheet(hair, animationType);
|
||||
var shirtSprite = getSpriteCollectionFromSheet(shirt, animationType);
|
||||
var pantsSprite = getSpriteCollectionFromSheet(pants, animationType);
|
||||
var shoesSprite = getSpriteCollectionFromSheet(shoes, animationType);
|
||||
List<AnimatedSpriteCollection> accessoryCollection = new List<AnimatedSpriteCollection>();
|
||||
foreach (var v in accessories)
|
||||
{
|
||||
AnimatedSpriteCollection acc = getSpriteCollectionFromSheet(v, AnimationType.standing);
|
||||
accessoryCollection.Add(acc);
|
||||
}
|
||||
if (DrawColors == null) DrawColors = new StandardColorCollection();
|
||||
StandardCharacterAnimation standingAnimation = new StandardCharacterAnimation(bodySprite, eyesSprite, hairSprite, shirtSprite, pantsSprite, shoesSprite, accessoryCollection,DrawColors);
|
||||
return standingAnimation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string for the standard character sprite to be used from this asset sheet.
|
||||
/// </summary>
|
||||
/// <param name="imageGraphics">The standard asset sheet to be used.</param>
|
||||
/// <returns></returns>
|
||||
public virtual string getDefaultSpriteImage(AssetSheet imageGraphics)
|
||||
{
|
||||
return Class1.getRelativeDirectory(Path.Combine(imageGraphics.path, imageGraphics.assetInfo.standingAssetPaths.downString));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using CustomNPCFramework.Framework.Graphics.TextureGroups;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardustCore.UIUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -14,127 +17,117 @@ namespace CustomNPCFramework.Framework.Graphics
|
|||
/// </summary>
|
||||
public class AssetSheet
|
||||
{
|
||||
public Texture2D texture;
|
||||
/// <summary>
|
||||
/// Used to hold the textures for the AssetSheet.
|
||||
/// </summary>
|
||||
public TextureGroups.TextureGroup textures;
|
||||
|
||||
/// <summary>
|
||||
/// Used to hold the info for the paths to these textures.
|
||||
/// </summary>
|
||||
public AssetInfo assetInfo;
|
||||
|
||||
/// <summary>
|
||||
/// The path to this assetinfo.json file
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
public int index;
|
||||
|
||||
private int widthIndex;
|
||||
private int heightIndex;
|
||||
private int widthIndexMax;
|
||||
private int heightIndexMax;
|
||||
|
||||
/// <summary>
|
||||
/// The soruce rectangle for the current texture to draw.
|
||||
/// </summary>
|
||||
public Rectangle currentAsset;
|
||||
|
||||
public AssetSheet(AssetInfo info,string path)
|
||||
public int index;
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="info">The asset info file to be read in or created. Holds path information.</param>
|
||||
/// <param name="path">The path to the assetinfo file.</param>
|
||||
/// <param name="direction">The direction to set the animation.</param>
|
||||
public AssetSheet(AssetInfo info,string path,Direction direction=Direction.down)
|
||||
{
|
||||
this.assetInfo = info;
|
||||
this.texture = Class1.ModHelper.Content.Load<Texture2D>(Class1.getShortenedDirectory(Path.Combine(path,info.name+".png")).Remove(0,1));
|
||||
this.textures = new TextureGroup(info,path,direction);
|
||||
try
|
||||
{
|
||||
this.path = Class1.getShortenedDirectory(path);
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
this.widthIndexMax = this.texture.Width / (int)this.assetInfo.assetSize.X;
|
||||
this.heightIndexMax = this.texture.Width / (int)this.assetInfo.assetSize.Y;
|
||||
this.index = 0;
|
||||
if (this.assetInfo.randomizeUponLoad == false)
|
||||
{
|
||||
this.widthIndex = 0;
|
||||
this.heightIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
getRandomAssetIndicies();
|
||||
setIndex();
|
||||
}
|
||||
this.currentAsset = new Rectangle(widthIndex * (int)this.assetInfo.assetSize.X, heightIndex * (int)this.assetInfo.assetSize.Y, (int)this.assetInfo.assetSize.X, (int)this.assetInfo.assetSize.Y);
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the path to the current texture.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual KeyValuePair<string, Texture2DExtended> getPathTexturePair()
|
||||
{
|
||||
return new KeyValuePair<string, Texture2DExtended>(this.path, this.textures.currentTexture.currentTexture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the next graphic from the texture.
|
||||
/// </summary>
|
||||
public void getNext()
|
||||
{
|
||||
//If I can still iterate through my list but my width is maxed, increment height.
|
||||
if (this.widthIndex == this.widthIndexMax - 1 && this.heightIndex != this.heightIndexMax)
|
||||
{
|
||||
this.widthIndex -= 0;
|
||||
this.heightIndex++;
|
||||
}
|
||||
//If I reached the end of my image loop to 0;
|
||||
else if (this.heightIndex == this.heightIndexMax && this.widthIndex == this.widthIndexMax - 1)
|
||||
{
|
||||
this.heightIndex = 0;
|
||||
this.widthIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//If I can still iterate through my list do so.
|
||||
widthIndex++;
|
||||
}
|
||||
this.setIndex();
|
||||
this.setAsset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the last graphic from my texture.
|
||||
/// </summary>
|
||||
public void getPrevious()
|
||||
{
|
||||
//If my width index is 0 and my height index isn't decrement my height index and set the width index to the far right.
|
||||
if (this.widthIndex == 0 && this.heightIndex != 0)
|
||||
{
|
||||
this.heightIndex--;
|
||||
this.widthIndex = this.widthIndexMax - 1;
|
||||
}
|
||||
//If both my height and width indicies are 0, loop to the bottom right of the texture.
|
||||
else if (this.widthIndex == 0 && this.heightIndex == 0)
|
||||
{
|
||||
this.widthIndex = this.widthIndexMax - 1;
|
||||
this.heightIndex = this.heightIndexMax - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Just decrement my width index by 1.
|
||||
this.widthIndex--;
|
||||
}
|
||||
this.setIndex();
|
||||
this.setAsset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the current positioning for the rectangle index;
|
||||
/// </summary>
|
||||
private void setAsset()
|
||||
{
|
||||
this.currentAsset.X = widthIndex * (int)this.assetInfo.assetSize.X;
|
||||
this.currentAsset.Y = heightIndex * (int)this.assetInfo.assetSize.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used mainly for display purposes and length purposes.
|
||||
/// </summary>
|
||||
public void setIndex()
|
||||
{
|
||||
this.index = heightIndex * widthIndexMax + widthIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the asset index to a random value.
|
||||
/// </summary>
|
||||
public void getRandomAssetIndicies()
|
||||
{
|
||||
Random r = new Random(DateTime.Now.Millisecond);
|
||||
this.widthIndex = r.Next(0, this.widthIndexMax);
|
||||
this.widthIndex = r.Next(0, this.heightIndexMax);
|
||||
setIndex();
|
||||
setAsset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used just to get a copy of this asset sheet.
|
||||
/// </summary>
|
||||
public void clone()
|
||||
public virtual AssetSheet clone()
|
||||
{
|
||||
var asset = new AssetSheet(this.assetInfo,(string)this.path.Clone());
|
||||
return asset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the textures for this sheet to face left.
|
||||
/// </summary>
|
||||
public virtual void setLeft()
|
||||
{
|
||||
this.textures.setLeft();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the textures for this sheet to face up.
|
||||
/// </summary>
|
||||
public virtual void setUp()
|
||||
{
|
||||
this.textures.setUp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the textures for this sheet to face down.
|
||||
/// </summary>
|
||||
public virtual void setDown()
|
||||
{
|
||||
this.textures.setDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the textures for this sheet to face left.
|
||||
/// </summary>
|
||||
public virtual void setRight()
|
||||
{
|
||||
this.textures.setRight();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current animation texture.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual Texture2DExtended getCurrentSpriteTexture()
|
||||
{
|
||||
return this.textures.currentTexture.currentTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the specific texture depending on the direction and animation type.
|
||||
/// </summary>
|
||||
/// <param name="direction"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Texture2DExtended getTexture(Direction direction,AnimationType type)
|
||||
{
|
||||
return this.textures.getTextureFromAnimation(type).getTextureFromDirection(direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
using CustomNPCFramework.Framework.Enums;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
using StardustCore.UIUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that's used to hold textures for different directions.
|
||||
/// </summary>
|
||||
public class DirectionalTexture
|
||||
{
|
||||
/// <summary>
|
||||
/// The left texture for this group.
|
||||
/// </summary>
|
||||
public Texture2DExtended leftTexture;
|
||||
/// <summary>
|
||||
/// The right texture for this group.
|
||||
/// </summary>
|
||||
public Texture2DExtended rightTexture;
|
||||
|
||||
/// <summary>
|
||||
/// The down textiure for this group.
|
||||
/// </summary>
|
||||
public Texture2DExtended downTexture;
|
||||
/// <summary>
|
||||
/// The up texture for this group.
|
||||
/// </summary>
|
||||
public Texture2DExtended upTexture;
|
||||
|
||||
/// <summary>
|
||||
/// The current texture for this group.
|
||||
/// </summary>
|
||||
public Texture2DExtended currentTexture;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="left">The left texture to use.</param>
|
||||
/// <param name="right">The right texture to use.</param>
|
||||
/// <param name="up">The up texture to use.</param>
|
||||
/// <param name="down">The down texture to use.</param>
|
||||
/// <param name="direction">The direction texture for the sprite to face.</param>
|
||||
public DirectionalTexture(Texture2DExtended left, Texture2DExtended right, Texture2DExtended up, Texture2DExtended down, Direction direction=Direction.down)
|
||||
{
|
||||
this.leftTexture = left;
|
||||
this.rightTexture = right;
|
||||
this.upTexture = up;
|
||||
this.downTexture = down;
|
||||
|
||||
if (direction == Direction.left) this.currentTexture = leftTexture;
|
||||
if (direction == Direction.right) this.currentTexture = rightTexture;
|
||||
if (direction == Direction.up) this.currentTexture = upTexture;
|
||||
if (direction == Direction.down) this.currentTexture = downTexture;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public DirectionalTexture(IModHelper helper ,NamePairings info, string path, Direction direction = Direction.down)
|
||||
{
|
||||
|
||||
new Texture2DExtended(helper, path);
|
||||
|
||||
string leftString= Class1.getShortenedDirectory(Path.Combine(path, info.leftString + ".png")).Remove(0, 1);
|
||||
string rightString = Class1.getShortenedDirectory(Path.Combine(path, info.rightString + ".png")).Remove(0, 1);
|
||||
string upString = Class1.getShortenedDirectory(Path.Combine(path, info.upString + ".png")).Remove(0, 1);
|
||||
string downString = Class1.getShortenedDirectory(Path.Combine(path, info.downString + ".png")).Remove(0, 1);
|
||||
|
||||
|
||||
this.leftTexture = new Texture2DExtended(helper, leftString);
|
||||
this.rightTexture = new Texture2DExtended(helper, rightString);
|
||||
this.upTexture = new Texture2DExtended(helper, upString);
|
||||
this.downTexture = new Texture2DExtended(helper, downString);
|
||||
|
||||
if (direction == Direction.left) this.currentTexture = leftTexture;
|
||||
if (direction == Direction.right) this.currentTexture = rightTexture;
|
||||
if (direction == Direction.up) this.currentTexture = upTexture;
|
||||
if (direction == Direction.down) this.currentTexture = downTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the direction of this current texture to left.
|
||||
/// </summary>
|
||||
public void setLeft()
|
||||
{
|
||||
this.currentTexture = leftTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the direction of this current texture to up.
|
||||
/// </summary>
|
||||
public void setUp()
|
||||
{
|
||||
this.currentTexture = upTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the direction of this current texture to down.
|
||||
/// </summary>
|
||||
public void setDown()
|
||||
{
|
||||
this.currentTexture = downTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the direction of this current texture to right.
|
||||
/// </summary>
|
||||
public void setRight()
|
||||
{
|
||||
this.currentTexture = rightTexture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the texture from this texture group depending on the direction.
|
||||
/// </summary>
|
||||
/// <param name="direction"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Texture2DExtended getTextureFromDirection(Direction direction)
|
||||
{
|
||||
if (direction == Direction.left) return this.leftTexture;
|
||||
if (direction == Direction.right) return this.rightTexture;
|
||||
if (direction == Direction.up) return this.upTexture;
|
||||
if (direction == Direction.down) return this.downTexture;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
using CustomNPCFramework.Framework.Enums;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// An expanded Asset info class that deals with seasons and genders.
|
||||
/// </summary>
|
||||
public class ExtendedAssetInfo :AssetInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The genders this part is associated with. 0=Male, 1=female, 2=other.
|
||||
/// </summary>
|
||||
public Genders gender;
|
||||
/// <summary>
|
||||
/// A list of seasons where this part can be displayed
|
||||
/// </summary>
|
||||
public List<Seasons> seasons=new List<Seasons>();
|
||||
/// <summary>
|
||||
/// The part type to be used for this asset such as hair, eyes, etc.
|
||||
/// </summary>
|
||||
public PartType type;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public ExtendedAssetInfo()
|
||||
{
|
||||
this.seasons = new List<Seasons>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="assetSize"></param>
|
||||
/// <param name="randomizeOnLoad"></param>
|
||||
/// <param name="Gender">The type of gender this asset will be associated with.</param>
|
||||
/// <param name="Season">The type of season this asset will be associated with.</param>
|
||||
public ExtendedAssetInfo(string name, NamePairings StandingAssetPaths, NamePairings MovingAssetPaths, NamePairings SwimmingAssetPaths, NamePairings SittingAssetPaths, Vector2 assetSize, bool randomizeOnLoad, Genders Gender, List<Seasons> Season, PartType Type): base(name,StandingAssetPaths,MovingAssetPaths,SwimmingAssetPaths,SittingAssetPaths, assetSize, randomizeOnLoad)
|
||||
{
|
||||
this.gender = Gender;
|
||||
this.seasons = Season;
|
||||
if (this.seasons == null) this.seasons = new List<Seasons>();
|
||||
this.type = Type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save the json to a certain location.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public new void writeToJson(string path)
|
||||
{
|
||||
Class1.ModHelper.WriteJsonFile<ExtendedAssetInfo>(path, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the json from a certain location.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public new static ExtendedAssetInfo readFromJson(string path)
|
||||
{
|
||||
return Class1.ModHelper.ReadJsonFile<ExtendedAssetInfo>(path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
using CustomNPCFramework.Framework.Enums;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Graphics.TextureGroups
|
||||
{
|
||||
/// <summary>
|
||||
/// A group of a textures used to hold all of the textures associated with a single asset such as a hair style or a shirt.
|
||||
/// </summary>
|
||||
public class TextureGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// The directional (Left, Right, Up, Down) textures to be used when the NPC is standing.
|
||||
/// </summary>
|
||||
public DirectionalTexture standingTexture;
|
||||
/// <summary>
|
||||
/// The directional (Left, Right, Up, Down) textures to be used when the NPC is sitting.
|
||||
/// </summary>
|
||||
public DirectionalTexture sittingTexture;
|
||||
/// <summary>
|
||||
/// The directional (Left, Right, Up, Down) textures to be used when the NPC is swimming.
|
||||
/// </summary>
|
||||
public DirectionalTexture swimmingTexture;
|
||||
/// <summary>
|
||||
/// The directional (Left, Right, Up, Down) textures to be used when the NPC is moving.
|
||||
/// </summary>
|
||||
public DirectionalTexture movingTexture;
|
||||
|
||||
/// <summary>
|
||||
/// The current directional texture to be used by the npc. Can be things such as the standing, swimming, moving, or sitting texture.
|
||||
/// </summary>
|
||||
public DirectionalTexture currentTexture;
|
||||
|
||||
/// <summary>
|
||||
/// Asset info loaded in from the corresponding .json file.
|
||||
/// </summary>
|
||||
private AssetInfo info;
|
||||
/// <summary>
|
||||
/// The path to the .json file.
|
||||
/// </summary>
|
||||
private string path;
|
||||
/// <summary>
|
||||
/// The current direction of the texture group. See Direction.cs
|
||||
/// </summary>
|
||||
private Direction dir;
|
||||
/// <summary>
|
||||
/// The type of asset this is. Body, hair, eyes, shirt,etc...
|
||||
/// </summary>
|
||||
private AnimationType type;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="info">The asset info file to be stored with this texture group.</param>
|
||||
/// <param name="path">Use to locate the files on disk.</param>
|
||||
/// <param name="direction">Used to determine the current direction/animation to load</param>
|
||||
/// <param name="animationType">The type of asset this is. Eyes, Hair, Shirts, etc</param>
|
||||
public TextureGroup(AssetInfo info, string path,Direction direction ,AnimationType animationType=AnimationType.standing)
|
||||
{
|
||||
this.standingTexture = new DirectionalTexture(Class1.ModHelper,info.standingAssetPaths, path, direction);
|
||||
this.sittingTexture = new DirectionalTexture(Class1.ModHelper, info.sittingAssetPaths, path, direction);
|
||||
this.swimmingTexture = new DirectionalTexture(Class1.ModHelper, info.swimmingAssetPaths, path, direction);
|
||||
this.movingTexture = new DirectionalTexture(Class1.ModHelper,info.movingAssetPaths, path, direction);
|
||||
|
||||
this.info = info;
|
||||
this.path = path;
|
||||
this.dir = direction;
|
||||
this.type = animationType;
|
||||
|
||||
if (animationType == AnimationType.standing) this.currentTexture = standingTexture;
|
||||
if (animationType == AnimationType.sitting) this.currentTexture = sittingTexture;
|
||||
if (animationType == AnimationType.swimming) this.currentTexture = swimmingTexture;
|
||||
if (animationType == AnimationType.walking) this.currentTexture = movingTexture;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a clone of this texture group.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public TextureGroup clone()
|
||||
{
|
||||
return new TextureGroup(this.info, this.path, this.dir, this.type);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets all of the different animations to use their left facing sprites.
|
||||
/// </summary>
|
||||
public virtual void setLeft()
|
||||
{
|
||||
this.movingTexture.setLeft();
|
||||
this.sittingTexture.setLeft();
|
||||
this.standingTexture.setLeft();
|
||||
this.swimmingTexture.setLeft();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets all of the different animations to use their up facing sprites.
|
||||
/// </summary>
|
||||
public virtual void setUp()
|
||||
{
|
||||
this.movingTexture.setUp();
|
||||
this.sittingTexture.setUp();
|
||||
this.standingTexture.setUp();
|
||||
this.swimmingTexture.setUp();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets all of the different animations to use their down facing sprites.
|
||||
/// </summary>
|
||||
public virtual void setDown()
|
||||
{
|
||||
this.movingTexture.setDown();
|
||||
this.sittingTexture.setDown();
|
||||
this.standingTexture.setDown();
|
||||
this.swimmingTexture.setDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets all of the different animations to use their right facing sprites.
|
||||
/// </summary>
|
||||
public virtual void setRight()
|
||||
{
|
||||
this.movingTexture.setRight();
|
||||
this.sittingTexture.setRight();
|
||||
this.standingTexture.setRight();
|
||||
this.swimmingTexture.setRight();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get's the appropriate animation texture based on the type of animation key passed in.
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public virtual DirectionalTexture getTextureFromAnimation(AnimationType type)
|
||||
{
|
||||
if (type == AnimationType.standing) return this.standingTexture;
|
||||
if (type == AnimationType.walking) return this.movingTexture;
|
||||
if (type == AnimationType.swimming) return this.swimmingTexture;
|
||||
if (type == AnimationType.sitting) return this.sittingTexture;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
|
@ -10,13 +11,31 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to hold all of the sprites for a single asset such as hair or bodies.
|
||||
/// </summary>
|
||||
public class AnimatedSpriteCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// The left sprite for this sprite asset part.
|
||||
/// </summary>
|
||||
AnimatedSpriteExtended leftSprite;
|
||||
/// <summary>
|
||||
/// The right sprite for this sprite asset part.
|
||||
/// </summary>
|
||||
AnimatedSpriteExtended rightSprite;
|
||||
/// <summary>
|
||||
/// The up sprite for this sprite asset part.
|
||||
/// </summary>
|
||||
AnimatedSpriteExtended upSprite;
|
||||
/// <summary>
|
||||
/// The down sprite for this sprite asset part.
|
||||
/// </summary>
|
||||
AnimatedSpriteExtended downSprite;
|
||||
|
||||
/// <summary>
|
||||
/// The current sprite for this sprite collection. This is one of the four directions for this collection.
|
||||
/// </summary>
|
||||
public AnimatedSpriteExtended currentSprite;
|
||||
|
||||
/// <summary>
|
||||
|
@ -51,6 +70,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads all of the directional textures for this texture collection.
|
||||
/// </summary>
|
||||
public virtual void reload()
|
||||
{
|
||||
this.leftSprite.reload();
|
||||
|
@ -60,23 +82,32 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current
|
||||
/// Sets the current sprite direction to face left.
|
||||
/// </summary>
|
||||
public void setLeft()
|
||||
{
|
||||
this.currentSprite = leftSprite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current sprite direction to face right.
|
||||
/// </summary>
|
||||
public void setRight()
|
||||
{
|
||||
this.currentSprite = rightSprite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current sprite direction to face down.
|
||||
/// </summary>
|
||||
public void setDown()
|
||||
{
|
||||
this.currentSprite = downSprite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current sprite direction to face up.
|
||||
/// </summary>
|
||||
public void setUp()
|
||||
{
|
||||
this.currentSprite = upSprite;
|
||||
|
@ -108,7 +139,7 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
/// <param name="characterSourceRectOffset"></param>
|
||||
public void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth, int xOffset, int yOffset, Color c, bool flip = false, float scale = 1f, float rotation = 0.0f, bool characterSourceRectOffset = false)
|
||||
{
|
||||
b.Draw(this.currentSprite.sprite.Texture, screenPosition, new Rectangle?(new Rectangle(this.currentSprite.sprite.sourceRect.X + xOffset, this.currentSprite.sprite.sourceRect.Y + yOffset, this.currentSprite.sprite.sourceRect.Width, this.currentSprite.sprite.sourceRect.Height)), c, rotation, characterSourceRectOffset ? new Vector2((float)(this.currentSprite.sprite.spriteWidth / 2), (float)((double)this.currentSprite.sprite.spriteHeight * 3.0 / 4.0)) : Vector2.Zero, scale, flip || this.currentSprite.sprite.currentAnimation != null && this.currentSprite.sprite.currentAnimation[this.currentSprite.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
|
||||
b.Draw(this.currentSprite.sprite.Texture, screenPosition, new Rectangle?(new Rectangle(this.currentSprite.sprite.sourceRect.X + xOffset, this.currentSprite.sprite.sourceRect.Y + yOffset, this.currentSprite.sprite.sourceRect.Width, this.currentSprite.sprite.sourceRect.Height)), c, rotation, characterSourceRectOffset ? new Vector2((float)(this.currentSprite.sprite.SpriteWidth / 2), (float)((double)this.currentSprite.sprite.SpriteHeight * 3.0 / 4.0)) : Vector2.Zero, scale, flip || this.currentSprite.sprite.currentAnimation != null && this.currentSprite.sprite.currentAnimation[this.currentSprite.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -126,7 +157,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
/// <param name="layerDepth"></param>
|
||||
public void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle,Color color, float alpha,Vector2 origin,float scale,SpriteEffects effects,float layerDepth)
|
||||
{
|
||||
b.Draw(this.currentSprite.sprite.Texture,position,sourceRectangle, color* alpha, npc.rotation, origin,scale,effects,layerDepth);
|
||||
//DEFINITELY FIX THIS PART. Something is wrong with how these two functions handle the drawing of my npc to the scene.
|
||||
//this.draw(b, position, layerDepth);
|
||||
b.Draw(this.currentSprite.sprite.Texture,position,this.currentSprite.sprite.sourceRect, color, 0.0f, origin,scale,effects,layerDepth);
|
||||
//b.Draw(this.Sprite.Texture, npc.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
}
|
||||
|
||||
|
@ -134,18 +167,63 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
/// <summary>
|
||||
/// Animate the current sprite. Theoreticlly works from index offset to how many frames
|
||||
/// </summary>
|
||||
/// <param name="intervalFromCharacter"></param>
|
||||
public void Animate(float intervalFromCharacter)
|
||||
/// <param name="intervalDelay">The delay in milliseconds between frames.</param>
|
||||
public void Animate(float intervalDelay,bool loop=true)
|
||||
{
|
||||
this.currentSprite.sprite.Animate(Game1.currentGameTime, 0,3, intervalFromCharacter);
|
||||
this.Animate(Game1.currentGameTime, 0,2, intervalDelay,this.currentSprite.sprite,loop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Animate the current sprite.
|
||||
/// </summary>
|
||||
/// <param name="gameTime">The game time from Monogames/XNA</param>
|
||||
/// <param name="startFrame">The starting frame of the animation on the sprite sheet.</param>
|
||||
/// <param name="numberOfFrames">The number of frames to animate the sprite.</param>
|
||||
/// <param name="interval">The delay between frames in milliseconds.</param>
|
||||
/// <param name="sprite">The animated sprite from the npc.</param>
|
||||
/// <param name="loop">If true, the animation plays over and over again.</param>
|
||||
/// <returns></returns>
|
||||
public virtual bool Animate(GameTime gameTime, int startFrame, int numberOfFrames, float interval, AnimatedSprite sprite, bool loop=true)
|
||||
{
|
||||
if (sprite.CurrentFrame >= startFrame + numberOfFrames + 1 || sprite.CurrentFrame < startFrame)
|
||||
sprite.CurrentFrame = startFrame + sprite.CurrentFrame % numberOfFrames;
|
||||
sprite.timer = sprite.timer + (float)gameTime.ElapsedGameTime.TotalMilliseconds;
|
||||
if ((double)sprite.timer > (double)interval)
|
||||
{
|
||||
sprite.CurrentFrame = sprite.CurrentFrame + 1;
|
||||
sprite.timer = 0.0f;
|
||||
if (sprite.CurrentFrame == startFrame + numberOfFrames + 1 || sprite.currentFrame * sprite.SpriteWidth >= sprite.Texture.Width)
|
||||
{
|
||||
if (loop)
|
||||
sprite.CurrentFrame = startFrame;
|
||||
sprite.UpdateSourceRect();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this.UpdateSourceRect(sprite);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the source rectangle on the sprite sheet. Needed for animation.
|
||||
/// </summary>
|
||||
/// <param name="sprite"></param>
|
||||
public virtual void UpdateSourceRect(AnimatedSprite sprite)
|
||||
{
|
||||
if (sprite.ignoreSourceRectUpdates)
|
||||
return;
|
||||
sprite.sourceRect.X = sprite.CurrentFrame * sprite.SpriteWidth;
|
||||
sprite.sourceRect.Y = 0;
|
||||
//sprite.SourceRect = new Rectangle(, 0, sprite.spriteWidth, sprite.spriteHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Animate the current sprite. Theoreticlly works from index offset to how many frames
|
||||
/// </summary>
|
||||
/// <param name="intervalFromCharacter"></param>
|
||||
public void Animate(float intervalFromCharacter,int startFrame,int endFrame)
|
||||
public void Animate(float intervalFromCharacter,int startFrame,int endFrame, bool loop)
|
||||
{
|
||||
this.currentSprite.sprite.loop = loop;
|
||||
this.currentSprite.sprite.Animate(Game1.currentGameTime, startFrame, endFrame, intervalFromCharacter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CustomNPCFramework.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -8,24 +11,61 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// Used as a wrapper for the AnimatedSprite class.
|
||||
/// </summary>
|
||||
public class AnimatedSpriteExtended
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual sprite of the object.
|
||||
/// </summary>
|
||||
public AnimatedSprite sprite;
|
||||
/// <summary>
|
||||
/// The path to the texture to load the sprite from.
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
|
||||
public AnimatedSpriteExtended(Texture2DExtended texture,AssetSheet assetSheet)
|
||||
{
|
||||
//Set the sprite texture
|
||||
this.sprite = new AnimatedSprite();
|
||||
Texture2D load = texture.Copy().texture;
|
||||
var thing = Class1.ModHelper.Reflection.GetField<Texture2D>(this.sprite, "Texture", true);
|
||||
thing.SetValue(load);
|
||||
|
||||
this.path = assetSheet.path.Clone().ToString();
|
||||
this.sprite.currentFrame = assetSheet.index;
|
||||
|
||||
this.sprite.SpriteWidth = (int)assetSheet.assetInfo.assetSize.X;
|
||||
this.sprite.SpriteHeight = (int)assetSheet.assetInfo.assetSize.Y;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="path">Full path to asset.</param>
|
||||
/// <param name="currentFrame">Starting animation frame.</param>
|
||||
/// <param name="spriteWidth">Sprite width.</param>
|
||||
/// <param name="spriteHeight">Sprite height</param>
|
||||
public AnimatedSpriteExtended(string path,int currentFrame,int spriteWidth, int spriteHeight)
|
||||
/// <param name="path"></param>
|
||||
/// <param name="currentFrame"></param>
|
||||
/// <param name="spriteWidth"></param>
|
||||
/// <param name="spriteHeight"></param>
|
||||
public AnimatedSpriteExtended(string path ,int currentFrame, int spriteWidth, int spriteHeight)
|
||||
{
|
||||
this.path = Class1.getRelativeDirectory(path);
|
||||
this.sprite=new AnimatedSprite(Class1.ModHelper.Content.Load<Texture2D>(this.path),currentFrame,spriteWidth,spriteHeight);
|
||||
|
||||
//Set the sprite texture
|
||||
this.sprite = new AnimatedSprite();
|
||||
Texture2D load = Class1.ModHelper.Content.Load<Texture2D>(this.path);
|
||||
var thing=Class1.ModHelper.Reflection.GetField<Texture2D>(this.sprite, "Texture", true);
|
||||
thing.SetValue(load);
|
||||
|
||||
//Set the fields.
|
||||
this.sprite.currentFrame = currentFrame;
|
||||
this.sprite.SpriteWidth = spriteWidth;
|
||||
this.sprite.SpriteHeight = spriteHeight;
|
||||
|
||||
//this.sprite = new AnimatedSprite(texture, currentFrame, spriteWidth, spriteHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -33,7 +73,10 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
/// </summary>
|
||||
public void reload()
|
||||
{
|
||||
this.sprite.Texture = Class1.ModHelper.Content.Load<Texture2D>(this.path);
|
||||
//Set the sprite texture
|
||||
Texture2D load = Class1.ModHelper.Content.Load<Texture2D>(this.path);
|
||||
var thing = Class1.ModHelper.Reflection.GetField<Texture2D>(this.sprite, "Texture", true);
|
||||
thing.SetValue(load);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,38 +9,75 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// Used as a base class for character animations.
|
||||
/// </summary>
|
||||
public class CharacterAnimationBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public CharacterAnimationBase()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the character sprites to left.
|
||||
/// </summary>
|
||||
public virtual void setLeft()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the character sprites to right.
|
||||
/// </summary>
|
||||
public virtual void setRight()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the character sprites to up.
|
||||
/// </summary>
|
||||
public virtual void setUp()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the character sprites to down.
|
||||
/// </summary>
|
||||
public virtual void setDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to reload the sprite textures.
|
||||
/// </summary>
|
||||
public virtual void reload()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Animate the sprites.
|
||||
/// </summary>
|
||||
/// <param name="animationInterval">How long between animation frames in milliseconds.</param>
|
||||
public virtual void Animate(float animationInterval)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to animate sprites.
|
||||
/// </summary>
|
||||
/// <param name="animationInterval">How long between animation frames in milliseconds.</param>
|
||||
/// <param name="loop">Loop the animation.</param>
|
||||
public virtual void Animate(float animationInterval, bool loop=true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ColorCollections;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -9,17 +11,53 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
||||
{
|
||||
/// <summary>
|
||||
/// A class used to reference the different textures used to comprise the different parts for character rendering.
|
||||
/// </summary>
|
||||
public class StandardCharacterAnimation :CharacterAnimationBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for the npc hair part.
|
||||
/// </summary>
|
||||
public AnimatedSpriteCollection hair;
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for the npc body part.
|
||||
/// </summary>
|
||||
public AnimatedSpriteCollection body;
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for the npc eyes part.
|
||||
/// </summary>
|
||||
public AnimatedSpriteCollection eyes;
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for the npc shirt part.
|
||||
/// </summary>
|
||||
public AnimatedSpriteCollection shirt;
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for the npc pants part.
|
||||
/// </summary>
|
||||
public AnimatedSpriteCollection pants;
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for the npc shoes part.
|
||||
/// </summary>
|
||||
public AnimatedSpriteCollection shoes;
|
||||
/// <summary>
|
||||
/// Used to hold all of the information for draw colors for the different parts.
|
||||
/// </summary>
|
||||
public StandardColorCollection drawColors;
|
||||
public List<AnimatedSpriteCollection> accessories;
|
||||
|
||||
public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List<AnimatedSpriteCollection> accessoriesWithAnimations) :base()
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="bodyAnimation">The collection of textures to be used for the body part for the npc.</param>
|
||||
/// <param name="eyeAnimation">The collection of textures to be used for the eyes part for the npc.</param>
|
||||
/// <param name="hairAnimation">The collection of textures to be used for the hair part for the npc.</param>
|
||||
/// <param name="shirtAnimation">The collection of textures to be used for the shirt part for the npc.</param>
|
||||
/// <param name="pantsAnimation">The collection of textures to be used for the pants part for the npc.</param>
|
||||
/// <param name="shoesAnimation">The collection of textures to be used for the shoes part for the npc.</param>
|
||||
/// <param name="accessoriesWithAnimations">The collection of textures to be used for the accessories part for the npc.</param>
|
||||
/// <param name="DrawColors">The collection of draw colors for the different parts for the npc.</param>
|
||||
public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List<AnimatedSpriteCollection> accessoriesWithAnimations, StandardColorCollection DrawColors) :base()
|
||||
{
|
||||
this.body = bodyAnimation;
|
||||
this.hair = hairAnimation;
|
||||
|
@ -28,8 +66,12 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
this.pants = pantsAnimation;
|
||||
this.shoes = shoesAnimation;
|
||||
this.accessories = accessoriesWithAnimations;
|
||||
this.drawColors = DrawColors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets all of the different textures to face left.
|
||||
/// </summary>
|
||||
public override void setLeft()
|
||||
{
|
||||
this.body.setLeft();
|
||||
|
@ -44,6 +86,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
accessory.setLeft();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets all of the different textures to face right.
|
||||
/// </summary>
|
||||
public override void setRight()
|
||||
{
|
||||
this.body.setRight();
|
||||
|
@ -58,6 +103,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
accessory.setRight();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets all of the different textures to face up.
|
||||
/// </summary>
|
||||
public override void setUp()
|
||||
{
|
||||
this.body.setUp();
|
||||
|
@ -72,6 +120,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
accessory.setUp();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets all of the different textures to face down.
|
||||
/// </summary>
|
||||
public override void setDown()
|
||||
{
|
||||
this.body.setDown();
|
||||
|
@ -87,6 +138,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads all of the sprite textures.
|
||||
/// </summary>
|
||||
public override void reload()
|
||||
{
|
||||
this.body.reload();
|
||||
|
@ -97,17 +151,22 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
this.shoes.reload();
|
||||
}
|
||||
|
||||
public override void Animate(float animationInterval)
|
||||
/// <summary>
|
||||
/// Animates all of the textures for this sprite.
|
||||
/// </summary>
|
||||
/// <param name="animationInterval">The delay in milliseconds between animation frames.</param>
|
||||
/// <param name="loop">Determines if the animation continuously plays over and over.</param>
|
||||
public override void Animate(float animationInterval,bool loop=true)
|
||||
{
|
||||
this.body.Animate(animationInterval);
|
||||
this.hair.Animate(animationInterval);
|
||||
this.eyes.Animate(animationInterval);
|
||||
this.shirt.Animate(animationInterval);
|
||||
this.pants.Animate(animationInterval);
|
||||
this.shoes.Animate(animationInterval);
|
||||
this.body.Animate(animationInterval,loop);
|
||||
this.hair.Animate(animationInterval,loop);
|
||||
this.eyes.Animate(animationInterval,loop);
|
||||
this.shirt.Animate(animationInterval,loop);
|
||||
this.pants.Animate(animationInterval,loop);
|
||||
this.shoes.Animate(animationInterval,loop);
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.Animate(animationInterval);
|
||||
accessory.Animate(animationInterval,loop);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -151,12 +210,12 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
public override void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth, int xOffset, int yOffset, Color c, bool flip = false, float scale = 1f, float rotation = 0.0f, bool characterSourceRectOffset = false)
|
||||
{
|
||||
// b.Draw(this.currentSprite.Texture, screenPosition, new Rectangle?(new Rectangle(this.currentSprite.sourceRect.X + xOffset, this.currentSprite.sourceRect.Y + yOffset, this.currentSprite.sourceRect.Width, this.currentSprite.sourceRect.Height)), c, rotation, characterSourceRectOffset ? new Vector2((float)(this.currentSprite.spriteWidth / 2), (float)((double)this.currentSprite.spriteHeight * 3.0 / 4.0)) : Vector2.Zero, scale, flip || this.currentSprite.currentAnimation != null && this.currentSprite.currentAnimation[this.currentSprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
|
||||
this.body.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
this.hair.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
this.eyes.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
this.shirt.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
this.pants.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
this.shoes.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
this.body.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c,this.drawColors.bodyColor), flip, scale, rotation, characterSourceRectOffset);
|
||||
this.hair.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.hairColor), flip, scale, rotation, characterSourceRectOffset);
|
||||
this.eyes.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.eyeColor), flip, scale, rotation, characterSourceRectOffset);
|
||||
this.shirt.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.shirtColor), flip, scale, rotation, characterSourceRectOffset);
|
||||
this.pants.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.bottomsColor), flip, scale, rotation, characterSourceRectOffset);
|
||||
this.shoes.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.shoesColor), flip, scale, rotation, characterSourceRectOffset);
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
|
@ -178,15 +237,31 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
|||
/// <param name="layerDepth"></param>
|
||||
public override void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle, Color color, float alpha, Vector2 origin, float scale, SpriteEffects effects, float layerDepth)
|
||||
{
|
||||
this.body.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
this.hair.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
this.eyes.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
this.shirt.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
this.pants.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
this.shoes.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
//Class1.ModMonitor.Log(sourceRectangle.ToString());
|
||||
Vector2 generalOffset = new Vector2(0, 1*Game1.tileSize); //Puts the sprite at the correct positioning.
|
||||
position -= new Vector2(0, 0.25f * Game1.tileSize);
|
||||
float smallOffset = 0.001f;
|
||||
float tinyOffset = 0.0001f;
|
||||
//Class1.ModMonitor.Log((position - generalOffset).ToString());
|
||||
float num = Math.Max(0.0f, (float)(Math.Ceiling(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 600.0 + (double)npc.DefaultPosition.X * 20.0)) / 4.0));
|
||||
this.body.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.bodyColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset);
|
||||
this.eyes.draw(b, npc, position - generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.eyeColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset *1));
|
||||
this.hair.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.hairColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset *2));
|
||||
|
||||
if (num > 0.0f)
|
||||
{
|
||||
Vector2 shirtOffset = new Vector2((1 * Game1.tileSize) / 4, (1 * Game1.tileSize) / 4);
|
||||
this.shirt.draw(b, npc, position - generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.shirtColor), alpha, new Vector2(0.5f,1), scale * Game1.pixelZoom + num, effects, layerDepth + smallOffset + (tinyOffset * 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.shirt.draw(b, npc, position - generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.shirtColor), alpha, origin, scale * Game1.pixelZoom, effects, layerDepth + smallOffset + (tinyOffset * 3));
|
||||
}
|
||||
this.pants.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.bottomsColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset*4));
|
||||
this.shoes.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.shoesColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset*5));
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
accessory.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth +0.0006f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.ColorCollections
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection of colors to be used for the StandardCharacterAnimation object.
|
||||
/// </summary>
|
||||
public class StandardColorCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// The draw color to be used for the body sprite for the npc.
|
||||
/// </summary>
|
||||
public Color bodyColor;
|
||||
/// <summary>
|
||||
/// The draw color to be used for the eye sprite for the npc.
|
||||
/// </summary>
|
||||
public Color eyeColor;
|
||||
/// <summary>
|
||||
/// The draw color to be used for the hair sprite for the npc.
|
||||
/// </summary>
|
||||
public Color hairColor;
|
||||
/// <summary>
|
||||
/// The draw color to be used for the shirt sprite for the npc.
|
||||
/// </summary>
|
||||
public Color shirtColor;
|
||||
/// <summary>
|
||||
/// The draw color to be used for the bottoms/pants sprite for the npc.
|
||||
/// </summary>
|
||||
public Color bottomsColor;
|
||||
/// <summary>
|
||||
/// The draw color to be used for the shoes sprite for the npc.
|
||||
/// </summary>
|
||||
public Color shoesColor;
|
||||
|
||||
/// <summary>
|
||||
/// Default constrctor that sets all of the draw colors to white.
|
||||
/// </summary>
|
||||
public StandardColorCollection()
|
||||
{
|
||||
defaultColor(this.bodyColor);
|
||||
defaultColor(this.eyeColor);
|
||||
defaultColor(this.hairColor);
|
||||
defaultColor(this.shirtColor);
|
||||
defaultColor(this.bottomsColor);
|
||||
defaultColor(this.shoesColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that takes different colors as parameters.
|
||||
/// </summary>
|
||||
/// <param name="BodyColor">Color for the body texture.</param>
|
||||
/// <param name="EyeColor">Color for the eyes texture.</param>
|
||||
/// <param name="HairColor">Color for the hair texture.</param>
|
||||
/// <param name="ShirtColor">Color for the shirt texture.</param>
|
||||
/// <param name="BottomsColor">Color for the bottoms texture.</param>
|
||||
/// <param name="ShoesColor">Color for the shoes texture.</param>
|
||||
public StandardColorCollection(Color? BodyColor, Color? EyeColor, Color? HairColor, Color? ShirtColor, Color? BottomsColor, Color? ShoesColor)
|
||||
{
|
||||
this.bodyColor = (Color)BodyColor.GetValueOrDefault(Color.White);
|
||||
this.eyeColor = (Color)EyeColor.GetValueOrDefault(Color.White);
|
||||
this.hairColor = (Color)HairColor.GetValueOrDefault(Color.White);
|
||||
this.shirtColor = (Color)ShirtColor.GetValueOrDefault(Color.White);
|
||||
this.bottomsColor = (Color)BottomsColor.GetValueOrDefault(Color.White);
|
||||
this.shoesColor = (Color)ShoesColor.GetValueOrDefault(Color.White);
|
||||
|
||||
defaultColor(this.bodyColor);
|
||||
defaultColor(this.eyeColor);
|
||||
defaultColor(this.hairColor);
|
||||
defaultColor(this.shirtColor);
|
||||
defaultColor(this.bottomsColor);
|
||||
defaultColor(this.shoesColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If a color is null, make it white.
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
public void defaultColor(Color color)
|
||||
{
|
||||
if (color == null) color = Color.White;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to mix colors together.
|
||||
/// </summary>
|
||||
/// <param name="cBase">The base color to mix.</param>
|
||||
/// <param name="cMult">The modifier color to mix.</param>
|
||||
/// <returns>A color that is a mix between the two colors passed in.</returns>
|
||||
public static Color colorMult(Color cBase, Color cMult)
|
||||
{
|
||||
Vector3 color1 = cBase.ToVector3();
|
||||
Vector3 color2 = cMult.ToVector3();
|
||||
Vector3 mixColor = color1 * color2;
|
||||
Color value = new Color(mixColor);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
up,
|
||||
right,
|
||||
down,
|
||||
left
|
||||
}
|
||||
}
|
|
@ -6,11 +6,26 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
||||
{
|
||||
class AnimationKeys
|
||||
/// <summary>
|
||||
/// A class used instead of an enum to hold keys for all of the different animations.
|
||||
/// </summary>
|
||||
public class AnimationKeys
|
||||
{
|
||||
/// <summary>
|
||||
/// The string that is used for the standing animation.
|
||||
/// </summary>
|
||||
public static string standingKey = "standing";
|
||||
/// <summary>
|
||||
/// The string that is used for the walking/moving animation.
|
||||
/// </summary>
|
||||
public static string walkingKey = "walking";
|
||||
/// <summary>
|
||||
/// The string that is used for the sitting animation.
|
||||
/// </summary>
|
||||
public static string sittingKey = "sitting";
|
||||
/// <summary>
|
||||
/// The string that is used for the swimming animation.
|
||||
/// </summary>
|
||||
public static string swimmingKey = "swimming";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using CustomNPCFramework.Framework.Graphics;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -10,11 +13,26 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
||||
{
|
||||
/// <summary>
|
||||
/// A class used to hold all of the textures/animations/information to make modular npc rendering possible.
|
||||
/// </summary>
|
||||
public class BasicRenderer
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictionary that holds key pair values of (animationName,Animation). USed to manage multiple animations.
|
||||
/// </summary>
|
||||
public Dictionary<string, StandardCharacterAnimation> animationList;
|
||||
/// <summary>
|
||||
/// Used to keep track of what animation is currently being used.
|
||||
/// </summary>
|
||||
public StandardCharacterAnimation currentAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="standingAnimation">The animation information to be used when the character is standing.</param>
|
||||
/// <param name="walkingAnimation">The animation information to be used when the character is walking/moving.</param>
|
||||
/// <param name="swimmingAnimation">The animation information to be used when the character is walking/moving.</param>
|
||||
public BasicRenderer(StandardCharacterAnimation standingAnimation,StandardCharacterAnimation walkingAnimation, StandardCharacterAnimation swimmingAnimation)
|
||||
{
|
||||
animationList = new Dictionary<string, StandardCharacterAnimation>();
|
||||
|
@ -27,13 +45,21 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
|||
/// <summary>
|
||||
/// Sets the animation associated with the key name; If it fails the npc will just default to standing.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="key">The name of the animation to swap the current animation to.</param>
|
||||
public virtual void setAnimation(string key)
|
||||
{
|
||||
this.currentAnimation = animationList[key];
|
||||
if (this.currentAnimation == null) this.setAnimation(AnimationKeys.standingKey);
|
||||
if (this.currentAnimation == null)
|
||||
{
|
||||
Class1.ModMonitor.Log("ERROR SETTING AN ANIMATION: "+key);
|
||||
this.setAnimation(AnimationKeys.standingKey);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the direction of the current animated sprite respectively.
|
||||
/// </summary>
|
||||
/// <param name="facingDirection">The direction to face. 0=up, 1=right, 2= down, 3=left.</param>
|
||||
public virtual void setDirection(int facingDirection)
|
||||
{
|
||||
if (facingDirection == 0) setUp();
|
||||
|
@ -42,26 +68,54 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
|||
if (facingDirection == 2) setLeft();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the direction of the current animated sprite respectively to the direction passed in.
|
||||
/// </summary>
|
||||
/// <param name="direction">The direction to face.</param>
|
||||
public virtual void setDirection(Direction direction)
|
||||
{
|
||||
if (direction == Direction.up) setUp();
|
||||
if (direction == Direction.right) setRight();
|
||||
if (direction == Direction.down) setDown();
|
||||
if (direction == Direction.left) setLeft();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current animated sprite to face left.
|
||||
/// </summary>
|
||||
public virtual void setLeft()
|
||||
{
|
||||
this.currentAnimation.setLeft();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current animated sprite to face right.
|
||||
/// </summary>
|
||||
public virtual void setRight()
|
||||
{
|
||||
this.currentAnimation.setRight();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current animated sprite to face up.
|
||||
/// </summary>
|
||||
public virtual void setUp()
|
||||
{
|
||||
this.currentAnimation.setUp();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current animated sprite to face down.
|
||||
/// </summary>
|
||||
public virtual void setDown()
|
||||
{
|
||||
this.currentAnimation.setDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to reload all of the sprites pertaining to all of the animations stored in this renderer.
|
||||
/// </summary>
|
||||
public virtual void reloadSprites()
|
||||
{
|
||||
foreach(var v in this.animationList)
|
||||
|
@ -114,13 +168,19 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
|||
/// <param name="layerDepth"></param>
|
||||
public virtual void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle, Color color, float alpha, Vector2 origin, float scale, SpriteEffects effects, float layerDepth)
|
||||
{
|
||||
|
||||
this.currentAnimation.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
}
|
||||
|
||||
|
||||
public virtual void Animate(float interval)
|
||||
/// <summary>
|
||||
/// Animates the current animation for the current sprite.
|
||||
/// </summary>
|
||||
/// <param name="interval"></param>
|
||||
/// <param name="loop"></param>
|
||||
public virtual void Animate(float interval, bool loop=true)
|
||||
{
|
||||
this.currentAnimation.Animate(interval);
|
||||
this.currentAnimation.Animate(interval,loop);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,9 +197,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
|||
/// <param name="v2"></param>
|
||||
/// <param name="spriteEffects"></param>
|
||||
/// <param name="v3"></param>
|
||||
public virtual void draw(SpriteBatch b, ExtendedNPC extendedNPC, Vector2 vector21, Rectangle? v1, Color white, float rotation, Vector2 vector22, float v2, SpriteEffects spriteEffects, float v3)
|
||||
public virtual void draw(SpriteBatch b, ExtendedNPC extendedNPC, Vector2 position, Rectangle? v1, Color white, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float v3)
|
||||
{
|
||||
this.draw(b, extendedNPC, vector21, v1, white, rotation, vector22, v2, spriteEffects, v3);
|
||||
this.draw(b, extendedNPC, position, new Rectangle(0,0,16,32), white, rotation, origin, scale, spriteEffects, v3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// Used as a wrapper for npc portraits.
|
||||
/// </summary>
|
||||
public class Portrait
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to display the npc portrait.
|
||||
/// </summary>
|
||||
public Texture2D portrait;
|
||||
/// <summary>
|
||||
/// Used to hold the path to the texture to use for the npc portrait.
|
||||
/// </summary>
|
||||
public string relativePath;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
|
@ -9,21 +10,64 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// Used as a wrapper for the npcs to hold sprite information.
|
||||
/// </summary>
|
||||
public class Sprite
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual sprite to draw for the npc.
|
||||
/// </summary>
|
||||
public AnimatedSprite sprite;
|
||||
/// <summary>
|
||||
/// The path to the texture to use for the animated sprite.
|
||||
/// </summary>
|
||||
public string relativePath;
|
||||
|
||||
/// <summary>
|
||||
/// A class for handling portraits.
|
||||
/// A class for handling character sprites.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path to the file.</param>
|
||||
public Sprite(string path)
|
||||
{
|
||||
this.relativePath = Class1.getRelativeDirectory(path);
|
||||
this.sprite = new AnimatedSprite(Class1.ModHelper.Content.Load<Texture2D>(this.relativePath));
|
||||
this.sprite.spriteWidth = this.sprite.Texture.Width;
|
||||
this.sprite.spriteHeight = this.sprite.Texture.Height;
|
||||
try
|
||||
{
|
||||
this.relativePath = Class1.getShortenedDirectory(path);
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
this.relativePath = path;
|
||||
}
|
||||
try
|
||||
{
|
||||
this.sprite = new AnimatedSprite();
|
||||
Texture2D text = Class1.ModHelper.Content.Load<Texture2D>(this.relativePath);
|
||||
var reflect=Class1.ModHelper.Reflection.GetField<Texture2D>(this.sprite, "Texture", true);
|
||||
reflect.SetValue(text);
|
||||
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
this.sprite = new AnimatedSprite();
|
||||
Texture2D text = Class1.ModHelper.Content.Load<Texture2D>(this.relativePath);
|
||||
var reflect = Class1.ModHelper.Reflection.GetField<Texture2D>(this.sprite, "Texture", true);
|
||||
reflect.SetValue(text);
|
||||
}
|
||||
this.sprite.SpriteWidth = this.sprite.Texture.Width;
|
||||
this.sprite.SpriteHeight = this.sprite.Texture.Height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="path">Used to hold the path to the asset.</param>
|
||||
/// <param name="texture">Used to assign the texture to the sprite from a pre-loaded asset.</param>
|
||||
public Sprite(string path, string texture)
|
||||
{
|
||||
this.relativePath = path;
|
||||
this.sprite = new AnimatedSprite(texture);
|
||||
this.sprite.SpriteWidth = this.sprite.Texture.Width;
|
||||
this.sprite.SpriteHeight = this.sprite.Texture.Height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,7 +84,61 @@ namespace CustomNPCFramework.Framework.ModularNPCS
|
|||
/// </summary>
|
||||
public void reload()
|
||||
{
|
||||
this.sprite.Texture = Class1.ModHelper.Content.Load<Texture2D>(this.relativePath);
|
||||
var text=CustomNPCFramework.Class1.ModHelper.Reflection.GetField<Texture2D>(this.sprite.Texture, "Texture", true);
|
||||
Texture2D loaded= Class1.ModHelper.Content.Load<Texture2D>(this.relativePath);
|
||||
text.SetValue(loaded);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set's the npc's sprites to face left IF and only if there is a non-null modular Renderer attached to the npc.
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
public void setLeft(ExtendedNPC npc)
|
||||
{
|
||||
if (npc.characterRenderer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else npc.characterRenderer.setLeft();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set's the npc's sprites to face left IF and only if there is a non-null modular Renderer attached to the npc.
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
public void setRight(ExtendedNPC npc)
|
||||
{
|
||||
if (npc.characterRenderer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else npc.characterRenderer.setRight();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set's the npc's sprites to face left IF and only if there is a non-null modular Renderer attached to the npc.
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
public void setDown(ExtendedNPC npc)
|
||||
{
|
||||
if (npc.characterRenderer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else npc.characterRenderer.setDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set's the npc's sprites to face left IF and only if there is a non-null modular Renderer attached to the npc.
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
public void setUp(ExtendedNPC npc)
|
||||
{
|
||||
if (npc.characterRenderer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else npc.characterRenderer.setUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
using CustomNPCFramework.Framework.Enums;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used as a class to hold all of the possible npc names.
|
||||
/// </summary>
|
||||
public class NPCNames
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds all of the npc male names.
|
||||
/// </summary>
|
||||
public static List<string> maleNames = new List<string>()
|
||||
{
|
||||
"Freddy",
|
||||
"Josh",
|
||||
"Ash"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Holds all of the npc female names.
|
||||
/// </summary>
|
||||
public static List<string> femaleNames = new List<string>()
|
||||
{
|
||||
"Rebecca",
|
||||
"Sierra",
|
||||
"Lisa"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Holds all of the npc gender non-binary names.
|
||||
/// </summary>
|
||||
public static List<string> otherGenderNames = new List<string>()
|
||||
{
|
||||
"Jayden",
|
||||
"Ryanne",
|
||||
"Skylar"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Get a gender appropriate name from the pool of npc names.
|
||||
/// </summary>
|
||||
/// <param name="gender"></param>
|
||||
/// <returns></returns>
|
||||
public static string getRandomNPCName(Genders gender)
|
||||
{
|
||||
if (gender == Genders.female) {
|
||||
|
||||
int rand = Game1.random.Next(0, femaleNames.Count - 1);
|
||||
return femaleNames.ElementAt(rand);
|
||||
}
|
||||
|
||||
if (gender == Genders.male)
|
||||
{
|
||||
|
||||
int rand = Game1.random.Next(0, maleNames.Count - 1);
|
||||
return maleNames.ElementAt(rand);
|
||||
}
|
||||
|
||||
if (gender == Genders.other)
|
||||
{
|
||||
|
||||
int rand = Game1.random.Next(0, otherGenderNames.Count - 1);
|
||||
return otherGenderNames.ElementAt(rand);
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.Enums;
|
||||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
@ -26,6 +27,9 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
/// </summary>
|
||||
public class ExtendedNPC :StardewValley.NPC
|
||||
{
|
||||
/// <summary>
|
||||
/// The custom character renderer for this npc.
|
||||
/// </summary>
|
||||
public BasicRenderer characterRenderer;
|
||||
public bool hasBeenKissedToday;
|
||||
public Point previousEndPoint;
|
||||
|
@ -33,35 +37,122 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
public bool hasSaidAfternoonDialogue;
|
||||
public int timeAfterSquare;
|
||||
|
||||
/// <summary>
|
||||
/// Used to hold sprite information to be used in the case the npc renderer is null.
|
||||
/// </summary>
|
||||
public Sprite spriteInformation;
|
||||
|
||||
/// <summary>
|
||||
/// Used to hold the portrait information for the npc and display it.
|
||||
/// </summary>
|
||||
public Portrait portraitInformation;
|
||||
|
||||
/// <summary>
|
||||
/// The default location for this npc to reside in.
|
||||
/// </summary>
|
||||
public GameLocation defaultLocation;
|
||||
|
||||
/// <summary>
|
||||
/// Empty Constructor.
|
||||
/// </summary>
|
||||
public ExtendedNPC() :base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Non modular npc Constructor.
|
||||
/// </summary>
|
||||
/// <param name="sprite">The sprite for the character.</param>
|
||||
/// <param name="position">The position of the npc on the map.</param>
|
||||
/// <param name="facingDirection">The direction of the npc</param>
|
||||
/// <param name="name">The name of the npc.</param>
|
||||
public ExtendedNPC(Sprite sprite, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
|
||||
{
|
||||
this.characterRenderer = null;
|
||||
this.Portrait = (Texture2D)null;
|
||||
this.portraitInformation = null;
|
||||
this.spriteInformation = sprite;
|
||||
if (this.spriteInformation != null)
|
||||
{
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
}
|
||||
this.swimming.Value = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Non modular npc Constructor.
|
||||
/// </summary>
|
||||
/// <param name="sprite">The sprite for the character.</param>
|
||||
/// <param name="portrait">The portrait texture for this npc.</param>
|
||||
/// <param name="position">The position of the npc on the map.</param>
|
||||
/// <param name="facingDirection">The direction of the npc</param>
|
||||
/// <param name="name">The name of the npc.</param>
|
||||
public ExtendedNPC(Sprite sprite, Portrait portrait, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
|
||||
{
|
||||
this.characterRenderer = null;
|
||||
this.portraitInformation = portrait;
|
||||
if (this.portraitInformation != null)
|
||||
{
|
||||
this.portraitInformation.setCharacterPortraitFromThis(this);
|
||||
}
|
||||
this.spriteInformation = sprite;
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
this.swimming.Value = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modular npc constructor.
|
||||
/// </summary>
|
||||
/// <param name="sprite">The sprite for the character to use incase the renderer is null.</param>
|
||||
/// <param name="renderer">The custom npc render. Used to draw the npcfrom a collection of assets.</param>
|
||||
/// <param name="portrait">The portrait texture for this npc.</param>
|
||||
/// <param name="position">The position of the npc on the map.</param>
|
||||
/// <param name="facingDirection">The direction of the npc</param>
|
||||
/// <param name="name">The name of the npc.</param>
|
||||
public ExtendedNPC(Sprite sprite,BasicRenderer renderer,Vector2 position,int facingDirection,string name): base(sprite.sprite, position, facingDirection, name, null)
|
||||
{
|
||||
this.characterRenderer = renderer;
|
||||
this.Portrait = (Texture2D)null;
|
||||
this.portraitInformation = null;
|
||||
this.spriteInformation = sprite;
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
this.swimming = false;
|
||||
if (this.spriteInformation != null)
|
||||
{
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
}
|
||||
this.swimming.Value = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modular constructor for the npc.
|
||||
/// </summary>
|
||||
/// <param name="sprite">The sprite for the npc to use incase the renderer is null.</param>
|
||||
/// <param name="renderer">The custom npc renderer used to draw the npc from the collection of textures.</param>
|
||||
/// <param name="portrait">The portrait texture for the npc.</param>
|
||||
/// <param name="position">The positon for the npc to be.</param>
|
||||
/// <param name="facingDirection">The direction for the npc to face.</param>
|
||||
/// <param name="name">The name for the npc.</param>
|
||||
public ExtendedNPC(Sprite sprite,BasicRenderer renderer,Portrait portrait, Vector2 position, int facingDirection, string name) : base(sprite.sprite, position, facingDirection, name, null)
|
||||
{
|
||||
this.characterRenderer = renderer;
|
||||
this.portraitInformation = portrait;
|
||||
this.portraitInformation.setCharacterPortraitFromThis(this);
|
||||
if (this.portraitInformation != null)
|
||||
{
|
||||
this.portraitInformation.setCharacterPortraitFromThis(this);
|
||||
}
|
||||
this.spriteInformation = sprite;
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
this.swimming = false;
|
||||
if (this.spriteInformation != null)
|
||||
{
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
}
|
||||
this.swimming.Value = false;
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
public override void reloadSprite()
|
||||
/// <summary>
|
||||
/// Used to reload the sprite for the npc.
|
||||
/// </summary>
|
||||
public void reloadSprite()
|
||||
{
|
||||
|
||||
if (this.characterRenderer == null)
|
||||
{
|
||||
this.spriteInformation.reload();
|
||||
|
@ -71,6 +162,7 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString();
|
||||
this.Portrait = (Texture2D)null;
|
||||
}
|
||||
}
|
||||
|
@ -83,10 +175,11 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString();
|
||||
this.Portrait = (Texture2D)null;
|
||||
}
|
||||
}
|
||||
int num = this.isInvisible ? 1 : 0;
|
||||
int num = this.IsInvisible ? 1 : 0;
|
||||
if (!Game1.newDay && (int)Game1.gameMode != 6)
|
||||
return;
|
||||
this.faceDirection(this.DefaultFacingDirection);
|
||||
|
@ -94,32 +187,128 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
this.previousEndPoint = new Point((int)this.DefaultPosition.X / Game1.tileSize, (int)this.DefaultPosition.Y / Game1.tileSize);
|
||||
this.Schedule = this.getSchedule(Game1.dayOfMonth);
|
||||
this.faceDirection(this.defaultFacingDirection);
|
||||
this.sprite.standAndFaceDirection(this.defaultFacingDirection);
|
||||
this.loadSeasonalDialogue();
|
||||
this.updateDialogue();
|
||||
this.Sprite.standAndFaceDirection(this.defaultFacingDirection);
|
||||
|
||||
if (this.isMarried())
|
||||
this.marriageDuties();
|
||||
this.marriageDuties(true);
|
||||
bool flag = Utility.isFestivalDay(Game1.dayOfMonth, Game1.currentSeason);
|
||||
try
|
||||
{
|
||||
this.displayName = this.name;
|
||||
this.displayName = this.Name;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Functionality used when interacting with the npc.
|
||||
/// </summary>
|
||||
/// <param name="who"></param>
|
||||
/// <param name="l"></param>
|
||||
/// <returns></returns>
|
||||
public override bool checkAction(StardewValley.Farmer who, GameLocation l)
|
||||
{
|
||||
base.checkAction(who, l);
|
||||
return false;
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
/// <summary>
|
||||
/// Used to move the npc. Different code is used depending if the character renderer is null or not.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <param name="viewport"></param>
|
||||
/// <param name="currentLocation"></param>
|
||||
public override void MovePosition(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation currentLocation)
|
||||
{
|
||||
base.MovePosition(time,viewport,currentLocation);
|
||||
if (this.characterRenderer != null)
|
||||
{
|
||||
ModularMovement(time,viewport,currentLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
NonModularMovement(time,viewport,currentLocation);
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set's the npc to move a certain direction and then executes the movement.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <param name="viewport"></param>
|
||||
/// <param name="currentLocation"></param>
|
||||
/// <param name="MoveDirection">The direction to move the npc.</param>
|
||||
/// <param name="Move">Set's the npc's sprite to halt if Move=false. Else set it to true.</param>
|
||||
public virtual void SetMovingAndMove(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation currentLocation, Direction MoveDirection, bool Move=true)
|
||||
{
|
||||
if (MoveDirection == Direction.down) this.SetMovingDown(Move);
|
||||
if (MoveDirection == Direction.left) this.SetMovingLeft(Move);
|
||||
if (MoveDirection == Direction.up) this.SetMovingUp(Move);
|
||||
if (MoveDirection == Direction.right) this.SetMovingRight(Move);
|
||||
this.MovePosition(time, viewport, currentLocation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// USed to move the npc if the character renderer is null.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <param name="viewport"></param>
|
||||
/// <param name="location"></param>
|
||||
public virtual void NonModularMovement(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation location)
|
||||
{
|
||||
base.MovePosition(time, viewport, currentLocation);
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to determine if the npc can move past the next location.
|
||||
/// </summary>
|
||||
/// <param name="viewport"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool canMovePastNextLocation(xTile.Dimensions.Rectangle viewport)
|
||||
{
|
||||
//Up
|
||||
if (!currentLocation.isTilePassable(this.nextPosition(0), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//Right
|
||||
if (!currentLocation.isTilePassable(this.nextPosition(1), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//Down
|
||||
if (!currentLocation.isTilePassable(this.nextPosition(2), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//Left
|
||||
if (!currentLocation.isTilePassable(this.nextPosition(3), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to move the npc if the character renderer is valid. Handles animating all of the sprites associated with the renderer.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <param name="viewport"></param>
|
||||
/// <param name="location"></param>
|
||||
/// <param name="interval"></param>
|
||||
public virtual void ModularMovement(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation location, float interval = 1000f)
|
||||
{
|
||||
this.characterRenderer.setAnimation(AnimationKeys.walkingKey);
|
||||
if (this.canMovePastNextLocation(viewport) == false)
|
||||
{
|
||||
this.Halt();
|
||||
return;
|
||||
}
|
||||
if (this.GetType() == typeof(FarmAnimal))
|
||||
this.willDestroyObjectsUnderfoot = false;
|
||||
if ((double)this.xVelocity != 0.0 || (double)this.yVelocity != 0.0)
|
||||
|
@ -142,7 +331,9 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
this.position.Y -= (float)(this.speed + this.addedSpeed);
|
||||
if (!this.ignoreMovementAnimation)
|
||||
{
|
||||
this.sprite.AnimateUp(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.spriteInformation.setUp(this);
|
||||
this.characterRenderer.Animate(interval,true);
|
||||
//this.sprite.AnimateUp(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.faceDirection(0);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +358,10 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
this.position.X += (float)(this.speed + this.addedSpeed);
|
||||
if (!this.ignoreMovementAnimation)
|
||||
{
|
||||
this.sprite.AnimateRight(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.spriteInformation.setRight(this);
|
||||
this.characterRenderer.Animate(interval,true);
|
||||
//this.spriteInformation.sprite.Animate(time, 0, 3, 1f);
|
||||
//this.sprite.AnimateRight(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.faceDirection(1);
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +386,10 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
this.position.Y += (float)(this.speed + this.addedSpeed);
|
||||
if (!this.ignoreMovementAnimation)
|
||||
{
|
||||
this.sprite.AnimateDown(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.spriteInformation.setDown(this);
|
||||
this.characterRenderer.Animate(interval,true);
|
||||
//this.spriteInformation.sprite.Animate(time, 0, 3, 1f);
|
||||
//this.sprite.AnimateDown(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.faceDirection(2);
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +414,10 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
this.position.X -= (float)(this.speed + this.addedSpeed);
|
||||
if (!this.ignoreMovementAnimation)
|
||||
{
|
||||
this.sprite.AnimateLeft(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.spriteInformation.setLeft(this);
|
||||
this.characterRenderer.Animate(interval,true);
|
||||
//this.spriteInformation.sprite.Animate(time, 0, 3, 1f);
|
||||
//this.sprite.AnimateLeft(time, (this.speed - 2 + this.addedSpeed) * -25, Utility.isOnScreen(this.getTileLocationPoint(), 1, currentLocation) ? "Cowboy_Footstep" : "");
|
||||
this.faceDirection(3);
|
||||
}
|
||||
}
|
||||
|
@ -250,39 +450,68 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
/// <summary>
|
||||
/// Used to halt the npc sprite. Sets the npc's animation to the standing animation if the character renderer is not null.
|
||||
/// </summary>
|
||||
public override void Halt()
|
||||
{
|
||||
if (this.characterRenderer != null)
|
||||
{
|
||||
this.characterRenderer.setAnimation(AnimationKeys.standingKey);
|
||||
}
|
||||
base.Halt();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to update npc information.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <param name="location"></param>
|
||||
public override void update(GameTime time, GameLocation location)
|
||||
{
|
||||
base.update(time, location);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pathfinding code.
|
||||
/// </summary>
|
||||
/// <param name="who"></param>
|
||||
public virtual void routeEndAnimationFinished(StardewValley.Farmer who)
|
||||
{
|
||||
this.doingEndOfRouteAnimation = false;
|
||||
this.doingEndOfRouteAnimation.Value = false;
|
||||
this.freezeMotion = false;
|
||||
this.sprite.spriteHeight = 32;
|
||||
this.sprite.StopAnimation();
|
||||
this.endOfRouteMessage = (string)null;
|
||||
this.Sprite.SpriteHeight = 32;
|
||||
this.Sprite.StopAnimation();
|
||||
this.endOfRouteMessage.Value = (string)null;
|
||||
this.isCharging = false;
|
||||
this.speed = 2;
|
||||
this.addedSpeed = 0;
|
||||
this.goingToDoEndOfRouteAnimation = false;
|
||||
this.goingToDoEndOfRouteAnimation.Value = false;
|
||||
if (!this.IsWalkingInSquare)
|
||||
return;
|
||||
this.returningToEndPoint = true;
|
||||
this.timeAfterSquare = Game1.timeOfDay;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pathfinding code.
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="l"></param>
|
||||
public virtual void doAnimationAtEndOfScheduleRoute(Character c, GameLocation l)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Pathfinding code.
|
||||
/// </summary>
|
||||
/// <param name="behaviorName"></param>
|
||||
public virtual void startRouteBehavior(string behaviorName)
|
||||
{
|
||||
if (behaviorName.Length > 0 && (int)behaviorName[0] == 34)
|
||||
{
|
||||
this.endOfRouteMessage = behaviorName.Replace("\"", "");
|
||||
this.endOfRouteMessage.Value = behaviorName.Replace("\"", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -295,7 +524,7 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
else
|
||||
{
|
||||
Utility.getGameLocationOfCharacter(this).temporarySprites.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(167, 1714, 19, 14), 100f, 3, 999999, new Vector2(2f, 3f) * (float)Game1.tileSize + new Vector2(7f, 12f) * (float)Game1.pixelZoom, false, false, 0.0002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
|
||||
Utility.getGameLocationOfCharacter(this).temporarySprites.Add(new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Microsoft.Xna.Framework.Rectangle(167, 1714, 19, 14), 100f, 3, 999999, new Vector2(2f, 3f) * (float)Game1.tileSize + new Vector2(7f, 12f) * (float)Game1.pixelZoom, false, false, 0.0002f, 0.0f, Color.White, (float)Game1.pixelZoom, 0.0f, 0.0f, 0.0f, false)
|
||||
{
|
||||
id = 688f
|
||||
});
|
||||
|
@ -305,6 +534,11 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the npc gets hit by the player.
|
||||
/// </summary>
|
||||
/// <param name="who"></param>
|
||||
/// <param name="location"></param>
|
||||
public new void getHitByPlayer(StardewValley.Farmer who, GameLocation location)
|
||||
{
|
||||
this.doEmote(12, true);
|
||||
|
@ -314,9 +548,11 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
return;
|
||||
who = Game1.player;
|
||||
}
|
||||
if (who.friendships.ContainsKey(this.name))
|
||||
if (who.friendshipData.ContainsKey(this.Name))
|
||||
{
|
||||
who.friendships[this.name][0] -= 30;
|
||||
Friendship f;
|
||||
who.friendshipData.TryGetValue(this.Name, out f);
|
||||
f.Points -= 30;
|
||||
if (who.IsMainPlayer)
|
||||
{
|
||||
this.CurrentDialogue.Clear();
|
||||
|
@ -324,7 +560,7 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
//location.debris.Add(new Debris(this.sprite.Texture, Game1.random.Next(3, 8), new Vector2((float)this.GetBoundingBox().Center.X, (float)this.GetBoundingBox().Center.Y)));
|
||||
}
|
||||
if (this.name.Equals("Bouncer"))
|
||||
if (this.Name.Equals("Bouncer"))
|
||||
Game1.playSound("crafting");
|
||||
else
|
||||
Game1.playSound("hitEnemy");
|
||||
|
@ -334,15 +570,15 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
public override void dayUpdate(int dayOfMonth)
|
||||
{
|
||||
if (this.currentLocation != null)
|
||||
Game1.warpCharacter(this, this.defaultMap, this.DefaultPosition / (float)Game1.tileSize, true, false);
|
||||
Game1.player.mailReceived.Remove(this.name);
|
||||
Game1.player.mailReceived.Remove(this.name + "Cooking");
|
||||
this.doingEndOfRouteAnimation = false;
|
||||
Game1.warpCharacter(this, this.DefaultMap, this.DefaultPosition / (float)Game1.tileSize);
|
||||
Game1.player.mailReceived.Remove(this.Name);
|
||||
Game1.player.mailReceived.Remove(this.Name + "Cooking");
|
||||
this.doingEndOfRouteAnimation.Value = false;
|
||||
this.Halt();
|
||||
this.hasBeenKissedToday = false;
|
||||
this.faceTowardFarmer = false;
|
||||
this.faceTowardFarmerTimer = 0;
|
||||
this.drawOffset = Vector2.Zero;
|
||||
this.drawOffset.Value = Vector2.Zero;
|
||||
this.hasSaidAfternoonDialogue = false;
|
||||
this.ignoreScheduleToday = false;
|
||||
this.Halt();
|
||||
|
@ -357,12 +593,13 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
this.lastCrossroad = Microsoft.Xna.Framework.Rectangle.Empty;
|
||||
if (this.isVillager())
|
||||
this.Schedule = this.getSchedule(dayOfMonth);
|
||||
this.endOfRouteMessage = (string)null;
|
||||
this.endOfRouteMessage.Value = (string)null;
|
||||
bool flag = Utility.isFestivalDay(dayOfMonth, Game1.currentSeason);
|
||||
if (!this.isMarried())
|
||||
return;
|
||||
this.marriageDuties();
|
||||
this.daysMarried = this.daysMarried + 1;
|
||||
this.marriageDuties(true);
|
||||
//Friendship f=Game1.player.GetSpouseFriendship();
|
||||
//this.daysMarried = this.daysMarried + 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -379,86 +616,101 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
/// <param name="alpha"></param>
|
||||
public virtual void drawModular(SpriteBatch b, float alpha = 1f)
|
||||
{
|
||||
if (this.characterRenderer == null || this.isInvisible || !Utility.isOnScreen(this.position, 2 * Game1.tileSize))
|
||||
if (this.characterRenderer == null || this.IsInvisible || !Utility.isOnScreen(this.position, 2 * Game1.tileSize))
|
||||
return;
|
||||
//Checks if the npc is swimming. If not draw it's default graphic. Do characters aside from Farmer and Penny Swim???
|
||||
if (this.swimming)
|
||||
if (this.swimming.Value)
|
||||
{
|
||||
this.characterRenderer.setAnimation(AnimationKeys.swimmingKey);
|
||||
this.characterRenderer.setDirection(this.facingDirection);
|
||||
this.characterRenderer.draw(b,this,this.getLocalPosition(Game1.viewport) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize + Game1.tileSize / 4 + this.yJumpOffset * 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero) - new Vector2(0.0f, this.yOffset), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.sprite.SourceRect.X, this.sprite.SourceRect.Y, this.sprite.SourceRect.Width, this.sprite.SourceRect.Height / 2 - (int)((double)this.yOffset / (double)Game1.pixelZoom))), Color.White, this.rotation, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 3 / 2)) / 4f, Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
this.characterRenderer.draw(b,this,this.getLocalPosition(Game1.viewport) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize + Game1.tileSize / 4 + this.yJumpOffset * 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero) - new Vector2(0.0f, this.yOffset), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.Sprite.SourceRect.X, this.Sprite.SourceRect.Y, this.Sprite.SourceRect.Width, this.Sprite.SourceRect.Height / 2 - (int)((double)this.yOffset / (double)Game1.pixelZoom))), Color.White, this.rotation, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 3 / 2)) / 4f, Math.Max(0.2f, this.Scale) * (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, (float)this.getStandingY() / 10000f));
|
||||
//Vector2 localPosition = this.getLocalPosition(Game1.viewport);
|
||||
//b.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle((int)localPosition.X + (int)this.yOffset + Game1.pixelZoom * 2, (int)localPosition.Y - 32 * Game1.pixelZoom + this.sprite.SourceRect.Height * Game1.pixelZoom + Game1.tileSize * 3 / 4 + this.yJumpOffset * 2 - (int)this.yOffset, this.sprite.SourceRect.Width * Game1.pixelZoom - (int)this.yOffset * 2 - Game1.pixelZoom * 4, Game1.pixelZoom), new Microsoft.Xna.Framework.Rectangle?(Game1.staminaRect.Bounds), Color.White * 0.75f, 0.0f, Vector2.Zero, SpriteEffects.None, (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
//FIX THIS LINE WITH LAYER DEPTH!!!
|
||||
//Shadow???
|
||||
//this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
}
|
||||
//If the npc breathes then this code is ran.
|
||||
if (this.breather && this.shakeTimer <= 0 && (!this.swimming && this.sprite.CurrentFrame < 16) && !this.farmerPassesThrough)
|
||||
if (this.Breather && this.shakeTimer <= 0 && (!this.swimming.Value && this.Sprite.CurrentFrame < 16) && !this.farmerPassesThrough)
|
||||
{
|
||||
Microsoft.Xna.Framework.Rectangle sourceRect = this.sprite.SourceRect;
|
||||
sourceRect.Y += this.sprite.spriteHeight / 2 + this.sprite.spriteHeight / 32;
|
||||
sourceRect.Height = this.sprite.spriteHeight / 4;
|
||||
sourceRect.X += this.sprite.spriteWidth / 4;
|
||||
sourceRect.Width = this.sprite.spriteWidth / 2;
|
||||
Vector2 vector2 = new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(Game1.tileSize / 8));
|
||||
if (this.age == 2)
|
||||
Microsoft.Xna.Framework.Rectangle sourceRect = this.Sprite.SourceRect;
|
||||
sourceRect.Y += this.Sprite.SpriteHeight / 2 + this.Sprite.SpriteHeight / 32;
|
||||
sourceRect.Height = this.Sprite.SpriteHeight / 4;
|
||||
sourceRect.X += this.Sprite.SpriteWidth / 4;
|
||||
sourceRect.Width = this.Sprite.SpriteWidth / 2;
|
||||
Vector2 vector2 = new Vector2((float)(this.Sprite.SpriteWidth * Game1.pixelZoom / 2), (float)(Game1.tileSize / 8));
|
||||
if (this.Age == 2)
|
||||
{
|
||||
sourceRect.Y += this.sprite.spriteHeight / 6 + 1;
|
||||
sourceRect.Y += this.Sprite.SpriteHeight / 6 + 1;
|
||||
sourceRect.Height /= 2;
|
||||
vector2.Y += (float)(this.sprite.spriteHeight / 8 * Game1.pixelZoom);
|
||||
vector2.Y += (float)(this.Sprite.SpriteHeight / 8 * Game1.pixelZoom);
|
||||
}
|
||||
else if (this.gender == 1)
|
||||
else if (this.Gender == 1)
|
||||
{
|
||||
++sourceRect.Y;
|
||||
vector2.Y -= (float)Game1.pixelZoom;
|
||||
sourceRect.Height /= 2;
|
||||
}
|
||||
float num = Math.Max(0.0f, (float)(Math.Ceiling(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 600.0 + (double)this.DefaultPosition.X * 20.0)) / 4.0));
|
||||
this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
//The actual character drawing to the screen?
|
||||
this.characterRenderer.draw(b, this, this.getLocalPosition(Game1.viewport) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation,Vector2.Zero, Math.Max(0.2f, this.Scale), this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
//this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
//this.characterRenderer.draw(b, this, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, .99f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//float num = Math.Max(0.0f, (float)(Math.Ceiling(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 600.0 + (double)this.DefaultPosition.X * 20.0)) / 4.0));
|
||||
this.characterRenderer.draw(b, this, this.getLocalPosition(Game1.viewport) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle()), Color.White * alpha, this.rotation, Vector2.Zero, Math.Max(0.2f, this.Scale), this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
}
|
||||
|
||||
//Checks if the npc is glowing.
|
||||
if (this.isGlowing)
|
||||
this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), this.glowingColor * this.glowingTransparency, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * 4f, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.99f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.Sprite.SpriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), this.glowingColor * this.glowingTransparency, this.rotation, new Vector2((float)(this.Sprite.SpriteWidth / 2), (float)((double)this.Sprite.SpriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.Scale) * 4f, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.99f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
|
||||
//This code runs if the npc is emoting.
|
||||
if (!this.IsEmoting || Game1.eventUp)
|
||||
return;
|
||||
Vector2 localPosition1 = this.getLocalPosition(Game1.viewport);
|
||||
localPosition1.Y -= (float)(Game1.tileSize / 2 + this.sprite.spriteHeight * Game1.pixelZoom);
|
||||
localPosition1.Y -= (float)(Game1.tileSize / 2 + this.Sprite.SpriteHeight * Game1.pixelZoom);
|
||||
b.Draw(Game1.emoteSpriteSheet, localPosition1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.CurrentEmoteIndex * 16 % Game1.emoteSpriteSheet.Width, this.CurrentEmoteIndex * 16 / Game1.emoteSpriteSheet.Width * 16, 16, 16)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)this.getStandingY() / 10000f);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite without the modular npc renderer
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="alpha"></param>
|
||||
public virtual void drawNonModularSprite(SpriteBatch b, float alpha = 1f)
|
||||
{
|
||||
if (this.sprite == null || this.isInvisible || !Utility.isOnScreen(this.position, 2 * Game1.tileSize))
|
||||
if (this.Sprite == null || this.IsInvisible || !Utility.isOnScreen(this.position, 2 * Game1.tileSize))
|
||||
return;
|
||||
if (this.swimming)
|
||||
|
||||
//Swimming just has a height difference on the sprite.
|
||||
if (this.swimming.Value)
|
||||
{
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize + Game1.tileSize / 4 + this.yJumpOffset * 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero) - new Vector2(0.0f, this.yOffset), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.sprite.SourceRect.X, this.sprite.SourceRect.Y, this.sprite.SourceRect.Width, this.sprite.SourceRect.Height / 2 - (int)((double)this.yOffset / (double)Game1.pixelZoom))), Color.White, this.rotation, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 3 / 2)) / 4f, Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize + Game1.tileSize / 4 + this.yJumpOffset * 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero) - new Vector2(0.0f, this.yOffset), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.Sprite.SourceRect.X, this.Sprite.SourceRect.Y, this.Sprite.SourceRect.Width, this.Sprite.SourceRect.Height / 2 - (int)((double)this.yOffset / (double)Game1.pixelZoom))), Color.White, this.rotation, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 3 / 2)) / 4f, Math.Max(0.2f, this.Scale) * (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
Vector2 localPosition = this.getLocalPosition(Game1.viewport);
|
||||
//b.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle((int)localPosition.X + (int)this.yOffset + Game1.pixelZoom * 2, (int)localPosition.Y - 32 * Game1.pixelZoom + this.sprite.SourceRect.Height * Game1.pixelZoom + Game1.tileSize * 3 / 4 + this.yJumpOffset * 2 - (int)this.yOffset, this.sprite.SourceRect.Width * Game1.pixelZoom - (int)this.yOffset * 2 - Game1.pixelZoom * 4, Game1.pixelZoom), new Microsoft.Xna.Framework.Rectangle?(Game1.staminaRect.Bounds), Color.White * 0.75f, 0.0f, Vector2.Zero, SpriteEffects.None, (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0));
|
||||
}
|
||||
else
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
if (this.breather && this.shakeTimer <= 0 && (!this.swimming && this.sprite.CurrentFrame < 16) && !this.farmerPassesThrough)
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.Sprite.SpriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.Sprite.SpriteWidth / 2), (float)((double)this.Sprite.SpriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.Scale) * (float)Game1.pixelZoom, this.flip || this.Sprite.currentAnimation != null && this.Sprite.currentAnimation[this.Sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
|
||||
if (this.Breather && this.shakeTimer <= 0 && (!this.swimming.Value && this.Sprite.CurrentFrame < 16) && !this.farmerPassesThrough)
|
||||
{
|
||||
Microsoft.Xna.Framework.Rectangle sourceRect = this.sprite.SourceRect;
|
||||
sourceRect.Y += this.sprite.spriteHeight / 2 + this.sprite.spriteHeight / 32;
|
||||
sourceRect.Height = this.sprite.spriteHeight / 4;
|
||||
sourceRect.X += this.sprite.spriteWidth / 4;
|
||||
sourceRect.Width = this.sprite.spriteWidth / 2;
|
||||
Vector2 vector2 = new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(Game1.tileSize / 8));
|
||||
if (this.age == 2)
|
||||
Microsoft.Xna.Framework.Rectangle sourceRect = this.Sprite.SourceRect;
|
||||
sourceRect.Y += this.Sprite.SpriteHeight / 2 + this.Sprite.SpriteHeight / 32;
|
||||
sourceRect.Height = this.Sprite.SpriteHeight / 4;
|
||||
sourceRect.X += this.Sprite.SpriteWidth / 4;
|
||||
sourceRect.Width = this.Sprite.SpriteWidth / 2;
|
||||
Vector2 vector2 = new Vector2((float)(this.Sprite.SpriteWidth * Game1.pixelZoom / 2), (float)(Game1.tileSize / 8));
|
||||
if (this.Age == 2)
|
||||
{
|
||||
sourceRect.Y += this.sprite.spriteHeight / 6 + 1;
|
||||
sourceRect.Y += this.Sprite.SpriteHeight / 6 + 1;
|
||||
sourceRect.Height /= 2;
|
||||
vector2.Y += (float)(this.sprite.spriteHeight / 8 * Game1.pixelZoom);
|
||||
vector2.Y += (float)(this.Sprite.SpriteHeight / 8 * Game1.pixelZoom);
|
||||
}
|
||||
else if (this.gender == 1)
|
||||
else if (this.Gender == 1)
|
||||
{
|
||||
++sourceRect.Y;
|
||||
vector2.Y -= (float)Game1.pixelZoom;
|
||||
|
@ -466,16 +718,21 @@ namespace CustomNPCFramework.Framework.NPCS
|
|||
}
|
||||
float num = Math.Max(0.0f, (float)(Math.Ceiling(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 600.0 + (double)this.DefaultPosition.X * 20.0)) / 4.0));
|
||||
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.Scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
}
|
||||
if (this.isGlowing)
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), this.glowingColor * this.glowingTransparency, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * 4f, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.99f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.Sprite.SpriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), this.glowingColor * this.glowingTransparency, this.rotation, new Vector2((float)(this.Sprite.SpriteWidth / 2), (float)((double)this.Sprite.SpriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.Scale) * 4f, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.99f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
|
||||
Vector2 localPosition1 = this.getLocalPosition(Game1.viewport);
|
||||
localPosition1.Y -= (float)(Game1.tileSize / 2 + this.sprite.spriteHeight * Game1.pixelZoom);
|
||||
localPosition1.Y -= (float)(Game1.tileSize / 2 + this.Sprite.SpriteHeight * Game1.pixelZoom);
|
||||
//b.Draw(Game1.emoteSpriteSheet, localPosition1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.CurrentEmoteIndex * 16 % Game1.emoteSpriteSheet.Width, this.CurrentEmoteIndex * 16 / Game1.emoteSpriteSheet.Width * 16, 16, 16)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)this.getStandingY() / 10000f);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Basic draw functionality to checkn whether or not to draw the npc using it's default sprite or using a custom character renderer.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="alpha"></param>
|
||||
public override void draw(SpriteBatch b, float alpha = 1f)
|
||||
{
|
||||
if (this.characterRenderer == null)
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.NPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// Extended merchant npc from ExtendedNPC.
|
||||
/// </summary>
|
||||
class MerchantNPC: ExtendedNPC
|
||||
{
|
||||
/// <summary>
|
||||
/// Thelist of items this npc has for sale.
|
||||
/// </summary>
|
||||
public List<Item> stock;
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="Stock">The list of items this npc will sell.</param>
|
||||
/// <param name="sprite">The sprite for the npc to use.</param>
|
||||
/// <param name="renderer">The renderer for the npc to use.</param>
|
||||
/// <param name="position">The position for the npc to use.</param>
|
||||
/// <param name="facingDirection">The facing direction for the player to face.</param>
|
||||
/// <param name="name">The name for the npc.</param>
|
||||
public MerchantNPC(List<Item> Stock, Sprite sprite, BasicRenderer renderer,Vector2 position,int facingDirection,string name): base(sprite,renderer,position,facingDirection,name)
|
||||
{
|
||||
this.stock = Stock;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="Stock">The list of items for the npc to sell.</param>
|
||||
/// <param name="npcBase">The npc base for the character to be expanded upon.</param>
|
||||
public MerchantNPC(List<Item> Stock, ExtendedNPC npcBase) : base(npcBase.spriteInformation, npcBase.characterRenderer, npcBase.portraitInformation, npcBase.position, npcBase.facingDirection, npcBase.Name)
|
||||
{
|
||||
this.stock = Stock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to interact with the npc. When interacting pulls up a shop menu for the npc with their current stock.
|
||||
/// </summary>
|
||||
/// <param name="who"></param>
|
||||
/// <param name="l"></param>
|
||||
/// <returns></returns>
|
||||
public override bool checkAction(StardewValley.Farmer who, GameLocation l)
|
||||
{
|
||||
if (Game1.activeClickableMenu == null)
|
||||
{
|
||||
Game1.activeClickableMenu = new StardewValley.Menus.ShopMenu(this.stock);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.checkAction(Game1.player, Game1.player.currentLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to keep track of all of the custom npcs.
|
||||
/// </summary>
|
||||
public class NPCTracker
|
||||
{
|
||||
/// <summary>
|
||||
/// A list used to keep track of the npcs.
|
||||
/// </summary>
|
||||
public List<ExtendedNPC> moddedNPCS;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public NPCTracker()
|
||||
{
|
||||
this.moddedNPCS = new List<ExtendedNPC>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to add a new npc into the game.
|
||||
/// </summary>
|
||||
/// <param name="loc">The game location to add the npc to.</param>
|
||||
/// <param name="npc">The extended npc to add to the location.</param>
|
||||
public void addNewNPCToLocation(GameLocation loc,ExtendedNPC npc)
|
||||
{
|
||||
this.moddedNPCS.Add(npc);
|
||||
npc.defaultLocation = loc;
|
||||
npc.currentLocation = loc;
|
||||
loc.addCharacter(npc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a npc to a location.
|
||||
/// </summary>
|
||||
/// <param name="loc">The game location to add an npc to.</param>
|
||||
/// <param name="npc">The extended npc to add to the location.</param>
|
||||
/// <param name="tilePosition">The tile position at the game location to add the mpc to.</param>
|
||||
public void addNewNPCToLocation(GameLocation loc, ExtendedNPC npc, Vector2 tilePosition)
|
||||
{
|
||||
this.moddedNPCS.Add(npc);
|
||||
npc.defaultLocation = loc;
|
||||
npc.currentLocation = loc;
|
||||
npc.position.Value = tilePosition*Game1.tileSize;
|
||||
loc.addCharacter(npc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this simply to remove a single npc from a location.
|
||||
/// </summary>
|
||||
/// <param name="loc"></param>
|
||||
/// <param name="npc"></param>
|
||||
public void removeCharacterFromLocation(GameLocation loc, ExtendedNPC npc)
|
||||
{
|
||||
loc.characters.Remove(npc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to completly remove and npc from the game as it is removed from the location and is no longer tracked.
|
||||
/// </summary>
|
||||
/// <param name="npc">The npc to remove from the location.</param>
|
||||
public void removeFromLocationAndTrackingList(ExtendedNPC npc)
|
||||
{
|
||||
if (npc.currentLocation != null)
|
||||
{
|
||||
npc.currentLocation.characters.Remove(npc);
|
||||
}
|
||||
this.moddedNPCS.Remove(npc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to clean up all of the npcs before the game is saved.
|
||||
/// </summary>
|
||||
public void cleanUpBeforeSave()
|
||||
{
|
||||
foreach(ExtendedNPC npc in this.moddedNPCS)
|
||||
{
|
||||
//npc.currentLocation.characters.Remove(npc);
|
||||
//Game1.removeThisCharacterFromAllLocations(npc);
|
||||
Game1.removeCharacterFromItsLocation(npc.Name);
|
||||
Class1.ModMonitor.Log("Removed an npc!");
|
||||
//Do some saving code here.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to load in all of the npcs again after saving.
|
||||
/// </summary>
|
||||
public void afterSave()
|
||||
{
|
||||
foreach(ExtendedNPC npc in this.moddedNPCS)
|
||||
{
|
||||
npc.defaultLocation.addCharacter(npc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 330 B |
After Width: | Height: | Size: 302 B |
After Width: | Height: | Size: 569 B |
After Width: | Height: | Size: 540 B |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 520 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 330 B |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"gender": 1,
|
||||
"seasons": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"type": 0,
|
||||
"assetName": "VanillaFemaleBodyBase",
|
||||
"standingAssetPaths": {
|
||||
"leftString": "FBodyBaseLeft",
|
||||
"rightString": "FBodyBaseRight",
|
||||
"upString": "FBodyBaseUp",
|
||||
"downString": "FBodyBaseDown"
|
||||
},
|
||||
"swimmingAssetPaths": {
|
||||
"leftString": "FBodyBaseLeft",
|
||||
"rightString": "FBodyBaseRight",
|
||||
"upString": "FBodyBaseUp",
|
||||
"downString": "FBodyBaseDown"
|
||||
},
|
||||
"movingAssetPaths": {
|
||||
"leftString": "FBodyBaseMovingLeft",
|
||||
"rightString": "FBodyBaseMovingRight",
|
||||
"upString": "FBodyBaseMovingUp",
|
||||
"downString": "FBodyBaseMovingDown"
|
||||
},
|
||||
"sittingAssetPaths": {
|
||||
"leftString": "FBodyBaseLeft",
|
||||
"rightString": "FBodyBaseRight",
|
||||
"upString": "FBodyBaseUp",
|
||||
"downString": "FBodyBaseDown"
|
||||
},
|
||||
"assetSize": "16, 32",
|
||||
"randomizeUponLoad": false
|
||||
}
|
After Width: | Height: | Size: 293 B |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"gender": 1,
|
||||
"seasons": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"type": 4,
|
||||
"assetName": "VanillaGreyPants",
|
||||
"standingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"swimmingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"movingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"sittingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"assetSize": "16, 32",
|
||||
"randomizeUponLoad": false
|
||||
}
|
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 289 B |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"gender": 1,
|
||||
"seasons": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"type": 1,
|
||||
"assetName": "VanillaBrownEyes",
|
||||
"standingAssetPaths": {
|
||||
"leftString": "EyesLeft",
|
||||
"rightString": "EyesRight",
|
||||
"upString": "EyesUp",
|
||||
"downString": "EyesDown"
|
||||
},
|
||||
"swimmingAssetPaths": {
|
||||
"leftString": "EyesLeft",
|
||||
"rightString": "EyesRight",
|
||||
"upString": "EyesUp",
|
||||
"downString": "EyesDown"
|
||||
},
|
||||
"movingAssetPaths": {
|
||||
"leftString": "EyesLeft",
|
||||
"rightString": "EyesRight",
|
||||
"upString": "EyesUp",
|
||||
"downString": "EyesDown"
|
||||
},
|
||||
"sittingAssetPaths": {
|
||||
"leftString": "EyesLeft",
|
||||
"rightString": "EyesRight",
|
||||
"upString": "EyesUp",
|
||||
"downString": "EyesDown"
|
||||
},
|
||||
"assetSize": "16, 32",
|
||||
"randomizeUponLoad": false
|
||||
}
|
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 271 B |
After Width: | Height: | Size: 224 B |
After Width: | Height: | Size: 314 B |
After Width: | Height: | Size: 312 B |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"gender": 1,
|
||||
"seasons": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"type": 2,
|
||||
"assetName": "VanillaPigTails",
|
||||
"standingAssetPaths": {
|
||||
"leftString": "LeftHairStyle",
|
||||
"rightString": "RightHairStyle",
|
||||
"upString": "UpHairStyle",
|
||||
"downString": "DownHairStyle"
|
||||
},
|
||||
"swimmingAssetPaths": {
|
||||
"leftString": "LeftHairStyle",
|
||||
"rightString": "RightHairStyle",
|
||||
"upString": "UpHairStyle",
|
||||
"downString": "DownHairStyle"
|
||||
},
|
||||
"movingAssetPaths": {
|
||||
"leftString": "LeftHairStyle",
|
||||
"rightString": "RightHairStyle",
|
||||
"upString": "UpHairStyle",
|
||||
"downString": "DownHairStyle"
|
||||
},
|
||||
"sittingAssetPaths": {
|
||||
"leftString": "LeftHairStyle",
|
||||
"rightString": "RightHairStyle",
|
||||
"upString": "UpHairStyle",
|
||||
"downString": "DownHairStyle"
|
||||
},
|
||||
"assetSize": "16, 32",
|
||||
"randomizeUponLoad": false
|
||||
}
|
After Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 282 B |
|
@ -0,0 +1,2 @@
|
|||
Hairstyles seem to allow for a maximum of three pixels from the adverage top of the hairstyle to the starting of a hairstyle.
|
||||
This allows for things like volume and depth of view for ponytales that rise above the typical height of a head.
|
After Width: | Height: | Size: 326 B |
After Width: | Height: | Size: 305 B |
After Width: | Height: | Size: 299 B |
After Width: | Height: | Size: 306 B |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"gender": 1,
|
||||
"seasons": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"type": 3,
|
||||
"assetName": "VanillaPinkShirt",
|
||||
"standingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"swimmingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"movingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"sittingAssetPaths": {
|
||||
"leftString": "LeftFacing",
|
||||
"rightString": "RightFacing",
|
||||
"upString": "UpFacing",
|
||||
"downString": "DownFacing"
|
||||
},
|
||||
"assetSize": "16, 32",
|
||||
"randomizeUponLoad": false
|
||||
}
|
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 388 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 288 B |
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"gender": 1,
|
||||
"seasons": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
],
|
||||
"type": 5,
|
||||
"assetName": "VanillaBrownShoes",
|
||||
"standingAssetPaths": {
|
||||
"leftString": "LeftStanding",
|
||||
"rightString": "RightStanding",
|
||||
"upString": "UpStanding",
|
||||
"downString": "DownStanding"
|
||||
},
|
||||
"swimmingAssetPaths": {
|
||||
"leftString": "LeftStanding",
|
||||
"rightString": "RightStanding",
|
||||
"upString": "UpStanding",
|
||||
"downString": "DownStanding"
|
||||
},
|
||||
"movingAssetPaths": {
|
||||
"leftString": "LeftMoving",
|
||||
"rightString": "RightMoving",
|
||||
"upString": "UpMoving",
|
||||
"downString": "DownMoving"
|
||||
},
|
||||
"sittingAssetPaths": {
|
||||
"leftString": "LeftStanding",
|
||||
"rightString": "RightStanding",
|
||||
"upString": "UpStanding",
|
||||
"downString": "DownStanding"
|
||||
},
|
||||
"assetSize": "16, 32",
|
||||
"randomizeUponLoad": false
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
|
||||
</packages>
|