commit
6330b495f2
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,87 @@
|
|||
using CustomNPCFramework.Framework.Graphics;
|
||||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework
|
||||
{
|
||||
public class Class1 : Mod
|
||||
{
|
||||
public static IModHelper ModHelper;
|
||||
public static IMonitor ModMonitor;
|
||||
public static AssetManager assetManager;
|
||||
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.GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||
}
|
||||
|
||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||
{
|
||||
if (Game1.player.currentLocation == null) return;
|
||||
foreach (var v in Game1.player.currentLocation.characters)
|
||||
{
|
||||
v.speed = 5;
|
||||
//v.MovePosition(Game1.currentGameTime, Game1.viewport, Game1.player.currentLocation);
|
||||
ModMonitor.Log(v.sprite.spriteHeight.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void initializeExamples()
|
||||
{
|
||||
string dirPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Templates");
|
||||
assetManager.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);
|
||||
}
|
||||
|
||||
public static string getShortenedDirectory(string path)
|
||||
{
|
||||
string lol = (string)path.Clone();
|
||||
string[] spliter = lol.Split(new string[] { ModHelper.DirectoryPath },StringSplitOptions.None);
|
||||
return spliter[1];
|
||||
}
|
||||
|
||||
public static string getRelativeDirectory(string path)
|
||||
{
|
||||
string s = getShortenedDirectory(path);
|
||||
return s.Remove(0, 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{89C7DF45-8AE5-49AC-ADA9-6312E9590829}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CustomNPCFramework</RootNamespace>
|
||||
<AssemblyName>CustomNPCFramework</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetInfo.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetManager.cs" />
|
||||
<Compile Include="Framework\Graphics\AssetSheet.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\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\NPCS\ExtendedNPC.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<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')" />
|
||||
<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'))" />
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,47 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
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.
|
||||
/// </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)
|
||||
{
|
||||
this.name = name;
|
||||
this.assetSize = assetSize;
|
||||
this.randomizeUponLoad = randomizeUponLoad;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save the json to a certain location.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void writeToJson(string path)
|
||||
{
|
||||
Class1.ModHelper.WriteJsonFile<AssetInfo>(path, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the json from a certain location.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static AssetInfo readFromJson(string path)
|
||||
{
|
||||
return Class1.ModHelper.ReadJsonFile<AssetInfo>(path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.Graphics
|
||||
{
|
||||
public class AssetManager
|
||||
{
|
||||
public List<AssetSheet> assets;
|
||||
public Dictionary<string,string> paths;
|
||||
|
||||
/// <summary>
|
||||
/// Basic constructor.
|
||||
/// </summary>
|
||||
public AssetManager()
|
||||
{
|
||||
this.assets = new List<AssetSheet>();
|
||||
this.paths = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default loading function from 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an asset to be handled from the asset manager.
|
||||
/// </summary>
|
||||
/// <param name="asset"></param>
|
||||
public void addAsset(AssetSheet asset)
|
||||
{
|
||||
this.assets.Add(asset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an individual asset by its name.
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <returns></returns>
|
||||
public AssetSheet getAssetByName(string s)
|
||||
{
|
||||
foreach(var v in assets)
|
||||
{
|
||||
if (v.assetInfo.name == s) return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new path to the asset manager and create the directory for it.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void addPathCreateDirectory(KeyValuePair<string,string> path)
|
||||
{
|
||||
this.addPath(path);
|
||||
string dir = Path.Combine(Class1.ModHelper.DirectoryPath, path.Value);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(Class1.ModHelper.DirectoryPath, path.Value));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a path to the dictionary.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
private void addPath(KeyValuePair<string,string> path)
|
||||
{
|
||||
this.paths.Add(path.Key, path.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create appropriate directories for the path.
|
||||
/// </summary>
|
||||
private void createDirectoriesFromPaths()
|
||||
{
|
||||
foreach(var v in paths)
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(Class1.ModHelper.DirectoryPath,v.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
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 handle loading different textures and handling opperations on those textures.
|
||||
/// </summary>
|
||||
public class AssetSheet
|
||||
{
|
||||
public Texture2D texture;
|
||||
public AssetInfo assetInfo;
|
||||
public string path;
|
||||
|
||||
public int index;
|
||||
|
||||
private int widthIndex;
|
||||
private int heightIndex;
|
||||
private int widthIndexMax;
|
||||
private int heightIndexMax;
|
||||
|
||||
public Rectangle currentAsset;
|
||||
|
||||
public AssetSheet(AssetInfo info,string path)
|
||||
{
|
||||
this.assetInfo = info;
|
||||
this.texture = Class1.ModHelper.Content.Load<Texture2D>(Class1.getShortenedDirectory(Path.Combine(path,info.name+".png")).Remove(0,1));
|
||||
|
||||
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 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()
|
||||
{
|
||||
var asset = new AssetSheet(this.assetInfo,(string)this.path.Clone());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
public class AnimatedSpriteCollection
|
||||
{
|
||||
AnimatedSpriteExtended leftSprite;
|
||||
AnimatedSpriteExtended rightSprite;
|
||||
AnimatedSpriteExtended upSprite;
|
||||
AnimatedSpriteExtended downSprite;
|
||||
|
||||
public AnimatedSpriteExtended currentSprite;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="LeftSprite">Left animated sprite for this piece.</param>
|
||||
/// <param name="RightSprite">Right animated sprite for this piece.</param>
|
||||
/// <param name="UpSprite">Up animated sprite for this piece.</param>
|
||||
/// <param name="DownSprite">Down animated sprite for this piece.</param>
|
||||
/// <param name="startingSpriteDirection"></param>
|
||||
public AnimatedSpriteCollection(AnimatedSpriteExtended LeftSprite,AnimatedSpriteExtended RightSprite,AnimatedSpriteExtended UpSprite,AnimatedSpriteExtended DownSprite,Direction startingSpriteDirection)
|
||||
{
|
||||
this.leftSprite = LeftSprite;
|
||||
this.rightSprite = RightSprite;
|
||||
this.upSprite = UpSprite;
|
||||
this.downSprite = DownSprite;
|
||||
if (startingSpriteDirection == Direction.down)
|
||||
{
|
||||
setDown();
|
||||
}
|
||||
if (startingSpriteDirection == Direction.left)
|
||||
{
|
||||
setLeft();
|
||||
}
|
||||
if (startingSpriteDirection == Direction.right)
|
||||
{
|
||||
setRight();
|
||||
}
|
||||
if (startingSpriteDirection == Direction.up)
|
||||
{
|
||||
setUp();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void reload()
|
||||
{
|
||||
this.leftSprite.reload();
|
||||
this.rightSprite.reload();
|
||||
this.upSprite.reload();
|
||||
this.downSprite.reload();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current
|
||||
/// </summary>
|
||||
public void setLeft()
|
||||
{
|
||||
this.currentSprite = leftSprite;
|
||||
}
|
||||
|
||||
public void setRight()
|
||||
{
|
||||
this.currentSprite = rightSprite;
|
||||
}
|
||||
|
||||
public void setDown()
|
||||
{
|
||||
this.currentSprite = downSprite;
|
||||
}
|
||||
|
||||
public void setUp()
|
||||
{
|
||||
this.currentSprite = upSprite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
public void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
|
||||
{
|
||||
b.Draw(this.currentSprite.sprite.Texture, screenPosition, new Rectangle?(this.currentSprite.sprite.sourceRect), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, this.currentSprite.sprite.currentAnimation == null || !this.currentSprite.sprite.currentAnimation[this.currentSprite.sprite.currentAnimationIndex].flip ? SpriteEffects.None : SpriteEffects.FlipHorizontally, layerDepth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
/// <param name="xOffset"></param>
|
||||
/// <param name="yOffset"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="flip"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A very verbose asset drawer.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="npc"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="sourceRectangle"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="alpha"></param>
|
||||
/// <param name="origin"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="effects"></param>
|
||||
/// <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);
|
||||
//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));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Animate the current sprite. Theoreticlly works from index offset to how many frames
|
||||
/// </summary>
|
||||
/// <param name="intervalFromCharacter"></param>
|
||||
public void Animate(float intervalFromCharacter)
|
||||
{
|
||||
this.currentSprite.sprite.Animate(Game1.currentGameTime, 0,3, intervalFromCharacter);
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
this.currentSprite.sprite.Animate(Game1.currentGameTime, startFrame, endFrame, intervalFromCharacter);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
public class AnimatedSpriteExtended
|
||||
{
|
||||
public AnimatedSprite sprite;
|
||||
public string path;
|
||||
|
||||
|
||||
|
||||
/// <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)
|
||||
{
|
||||
this.path = Class1.getRelativeDirectory(path);
|
||||
this.sprite=new AnimatedSprite(Class1.ModHelper.Content.Load<Texture2D>(this.path),currentFrame,spriteWidth,spriteHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the asset from disk.
|
||||
/// </summary>
|
||||
public void reload()
|
||||
{
|
||||
this.sprite.Texture = Class1.ModHelper.Content.Load<Texture2D>(this.path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
public class CharacterAnimationBase
|
||||
{
|
||||
|
||||
public CharacterAnimationBase()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void setLeft()
|
||||
{
|
||||
}
|
||||
public virtual void setRight()
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void setUp()
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void setDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void reload()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Animate(float animationInterval)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
public virtual void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
/// <param name="xOffset"></param>
|
||||
/// <param name="yOffset"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="flip"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="characterSourceRectOffset"></param>
|
||||
public virtual 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A very verbose asset drawer.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="npc"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="sourceRectangle"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="alpha"></param>
|
||||
/// <param name="origin"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="effects"></param>
|
||||
/// <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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases
|
||||
{
|
||||
public class StandardCharacterAnimation :CharacterAnimationBase
|
||||
{
|
||||
public AnimatedSpriteCollection hair;
|
||||
public AnimatedSpriteCollection body;
|
||||
public AnimatedSpriteCollection eyes;
|
||||
public AnimatedSpriteCollection shirt;
|
||||
public AnimatedSpriteCollection pants;
|
||||
public AnimatedSpriteCollection shoes;
|
||||
public List<AnimatedSpriteCollection> accessories;
|
||||
|
||||
public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List<AnimatedSpriteCollection> accessoriesWithAnimations) :base()
|
||||
{
|
||||
this.body = bodyAnimation;
|
||||
this.hair = hairAnimation;
|
||||
this.eyes = eyeAnimation;
|
||||
this.shirt = shirtAnimation;
|
||||
this.pants = pantsAnimation;
|
||||
this.shoes = shoesAnimation;
|
||||
this.accessories = accessoriesWithAnimations;
|
||||
}
|
||||
|
||||
public override void setLeft()
|
||||
{
|
||||
this.body.setLeft();
|
||||
this.hair.setLeft();
|
||||
this.eyes.setLeft();
|
||||
this.shirt.setLeft();
|
||||
this.pants.setLeft();
|
||||
this.shoes.setLeft();
|
||||
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.setLeft();
|
||||
}
|
||||
}
|
||||
public override void setRight()
|
||||
{
|
||||
this.body.setRight();
|
||||
this.hair.setRight();
|
||||
this.eyes.setRight();
|
||||
this.shirt.setRight();
|
||||
this.pants.setRight();
|
||||
this.shoes.setRight();
|
||||
|
||||
foreach (var accessory in this.accessories)
|
||||
{
|
||||
accessory.setRight();
|
||||
}
|
||||
}
|
||||
public override void setUp()
|
||||
{
|
||||
this.body.setUp();
|
||||
this.hair.setUp();
|
||||
this.eyes.setUp();
|
||||
this.shirt.setUp();
|
||||
this.pants.setUp();
|
||||
this.shoes.setUp();
|
||||
|
||||
foreach (var accessory in this.accessories)
|
||||
{
|
||||
accessory.setUp();
|
||||
}
|
||||
}
|
||||
public override void setDown()
|
||||
{
|
||||
this.body.setDown();
|
||||
this.hair.setDown();
|
||||
this.eyes.setDown();
|
||||
this.shirt.setDown();
|
||||
this.pants.setDown();
|
||||
this.shoes.setDown();
|
||||
|
||||
foreach (var accessory in this.accessories)
|
||||
{
|
||||
accessory.setDown();
|
||||
}
|
||||
}
|
||||
|
||||
public override void reload()
|
||||
{
|
||||
this.body.reload();
|
||||
this.hair.reload();
|
||||
this.eyes.reload();
|
||||
this.shirt.reload();
|
||||
this.pants.reload();
|
||||
this.shoes.reload();
|
||||
}
|
||||
|
||||
public override void Animate(float animationInterval)
|
||||
{
|
||||
this.body.Animate(animationInterval);
|
||||
this.hair.Animate(animationInterval);
|
||||
this.eyes.Animate(animationInterval);
|
||||
this.shirt.Animate(animationInterval);
|
||||
this.pants.Animate(animationInterval);
|
||||
this.shoes.Animate(animationInterval);
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.Animate(animationInterval);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
public override void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
|
||||
{
|
||||
this.body.draw(b,screenPosition,layerDepth);
|
||||
this.hair.draw(b, screenPosition, layerDepth);
|
||||
this.eyes.draw(b, screenPosition, layerDepth);
|
||||
this.shirt.draw(b, screenPosition, layerDepth);
|
||||
this.pants.draw(b, screenPosition, layerDepth);
|
||||
this.shoes.draw(b, screenPosition, layerDepth);
|
||||
foreach (var accessory in this.accessories)
|
||||
{
|
||||
accessory.draw(b, screenPosition, layerDepth);
|
||||
}
|
||||
//b.Draw(this.currentSprite.Texture, screenPosition, new Rectangle?(this.currentSprite.sourceRect), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, this.currentSprite.currentAnimation == null || !this.currentSprite.currentAnimation[this.currentSprite.currentAnimationIndex].flip ? SpriteEffects.None : SpriteEffects.FlipHorizontally, layerDepth);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
/// <param name="xOffset"></param>
|
||||
/// <param name="yOffset"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="flip"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="characterSourceRectOffset"></param>
|
||||
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);
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A very verbose asset drawer.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="npc"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="sourceRectangle"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="alpha"></param>
|
||||
/// <param name="origin"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="effects"></param>
|
||||
/// <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);
|
||||
foreach(var accessory in this.accessories)
|
||||
{
|
||||
accessory.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
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
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
||||
{
|
||||
class AnimationKeys
|
||||
{
|
||||
public static string standingKey = "standing";
|
||||
public static string walkingKey = "walking";
|
||||
public static string sittingKey = "sitting";
|
||||
public static string swimmingKey = "swimming";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases;
|
||||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
|
||||
{
|
||||
public class BasicRenderer
|
||||
{
|
||||
public Dictionary<string, StandardCharacterAnimation> animationList;
|
||||
public StandardCharacterAnimation currentAnimation;
|
||||
|
||||
public BasicRenderer(StandardCharacterAnimation standingAnimation,StandardCharacterAnimation walkingAnimation, StandardCharacterAnimation swimmingAnimation)
|
||||
{
|
||||
animationList = new Dictionary<string, StandardCharacterAnimation>();
|
||||
animationList.Add(AnimationKeys.standingKey, standingAnimation);
|
||||
animationList.Add(AnimationKeys.walkingKey, walkingAnimation);
|
||||
animationList.Add(AnimationKeys.swimmingKey, swimmingAnimation);
|
||||
setAnimation(AnimationKeys.standingKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the animation associated with the key name; If it fails the npc will just default to standing.
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
public virtual void setAnimation(string key)
|
||||
{
|
||||
this.currentAnimation = animationList[key];
|
||||
if (this.currentAnimation == null) this.setAnimation(AnimationKeys.standingKey);
|
||||
}
|
||||
|
||||
public virtual void setDirection(int facingDirection)
|
||||
{
|
||||
if (facingDirection == 0) setUp();
|
||||
if (facingDirection == 1) setRight();
|
||||
if (facingDirection == 2) setDown();
|
||||
if (facingDirection == 2) setLeft();
|
||||
}
|
||||
|
||||
public virtual void setLeft()
|
||||
{
|
||||
this.currentAnimation.setLeft();
|
||||
}
|
||||
|
||||
public virtual void setRight()
|
||||
{
|
||||
this.currentAnimation.setRight();
|
||||
}
|
||||
|
||||
public virtual void setUp()
|
||||
{
|
||||
this.currentAnimation.setUp();
|
||||
}
|
||||
|
||||
public virtual void setDown()
|
||||
{
|
||||
this.currentAnimation.setDown();
|
||||
}
|
||||
|
||||
public virtual void reloadSprites()
|
||||
{
|
||||
foreach(var v in this.animationList)
|
||||
{
|
||||
v.Value.reload();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
public virtual void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
|
||||
{
|
||||
this.currentAnimation.draw(b, screenPosition, layerDepth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the sprite to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="screenPosition"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
/// <param name="xOffset"></param>
|
||||
/// <param name="yOffset"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="flip"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="characterSourceRectOffset"></param>
|
||||
public virtual 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)
|
||||
{
|
||||
this.currentAnimation.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A very verbose asset drawer.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="npc"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="sourceRectangle"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <param name="alpha"></param>
|
||||
/// <param name="origin"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="effects"></param>
|
||||
/// <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)
|
||||
{
|
||||
this.currentAnimation.Animate(interval);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for a draw function that accepts rectangles to be null.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="extendedNPC"></param>
|
||||
/// <param name="vector21"></param>
|
||||
/// <param name="v1"></param>
|
||||
/// <param name="white"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="vector22"></param>
|
||||
/// <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)
|
||||
{
|
||||
this.draw(b, extendedNPC, vector21, v1, white, rotation, vector22, v2, spriteEffects, v3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
public class Portrait
|
||||
{
|
||||
public Texture2D portrait;
|
||||
public string relativePath;
|
||||
|
||||
/// <summary>
|
||||
/// A class for handling portraits.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path to the file.</param>
|
||||
public Portrait(string path)
|
||||
{
|
||||
this.relativePath =Class1.getRelativeDirectory(path);
|
||||
this.portrait=Class1.ModHelper.Content.Load<Texture2D>(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the npc's portrait to be this portrait texture.
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
public void setCharacterPortraitFromThis(ExtendedNPC npc)
|
||||
{
|
||||
npc.Portrait = this.portrait;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the texture for the NPC portrait.
|
||||
/// </summary>
|
||||
public void reload()
|
||||
{
|
||||
this.portrait = Class1.ModHelper.Content.Load<Texture2D>(this.relativePath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using CustomNPCFramework.Framework.NPCS;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CustomNPCFramework.Framework.ModularNPCS
|
||||
{
|
||||
public class Sprite
|
||||
{
|
||||
public AnimatedSprite sprite;
|
||||
public string relativePath;
|
||||
|
||||
/// <summary>
|
||||
/// A class for handling portraits.
|
||||
/// </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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the npc's portrait to be this portrait texture.
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
public void setCharacterSpriteFromThis(ExtendedNPC npc)
|
||||
{
|
||||
npc.Sprite = this.sprite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the texture for the NPC portrait.
|
||||
/// </summary>
|
||||
public void reload()
|
||||
{
|
||||
this.sprite.Texture = Class1.ModHelper.Content.Load<Texture2D>(this.relativePath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,491 @@
|
|||
using CustomNPCFramework.Framework.ModularNPCS;
|
||||
using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using StardewValley.Buildings;
|
||||
using StardewValley.Characters;
|
||||
using StardewValley.Locations;
|
||||
using StardewValley.Menus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using xTile.Dimensions;
|
||||
using xTile.ObjectModel;
|
||||
using xTile.Tiles;
|
||||
|
||||
namespace CustomNPCFramework.Framework.NPCS
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO: Add in an resource loader for all of the character graphics and use it to populate some character graphics.
|
||||
/// Make .json way to load in assets to the mod.
|
||||
/// Organize it all.
|
||||
/// Profit???
|
||||
/// </summary>
|
||||
public class ExtendedNPC :StardewValley.NPC
|
||||
{
|
||||
public BasicRenderer characterRenderer;
|
||||
public bool hasBeenKissedToday;
|
||||
public Point previousEndPoint;
|
||||
public bool returningToEndPoint;
|
||||
public bool hasSaidAfternoonDialogue;
|
||||
public int timeAfterSquare;
|
||||
|
||||
public Sprite spriteInformation;
|
||||
|
||||
public Portrait portraitInformation;
|
||||
public ExtendedNPC() :base()
|
||||
{
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
this.spriteInformation = sprite;
|
||||
this.spriteInformation.setCharacterSpriteFromThis(this);
|
||||
this.swimming = false;
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
public override void reloadSprite()
|
||||
{
|
||||
if (this.characterRenderer == null)
|
||||
{
|
||||
this.spriteInformation.reload();
|
||||
try
|
||||
{
|
||||
this.portraitInformation.reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Portrait = (Texture2D)null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.characterRenderer.reloadSprites();
|
||||
try
|
||||
{
|
||||
this.portraitInformation.reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Portrait = (Texture2D)null;
|
||||
}
|
||||
}
|
||||
int num = this.isInvisible ? 1 : 0;
|
||||
if (!Game1.newDay && (int)Game1.gameMode != 6)
|
||||
return;
|
||||
this.faceDirection(this.DefaultFacingDirection);
|
||||
this.scheduleTimeToTry = 9999999;
|
||||
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();
|
||||
if (this.isMarried())
|
||||
this.marriageDuties();
|
||||
bool flag = Utility.isFestivalDay(Game1.dayOfMonth, Game1.currentSeason);
|
||||
try
|
||||
{
|
||||
this.displayName = this.name;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool checkAction(StardewValley.Farmer who, GameLocation l)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
public override void MovePosition(GameTime time, xTile.Dimensions.Rectangle viewport, GameLocation currentLocation)
|
||||
{
|
||||
base.MovePosition(time,viewport,currentLocation);
|
||||
return;
|
||||
if (this.GetType() == typeof(FarmAnimal))
|
||||
this.willDestroyObjectsUnderfoot = false;
|
||||
if ((double)this.xVelocity != 0.0 || (double)this.yVelocity != 0.0)
|
||||
{
|
||||
Microsoft.Xna.Framework.Rectangle boundingBox = this.GetBoundingBox();
|
||||
boundingBox.X += (int)this.xVelocity;
|
||||
boundingBox.Y -= (int)this.yVelocity;
|
||||
if (currentLocation == null || !currentLocation.isCollidingPosition(boundingBox, viewport, false, 0, false, this))
|
||||
{
|
||||
this.position.X += this.xVelocity;
|
||||
this.position.Y -= this.yVelocity;
|
||||
}
|
||||
this.xVelocity = (float)(int)((double)this.xVelocity - (double)this.xVelocity / 2.0);
|
||||
this.yVelocity = (float)(int)((double)this.yVelocity - (double)this.yVelocity / 2.0);
|
||||
}
|
||||
else if (this.moveUp)
|
||||
{
|
||||
if (currentLocation == null || !currentLocation.isCollidingPosition(this.nextPosition(0), viewport, false, 0, false, this) || this.isCharging)
|
||||
{
|
||||
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.faceDirection(0);
|
||||
}
|
||||
}
|
||||
else if (!currentLocation.isTilePassable(this.nextPosition(0), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
this.Halt();
|
||||
else if (this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float)(this.getStandingX() / Game1.tileSize), (float)(this.getStandingY() / Game1.tileSize - 1));
|
||||
if (currentLocation.characterDestroyObjectWithinRectangle(this.nextPosition(0), true))
|
||||
{
|
||||
this.doEmote(12, true);
|
||||
this.position.Y -= (float)(this.speed + this.addedSpeed);
|
||||
}
|
||||
else
|
||||
this.blockedInterval = this.blockedInterval + time.ElapsedGameTime.Milliseconds;
|
||||
}
|
||||
}
|
||||
else if (this.moveRight)
|
||||
{
|
||||
if (currentLocation == null || !currentLocation.isCollidingPosition(this.nextPosition(1), viewport, false, 0, false, this) || this.isCharging)
|
||||
{
|
||||
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.faceDirection(1);
|
||||
}
|
||||
}
|
||||
else if (!currentLocation.isTilePassable(this.nextPosition(1), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
this.Halt();
|
||||
else if (this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float)(this.getStandingX() / Game1.tileSize + 1), (float)(this.getStandingY() / Game1.tileSize));
|
||||
if (currentLocation.characterDestroyObjectWithinRectangle(this.nextPosition(1), true))
|
||||
{
|
||||
this.doEmote(12, true);
|
||||
this.position.X += (float)(this.speed + this.addedSpeed);
|
||||
}
|
||||
else
|
||||
this.blockedInterval = this.blockedInterval + time.ElapsedGameTime.Milliseconds;
|
||||
}
|
||||
}
|
||||
else if (this.moveDown)
|
||||
{
|
||||
if (currentLocation == null || !currentLocation.isCollidingPosition(this.nextPosition(2), viewport, false, 0, false, this) || this.isCharging)
|
||||
{
|
||||
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.faceDirection(2);
|
||||
}
|
||||
}
|
||||
else if (!currentLocation.isTilePassable(this.nextPosition(2), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
this.Halt();
|
||||
else if (this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float)(this.getStandingX() / Game1.tileSize), (float)(this.getStandingY() / Game1.tileSize + 1));
|
||||
if (currentLocation.characterDestroyObjectWithinRectangle(this.nextPosition(2), true))
|
||||
{
|
||||
this.doEmote(12, true);
|
||||
this.position.Y += (float)(this.speed + this.addedSpeed);
|
||||
}
|
||||
else
|
||||
this.blockedInterval = this.blockedInterval + time.ElapsedGameTime.Milliseconds;
|
||||
}
|
||||
}
|
||||
else if (this.moveLeft)
|
||||
{
|
||||
if (currentLocation == null || !currentLocation.isCollidingPosition(this.nextPosition(3), viewport, false, 0, false, this) || this.isCharging)
|
||||
{
|
||||
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.faceDirection(3);
|
||||
}
|
||||
}
|
||||
else if (!currentLocation.isTilePassable(this.nextPosition(3), viewport) || !this.willDestroyObjectsUnderfoot)
|
||||
this.Halt();
|
||||
else if (this.willDestroyObjectsUnderfoot)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float)(this.getStandingX() / Game1.tileSize - 1), (float)(this.getStandingY() / Game1.tileSize));
|
||||
if (currentLocation.characterDestroyObjectWithinRectangle(this.nextPosition(3), true))
|
||||
{
|
||||
this.doEmote(12, true);
|
||||
this.position.X -= (float)(this.speed + this.addedSpeed);
|
||||
}
|
||||
else
|
||||
this.blockedInterval = this.blockedInterval + time.ElapsedGameTime.Milliseconds;
|
||||
}
|
||||
}
|
||||
if (this.blockedInterval >= 3000 && (double)this.blockedInterval <= 3750.0 && !Game1.eventUp)
|
||||
{
|
||||
this.doEmote(Game1.random.NextDouble() < 0.5 ? 8 : 40, true);
|
||||
this.blockedInterval = 3750;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.blockedInterval < 5000)
|
||||
return;
|
||||
this.speed = 4;
|
||||
this.isCharging = true;
|
||||
this.blockedInterval = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
public override void update(GameTime time, GameLocation location)
|
||||
{
|
||||
base.update(time, location);
|
||||
}
|
||||
|
||||
public virtual void routeEndAnimationFinished(StardewValley.Farmer who)
|
||||
{
|
||||
this.doingEndOfRouteAnimation = false;
|
||||
this.freezeMotion = false;
|
||||
this.sprite.spriteHeight = 32;
|
||||
this.sprite.StopAnimation();
|
||||
this.endOfRouteMessage = (string)null;
|
||||
this.isCharging = false;
|
||||
this.speed = 2;
|
||||
this.addedSpeed = 0;
|
||||
this.goingToDoEndOfRouteAnimation = false;
|
||||
if (!this.IsWalkingInSquare)
|
||||
return;
|
||||
this.returningToEndPoint = true;
|
||||
this.timeAfterSquare = Game1.timeOfDay;
|
||||
}
|
||||
|
||||
public virtual void doAnimationAtEndOfScheduleRoute(Character c, GameLocation l)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public virtual void startRouteBehavior(string behaviorName)
|
||||
{
|
||||
if (behaviorName.Length > 0 && (int)behaviorName[0] == 34)
|
||||
{
|
||||
this.endOfRouteMessage = behaviorName.Replace("\"", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (behaviorName.Contains("square_"))
|
||||
{
|
||||
this.lastCrossroad = new Microsoft.Xna.Framework.Rectangle(this.getTileX() * Game1.tileSize, this.getTileY() * Game1.tileSize, Game1.tileSize, Game1.tileSize);
|
||||
string[] strArray = behaviorName.Split('_');
|
||||
this.walkInSquare(Convert.ToInt32(strArray[1]), Convert.ToInt32(strArray[2]), 6000);
|
||||
this.squareMovementFacingPreference = strArray.Length <= 3 ? -1 : Convert.ToInt32(strArray[3]);
|
||||
}
|
||||
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)
|
||||
{
|
||||
id = 688f
|
||||
});
|
||||
this.doEmote(52, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public new void getHitByPlayer(StardewValley.Farmer who, GameLocation location)
|
||||
{
|
||||
this.doEmote(12, true);
|
||||
if (who == null)
|
||||
{
|
||||
if (Game1.IsMultiplayer)
|
||||
return;
|
||||
who = Game1.player;
|
||||
}
|
||||
if (who.friendships.ContainsKey(this.name))
|
||||
{
|
||||
who.friendships[this.name][0] -= 30;
|
||||
if (who.IsMainPlayer)
|
||||
{
|
||||
this.CurrentDialogue.Clear();
|
||||
//this.CurrentDialogue.Push(new StardewValley.Dialogue(Game1.random.NextDouble() < 0.5 ? Game1.LoadStringByGender(this.gender, "Strings\\StringsFromCSFiles:NPC.cs.4293") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.4294"), this));
|
||||
}
|
||||
//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"))
|
||||
Game1.playSound("crafting");
|
||||
else
|
||||
Game1.playSound("hitEnemy");
|
||||
}
|
||||
|
||||
//ERROR NEED FIXING
|
||||
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;
|
||||
this.Halt();
|
||||
this.hasBeenKissedToday = false;
|
||||
this.faceTowardFarmer = false;
|
||||
this.faceTowardFarmerTimer = 0;
|
||||
this.drawOffset = Vector2.Zero;
|
||||
this.hasSaidAfternoonDialogue = false;
|
||||
this.ignoreScheduleToday = false;
|
||||
this.Halt();
|
||||
this.controller = (PathFindController)null;
|
||||
this.temporaryController = (PathFindController)null;
|
||||
this.DirectionsToNewLocation = (SchedulePathDescription)null;
|
||||
this.faceDirection(this.DefaultFacingDirection);
|
||||
this.scheduleTimeToTry = 9999999;
|
||||
this.previousEndPoint = new Point((int)this.DefaultPosition.X / Game1.tileSize, (int)this.DefaultPosition.Y / Game1.tileSize);
|
||||
this.IsWalkingInSquare = false;
|
||||
this.returningToEndPoint = false;
|
||||
this.lastCrossroad = Microsoft.Xna.Framework.Rectangle.Empty;
|
||||
if (this.isVillager())
|
||||
this.Schedule = this.getSchedule(dayOfMonth);
|
||||
this.endOfRouteMessage = (string)null;
|
||||
bool flag = Utility.isFestivalDay(dayOfMonth, Game1.currentSeason);
|
||||
if (!this.isMarried())
|
||||
return;
|
||||
this.marriageDuties();
|
||||
this.daysMarried = this.daysMarried + 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does effectively nothing.
|
||||
/// </summary>
|
||||
public new void setUpForOutdoorPatioActivity()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to draw the npc with the custom renderer.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <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))
|
||||
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)
|
||||
{
|
||||
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));
|
||||
//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));
|
||||
}
|
||||
//If the npc breathes then this code is ran.
|
||||
if (this.breather && this.shakeTimer <= 0 && (!this.swimming && 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)
|
||||
{
|
||||
sourceRect.Y += this.sprite.spriteHeight / 6 + 1;
|
||||
sourceRect.Height /= 2;
|
||||
vector2.Y += (float)(this.sprite.spriteHeight / 8 * Game1.pixelZoom);
|
||||
}
|
||||
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)));
|
||||
}
|
||||
|
||||
//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 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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
public virtual void drawNonModularSprite(SpriteBatch b, float alpha = 1f)
|
||||
{
|
||||
if (this.sprite == null || this.isInvisible || !Utility.isOnScreen(this.position, 2 * Game1.tileSize))
|
||||
return;
|
||||
if (this.swimming)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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.Height /= 2;
|
||||
vector2.Y += (float)(this.sprite.spriteHeight / 8 * Game1.pixelZoom);
|
||||
}
|
||||
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));
|
||||
|
||||
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)));
|
||||
Vector2 localPosition1 = this.getLocalPosition(Game1.viewport);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
public override void draw(SpriteBatch b, float alpha = 1f)
|
||||
{
|
||||
if (this.characterRenderer == null)
|
||||
{
|
||||
this.drawNonModularSprite(b, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawModular(b, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CustomNPCFramework")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CustomNPCFramework")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("89c7df45-8ae5-49ac-ada9-6312e9590829")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Name": "CustomNPCFramework",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "0.1.0",
|
||||
"Description": "A system to add custom npcs to Stardew.",
|
||||
"UniqueID": "Omegasis.CustomNPCFramework",
|
||||
"EntryDll": "CustomNPCFramework.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ ]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,37 @@
|
|||
using EventSystem.Framework;
|
||||
using StardewModdingAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem
|
||||
{
|
||||
public class EventSystem: Mod
|
||||
{
|
||||
public static IModHelper ModHelper;
|
||||
public static IMonitor ModMonitor;
|
||||
|
||||
public static EventManager eventManager;
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
|
||||
ModHelper = this.Helper;
|
||||
ModMonitor = this.Monitor;
|
||||
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
}
|
||||
|
||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||
{
|
||||
eventManager = new EventManager();
|
||||
}
|
||||
|
||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||
{
|
||||
if (eventManager == null) return;
|
||||
eventManager.update();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BB737337-2D82-4245-AA46-F3B82FC6F228}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EventSystem</RootNamespace>
|
||||
<AssemblyName>EventSystem</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="EventSystem.cs" />
|
||||
<Compile Include="Framework\Delegates.cs" />
|
||||
<Compile Include="Framework\EventManager.cs" />
|
||||
<Compile Include="Framework\Events\WarpEvent.cs" />
|
||||
<Compile Include="Framework\FunctionEvents\functionEvent.cs" />
|
||||
<Compile Include="Framework\FunctionEvents\MouseButtonEvents.cs" />
|
||||
<Compile Include="Framework\FunctionEvents\MouseEntryLeaveEvent.cs" />
|
||||
<Compile Include="Framework\FunctionEvents\PlayerEvents.cs" />
|
||||
<Compile Include="Framework\Information\WarpInformation.cs" />
|
||||
<Compile Include="Framework\MapEvent.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</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')" />
|
||||
<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'))" />
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework
|
||||
{
|
||||
public class Delegates
|
||||
{
|
||||
public delegate void voidDel();
|
||||
public delegate void strDel(string s);
|
||||
public delegate void paramFunction(List<object> parameters);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework
|
||||
{
|
||||
public class EventManager
|
||||
{
|
||||
public Dictionary<GameLocation, List<MapEvent>> mapEvents;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public EventManager()
|
||||
{
|
||||
this.mapEvents = new Dictionary<GameLocation, List<MapEvent>>();
|
||||
foreach(var v in Game1.locations)
|
||||
{
|
||||
addLocation(v.name, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an event to the map given the name of the map.
|
||||
/// </summary>
|
||||
/// <param name="mapName"></param>
|
||||
/// <param name="mapEvent"></param>
|
||||
public virtual void addEvent(string mapName,MapEvent mapEvent)
|
||||
{
|
||||
foreach(var pair in this.mapEvents)
|
||||
{
|
||||
if (pair.Key.name == mapName)
|
||||
{
|
||||
pair.Value.Add(mapEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an event to a map.
|
||||
/// </summary>
|
||||
/// <param name="Location"></param>
|
||||
/// <param name="mapEvent"></param>
|
||||
public virtual void addEvent(GameLocation Location, MapEvent mapEvent)
|
||||
{
|
||||
foreach (var pair in this.mapEvents)
|
||||
{
|
||||
if (pair.Key == Location)
|
||||
{
|
||||
|
||||
pair.Value.Add(mapEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a location to have events handled.
|
||||
/// </summary>
|
||||
/// <param name="Location">The location to handle events.</param>
|
||||
public virtual void addLocation(GameLocation Location)
|
||||
{
|
||||
EventSystem.ModMonitor.Log("Adding event processing for location: " + Location.name);
|
||||
this.mapEvents.Add(Location, new List<MapEvent>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a location to have events handled.
|
||||
/// </summary>
|
||||
/// <param name="Location"></param>
|
||||
/// <param name="Events"></param>
|
||||
public virtual void addLocation(GameLocation Location,List<MapEvent> Events)
|
||||
{
|
||||
EventSystem.ModMonitor.Log("Adding event processing for location: " + Location.name);
|
||||
this.mapEvents.Add(Location, Events);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a location to handle events.
|
||||
/// </summary>
|
||||
/// <param name="Location">The name of the location. Can include farm buildings.</param>
|
||||
/// <param name="isStructure">Used if the building is a stucture. True=building.</param>
|
||||
public virtual void addLocation(string Location,bool isStructure)
|
||||
{
|
||||
EventSystem.ModMonitor.Log("Adding event processing for location: " + Location);
|
||||
this.mapEvents.Add(Game1.getLocationFromName(Location,isStructure), new List<MapEvent>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a location to have events handled.
|
||||
/// </summary>
|
||||
/// <param name="Location">The name of the location. Can include farm buildings.</param>
|
||||
/// <param name="isStructure">Used if the building is a stucture. True=building.</param>
|
||||
/// <param name="Events">A list of pre-initialized events.</param>
|
||||
public virtual void addLocation(string Location, bool isStructure, List<MapEvent> Events)
|
||||
{
|
||||
EventSystem.ModMonitor.Log("Adding event processing for location: " + Location);
|
||||
this.mapEvents.Add(Game1.getLocationFromName(Location,isStructure), Events);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates all events associated with the event manager.
|
||||
/// </summary>
|
||||
public virtual void update()
|
||||
{
|
||||
List<MapEvent> events = new List<MapEvent>();
|
||||
if (Game1.player == null) return;
|
||||
if (Game1.hasLoadedGame == false) return;
|
||||
bool ok=this.mapEvents.TryGetValue(Game1.player.currentLocation, out events);
|
||||
if (ok == false) return;
|
||||
else
|
||||
{
|
||||
foreach(var v in events)
|
||||
{
|
||||
v.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
using EventSystem.Framework.FunctionEvents;
|
||||
using EventSystem.Framework.Information;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to handle warp events on the map.
|
||||
/// </summary>
|
||||
public class WarpEvent :MapEvent
|
||||
{
|
||||
WarpInformation warpInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for handling warp events.
|
||||
/// </summary>
|
||||
/// <param name="Name">The name of the event.</param>
|
||||
/// <param name="Location">The game location that this event is located at.</param>
|
||||
/// <param name="Position">The x,y tile position of the event.</param>
|
||||
/// <param name="playerEvents">The events to occur when the player enters the warp tile before the warp.</param>
|
||||
/// <param name="WarpInfo">The information for warping the farmer.</param>
|
||||
public WarpEvent(string Name, GameLocation Location, Vector2 Position, PlayerEvents playerEvents,WarpInformation WarpInfo) : base(Name, Location, Position, playerEvents)
|
||||
{
|
||||
this.name = Name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
this.playerEvents = playerEvents;
|
||||
this.warpInfo = WarpInfo;
|
||||
|
||||
this.doesInteractionNeedToRun = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the player enters the warp tile event position.
|
||||
/// </summary>
|
||||
public override void OnPlayerEnter()
|
||||
{
|
||||
if (isPlayerOnTile() == true&& this.doesInteractionNeedToRun==true)
|
||||
{
|
||||
this.doesInteractionNeedToRun = false;
|
||||
this.playerOnTile = true;
|
||||
if (this.playerEvents.onPlayerEnter != null) this.playerEvents.onPlayerEnter.run(); //used to run a function before the warp.
|
||||
Game1.warpFarmer(Game1.getLocationFromName(this.warpInfo.targetMapName),this.warpInfo.targetX,this.warpInfo.targetY,this.warpInfo.facingDirection,this.warpInfo.isStructure);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs when the player is not on the tile and resets player interaction.
|
||||
/// </summary>
|
||||
public override void OnPlayerLeave()
|
||||
{
|
||||
if (isPlayerOnTile() == false && this.playerOnTile == true)
|
||||
{
|
||||
this.playerOnTile = false;
|
||||
this.doesInteractionNeedToRun = true;
|
||||
if (this.playerEvents.onPlayerLeave != null) this.playerEvents.onPlayerLeave.run();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to update the event and check for interaction.
|
||||
/// </summary>
|
||||
public override void update()
|
||||
{
|
||||
this.OnPlayerEnter();
|
||||
this.OnPlayerLeave();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework.FunctionEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to handle mouse interactions with button clicks and scrolling the mouse wheel.
|
||||
/// </summary>
|
||||
public class MouseButtonEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// Function that runs when the user left clicks.
|
||||
/// </summary>
|
||||
public functionEvent onLeftClick;
|
||||
/// <summary>
|
||||
/// Function that runs when the user right clicks.
|
||||
/// </summary>
|
||||
public functionEvent onRightClick;
|
||||
/// <summary>
|
||||
/// Function that runs when the user scrolls the mouse wheel.
|
||||
/// </summary>
|
||||
public functionEvent onMouseScroll;
|
||||
|
||||
/// <summary>
|
||||
/// A constructor used to set a single function to a mouse button.
|
||||
/// </summary>
|
||||
/// <param name="clickFunction"></param>
|
||||
/// <param name="leftClick">If true the function is set to the left click. If false the function is set to the right click.</param>
|
||||
public MouseButtonEvents(functionEvent clickFunction, bool leftClick)
|
||||
{
|
||||
if (leftClick == true) this.onLeftClick = clickFunction;
|
||||
else this.onRightClick = clickFunction;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A constructor used to map functions to mouse clicks.
|
||||
/// </summary>
|
||||
/// <param name="OnLeftClick">A function to be ran when the mouse left clicks this position.</param>
|
||||
/// <param name="OnRightClick">A function to be ran when the mouse right clicks this position.</param>
|
||||
public MouseButtonEvents(functionEvent OnLeftClick, functionEvent OnRightClick)
|
||||
{
|
||||
this.onLeftClick = OnLeftClick;
|
||||
this.onRightClick = OnRightClick;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A constructor used to map functions to mouse clicks and scrolling the mouse wheel.
|
||||
/// </summary>
|
||||
/// <param name="OnLeftClick">A function to be ran when the mouse left clicks this position.</param>
|
||||
/// <param name="OnRightClick">A function to be ran when the mouse right clicks this position.</param>
|
||||
/// <param name="OnMouseScroll">A function to be ran when the user scrolls the mouse</param>
|
||||
public MouseButtonEvents(functionEvent OnLeftClick,functionEvent OnRightClick, functionEvent OnMouseScroll)
|
||||
{
|
||||
this.onLeftClick = OnLeftClick;
|
||||
this.onRightClick = OnRightClick;
|
||||
this.onMouseScroll = OnMouseScroll;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework.FunctionEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to handle events that happens when a mouse enters/leaves a specified position.
|
||||
/// </summary>
|
||||
public class MouseEntryLeaveEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// A function that is called when a mouse enters a certain position.
|
||||
/// </summary>
|
||||
public functionEvent onMouseEnter;
|
||||
/// <summary>
|
||||
/// A function that is called when a mouse leaves a certain position.
|
||||
/// </summary>
|
||||
public functionEvent onMouseLeave;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="OnMouseEnter">The function that occurs when the mouse enters a certain position.</param>
|
||||
/// <param name="OnMouseLeave">The function that occurs when the mouse leaves a certain position.</param>
|
||||
public MouseEntryLeaveEvent(functionEvent OnMouseEnter, functionEvent OnMouseLeave)
|
||||
{
|
||||
this.onMouseEnter = OnMouseEnter;
|
||||
this.onMouseLeave = OnMouseLeave;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework.FunctionEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to handle various functions that occur on player interaction.
|
||||
/// </summary>
|
||||
public class PlayerEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when the player enters the same tile as this event.
|
||||
/// </summary>
|
||||
public functionEvent onPlayerEnter;
|
||||
/// <summary>
|
||||
/// Occurs when the player leaves the same tile as this event.
|
||||
/// </summary>
|
||||
public functionEvent onPlayerLeave;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="OnPlayerEnter"></param>
|
||||
/// <param name="OnPlayerLeave"></param>
|
||||
public PlayerEvents(functionEvent OnPlayerEnter, functionEvent OnPlayerLeave)
|
||||
{
|
||||
this.onPlayerEnter = OnPlayerEnter;
|
||||
this.onPlayerLeave = OnPlayerLeave;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static EventSystem.Framework.Delegates;
|
||||
|
||||
namespace EventSystem.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to pair a function and a parameter list using the super object class to run virtually any function for map events.
|
||||
/// </summary>
|
||||
public class functionEvent
|
||||
{
|
||||
public paramFunction function;
|
||||
public List<object> parameters;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="Function">The function to be called when running an event.</param>
|
||||
/// <param name="Parameters">The list of system.objects to be used in the function. Can include objects,strings, ints, etc. Anything can be passed in as a parameter or can be passed in as empty. Passing in null will just create an empty list.</param>
|
||||
public functionEvent(paramFunction Function, List<object> Parameters)
|
||||
{
|
||||
if (this.parameters == null) this.parameters = new List<object>();
|
||||
this.function = Function;
|
||||
this.parameters = Parameters;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the function with the passed in parameters.
|
||||
/// </summary>
|
||||
public void run()
|
||||
{
|
||||
this.function.Invoke(this.parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simply swaps out the old parameters list for a new one.
|
||||
/// </summary>
|
||||
/// <param name="newParameters"></param>
|
||||
public void updateParameters(List<object> newParameters)
|
||||
{
|
||||
this.parameters = newParameters;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework.Information
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to store all of the information necessary to warp the farmer.
|
||||
/// </summary>
|
||||
public class WarpInformation
|
||||
{
|
||||
public string targetMapName;
|
||||
public int targetX;
|
||||
public int targetY;
|
||||
public int facingDirection;
|
||||
public bool isStructure;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used to bundle together necessary information to warp the player character.
|
||||
/// </summary>
|
||||
/// <param name="MapName">The target map name to warp the farmer to.</param>
|
||||
/// <param name="TargetX">The target X location on the map to warp the farmer to.</param>
|
||||
/// <param name="TargetY">The target Y location on the map to warp the farmer to.</param>
|
||||
/// <param name="FacingDirection">The facing direction for the farmer to be facing after the warp.</param>
|
||||
/// <param name="IsStructure">Used to determine the position to be warped to when leaving a structure.</param>
|
||||
public WarpInformation(string MapName, int TargetX,int TargetY, int FacingDirection, bool IsStructure)
|
||||
{
|
||||
this.targetMapName = MapName;
|
||||
this.targetX = TargetX;
|
||||
this.targetY = TargetY;
|
||||
this.facingDirection = FacingDirection;
|
||||
this.isStructure = IsStructure;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,263 @@
|
|||
using EventSystem.Framework.FunctionEvents;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventSystem.Framework
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Base class used to handle map tile events.
|
||||
/// </summary>
|
||||
public class MapEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// //MAKE NAME FOR EVENTS
|
||||
/// </summary>
|
||||
|
||||
public string name;
|
||||
|
||||
public Vector2 tilePosition;
|
||||
public GameLocation location;
|
||||
|
||||
public PlayerEvents playerEvents;
|
||||
public bool playerOnTile;
|
||||
|
||||
public MouseButtonEvents mouseButtonEvents;
|
||||
public MouseEntryLeaveEvent mouseEntryLeaveEvents;
|
||||
public bool mouseOnTile;
|
||||
|
||||
public bool doesInteractionNeedToRun;
|
||||
public bool loopInteraction;
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Constructors
|
||||
|
||||
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
#region
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Empty Constructor
|
||||
/// </summary>
|
||||
public MapEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A simple map event that doesn't do anything.
|
||||
/// </summary>
|
||||
/// <param name="Location"></param>
|
||||
/// <param name="Position"></param>
|
||||
public MapEvent(string name,GameLocation Location,Vector2 Position)
|
||||
{
|
||||
this.name = name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A simple map function that runs when the player enters and leaves a tile. Set values to null for nothing to happen.
|
||||
/// </summary>
|
||||
/// <param name="Location">The game location where the event is. I.E Farm, Town, Mine etc.</param>
|
||||
/// <param name="position">The x,y position on the map the event is.</param>
|
||||
/// <param name="PlayerEvents">Handles various events that runs when the player enters/leaves a tile, etc.</param>
|
||||
|
||||
public MapEvent(string name,GameLocation Location,Vector2 position, PlayerEvents PlayerEvents)
|
||||
{
|
||||
this.name = name;
|
||||
this.location = Location;
|
||||
this.tilePosition = position;
|
||||
this.playerEvents = PlayerEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A constructor that handles when the mouse leaves and enters a tile.
|
||||
/// </summary>
|
||||
/// <param name="Location">The game location where the event is.</param>
|
||||
/// <param name="Position">The x,y position of the tile at the game location.</param>
|
||||
/// <param name="mouseEvents">A class used to handle mouse entry/leave events.</param>
|
||||
public MapEvent(string name,GameLocation Location, Vector2 Position, MouseEntryLeaveEvent mouseEvents)
|
||||
{
|
||||
this.name = name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
this.mouseEntryLeaveEvents = mouseEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A constructor that handles when the mouse leaves and enters a tile.
|
||||
/// </summary>
|
||||
/// <param name="Location">The game location where the event is.</param>
|
||||
/// <param name="Position">The x,y position of the tile at the game location.</param>
|
||||
/// <param name="mouseEvents">A class used to handle mouse click/scroll events.</param>
|
||||
public MapEvent(string name,GameLocation Location, Vector2 Position, MouseButtonEvents mouseEvents)
|
||||
{
|
||||
this.name = name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
this.mouseButtonEvents = mouseEvents;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A constructor encapsulating player, mouse button, and mouse entry events.
|
||||
/// </summary>
|
||||
/// <param name="Location">The game location for which the event is located. I.E Town, Farm, etc.</param>
|
||||
/// <param name="Position">The x,y cordinates for this event to be located at.</param>
|
||||
/// <param name="playerEvents">The events that occur associated with the player. I.E player entry, etc.</param>
|
||||
/// <param name="mouseButtonEvents">The events associated with clicking a mouse button while on this tile.</param>
|
||||
/// <param name="mouseEntryLeaveEvents">The events that occur when the mouse enters or leaves the same tile position as this event.</param>
|
||||
public MapEvent(string name,GameLocation Location, Vector2 Position, PlayerEvents playerEvents, MouseButtonEvents mouseButtonEvents, MouseEntryLeaveEvent mouseEntryLeaveEvents)
|
||||
{
|
||||
this.name = name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
this.playerEvents = playerEvents;
|
||||
this.mouseButtonEvents = mouseButtonEvents;
|
||||
this.mouseEntryLeaveEvents = mouseEntryLeaveEvents;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Player related functions
|
||||
|
||||
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
#region
|
||||
/// <summary>
|
||||
/// Occurs when the player enters the same tile as this event. The function associated with this event is then ran.
|
||||
/// </summary>
|
||||
public virtual void OnPlayerEnter()
|
||||
{
|
||||
if (isPlayerOnTile() == true)
|
||||
{
|
||||
this.playerOnTile = true;
|
||||
if (this.playerEvents.onPlayerEnter != null) this.playerEvents.onPlayerEnter.run();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the player leaves the same tile that this event is on. The function associated with thie event is then ran.
|
||||
/// </summary>
|
||||
public virtual void OnPlayerLeave()
|
||||
{
|
||||
if(isPlayerOnTile() == false && this.playerOnTile==true){
|
||||
this.playerOnTile = false;
|
||||
if (this.playerEvents.onPlayerLeave != null) this.playerEvents.onPlayerLeave.run();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the player is on the same tile as this event.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool isPlayerOnTile()
|
||||
{
|
||||
if (Game1.player.getTileX() == this.tilePosition.X && Game1.player.getTileY() == this.tilePosition.Y) return true;
|
||||
else return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Mouse related functions
|
||||
|
||||
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
#region
|
||||
/// <summary>
|
||||
/// Occurs when the player left clicks the same tile that this event is on.
|
||||
/// </summary>
|
||||
public virtual void OnLeftClick()
|
||||
{
|
||||
if (this.mouseOnTile==false) return;
|
||||
if (this.mouseButtonEvents.onLeftClick != null) this.mouseButtonEvents.onLeftClick.run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the player right clicks the same tile that this event is on.
|
||||
/// </summary>
|
||||
public virtual void OnRightClick()
|
||||
{
|
||||
if (this.mouseOnTile == false) return;
|
||||
if (this.mouseButtonEvents.onRightClick != null) this.mouseButtonEvents.onRightClick.run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the mouse tile position is the same as this event's x,y position.
|
||||
/// </summary>
|
||||
public virtual void OnMouseEnter()
|
||||
{
|
||||
if (isMouseOnTile())
|
||||
{
|
||||
this.mouseOnTile = true;
|
||||
if (this.mouseEntryLeaveEvents.onMouseEnter != null) this.mouseEntryLeaveEvents.onMouseEnter.run();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the mouse tile position leaves the the same x,y position as this event.
|
||||
/// </summary>
|
||||
public virtual void OnMouseLeave()
|
||||
{
|
||||
if (isMouseOnTile() == false && this.mouseOnTile == true)
|
||||
{
|
||||
this.mouseOnTile = false;
|
||||
if (this.mouseEntryLeaveEvents.onMouseLeave != null) this.mouseEntryLeaveEvents.onMouseLeave.run();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UNUSED!!!!
|
||||
/// Occurs when the mouse is on the same position as the tile AND the user scrolls the mouse wheel.
|
||||
/// </summary>
|
||||
public virtual void OnMouseScroll()
|
||||
{
|
||||
if (isMouseOnTile() == false) return;
|
||||
if (this.mouseButtonEvents.onMouseScroll != null) this.mouseButtonEvents.onMouseScroll.run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the mouse is on the tile.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool isMouseOnTile()
|
||||
{
|
||||
Vector2 mousePosition = new Vector2(Game1.getMouseX(), Game1.getMouseY());
|
||||
if (mousePosition.X == this.tilePosition.X && mousePosition.Y == this.tilePosition.Y) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the tile is clicked. Runs the appropriate event.
|
||||
/// </summary>
|
||||
public virtual void eventClickEvent()
|
||||
{
|
||||
if (this.mouseOnTile == false) return;
|
||||
var mouseState=Mouse.GetState();
|
||||
if (mouseState.LeftButton == ButtonState.Pressed) OnLeftClick();
|
||||
if (mouseState.RightButton == ButtonState.Pressed) OnRightClick();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to check if any sort of events need to run on this tile right now.
|
||||
/// </summary>
|
||||
public virtual void update()
|
||||
{
|
||||
eventClickEvent(); //click events
|
||||
OnPlayerEnter(); //player enter events
|
||||
OnPlayerLeave(); //player leave events
|
||||
OnMouseEnter(); //on mouse enter events
|
||||
OnMouseLeave(); //on mouse leave events.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MapEvents")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MapEvents")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("bb737337-2d82-4245-aa46-f3b82fc6f228")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Name": "EventSystem",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "0.1.0",
|
||||
"Description": "A system to manage different events that can happen on the map.",
|
||||
"UniqueID": "Omegasis.EventSystem",
|
||||
"EntryDll": "EventSystem.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ ]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -67,6 +67,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarAI", "..\StarAI\StarAI\
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewSymphonyRemastered", "StardewSymphonyRemastered\StardewSymphonyRemastered\StardewSymphonyRemastered.csproj", "{19F64B03-6A9B-49E1-854A-C05D5A014646}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0756D36A-95C8-480D-8EA6-4584C03010C6} = {0756D36A-95C8-480D-8EA6-4584C03010C6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sundrop", "Sundrop", "{3EE26DA0-0337-4991-8B02-BCB8D408008C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventSystem", "MapEvents\EventSystem.csproj", "{BB737337-2D82-4245-AA46-F3B82FC6F228}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EventSystemMods", "EventSystemMods", "{BAAC8F21-C12F-42B0-A51C-0C5F33B52575}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SundropMapEvents", "SundropMapEvents\SundropMapEvents.csproj", "{29A68F94-B23C-442B-8867-8B8F3502E64F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228} = {BB737337-2D82-4245-AA46-F3B82FC6F228}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomNPCFramework", "CustomNPCFramework\CustomNPCFramework.csproj", "{89C7DF45-8AE5-49AC-ADA9-6312E9590829}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -166,11 +182,27 @@ Global
|
|||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{29A68F94-B23C-442B-8867-8B8F3502E64F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{29A68F94-B23C-442B-8867-8B8F3502E64F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{29A68F94-B23C-442B-8867-8B8F3502E64F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{29A68F94-B23C-442B-8867-8B8F3502E64F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{8415BB0C-94A7-4E11-B6D5-C31649C3A95D} = {953CD0A4-8529-45E6-87C2-31837940D62C}
|
||||
{BB737337-2D82-4245-AA46-F3B82FC6F228} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
{BAAC8F21-C12F-42B0-A51C-0C5F33B52575} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
{29A68F94-B23C-442B-8867-8B8F3502E64F} = {BAAC8F21-C12F-42B0-A51C-0C5F33B52575}
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework.Menus
|
||||
{
|
||||
class MusicManagerMenu : StardewValley.Menus.IClickableMenu
|
||||
{
|
||||
public List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString> texturedStrings;
|
||||
public MusicManagerMenu(float width, float height)
|
||||
{
|
||||
this.width = (int)width;
|
||||
this.height = (int)height;
|
||||
this.texturedStrings = new List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString>();
|
||||
this.texturedStrings.Add(StardustCore.UIUtilities.SpriteFonts.SpriteFont.vanillaFont.ParseString("Hello", new Microsoft.Xna.Framework.Vector2(100, 100),StardustCore.IlluminateFramework.Colors.invertColor(StardustCore.IlluminateFramework.LightColorsList.Blue)));
|
||||
}
|
||||
|
||||
public override void receiveRightClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void drawBackground(SpriteBatch b)
|
||||
{
|
||||
Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true);
|
||||
//base.drawBackground(b);
|
||||
}
|
||||
|
||||
public override void draw(SpriteBatch b)
|
||||
{
|
||||
this.drawBackground(b);
|
||||
|
||||
foreach(var v in texturedStrings)
|
||||
{
|
||||
v.draw(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,6 +49,8 @@ namespace StardewSymphonyRemastered.Framework
|
|||
string rawName = FileName.Substring(0, FileName.Length - 4);
|
||||
string cueName = rawName + "CueList.txt";
|
||||
|
||||
//Not used as the music pack can change between loads
|
||||
/*
|
||||
if (File.Exists(cueName))
|
||||
{
|
||||
string[] arr = File.ReadAllLines(cueName);
|
||||
|
@ -59,6 +61,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
}
|
||||
return names;
|
||||
}
|
||||
*/
|
||||
string hexDumpContents = HexDump(array);
|
||||
|
||||
string rawHexName = rawName + "HexDump.txt";
|
||||
|
@ -89,19 +92,24 @@ namespace StardewSymphonyRemastered.Framework
|
|||
foreach (var split in splits)
|
||||
{
|
||||
if (split == "") continue;
|
||||
|
||||
try
|
||||
{
|
||||
Game1.waveBank = musicPack.WaveBank;
|
||||
Game1.soundBank = musicPack.SoundBank;
|
||||
|
||||
if (Game1.soundBank.GetCue(split) != null)
|
||||
{
|
||||
cleanCueNames.Add(split);
|
||||
}
|
||||
|
||||
reset.Invoke();
|
||||
}
|
||||
catch { }
|
||||
catch(Exception err)
|
||||
{
|
||||
reset.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return cleanCueNames;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using StardewSymphonyRemastered;
|
||||
using StardewValley;
|
||||
using System.IO;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
|
@ -168,10 +169,12 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// </summary>
|
||||
/// <param name="songListKey"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<MusicPack,List<string>> getListOfApplicableMusicPacks(string songListKey)
|
||||
public Dictionary<MusicPack,List<Song>> getListOfApplicableMusicPacks(string songListKey)
|
||||
{
|
||||
Dictionary<MusicPack, List<string>> listOfValidDictionaries = new Dictionary<MusicPack, List<string>>();
|
||||
Dictionary<MusicPack, List<Song>> listOfValidDictionaries = new Dictionary<MusicPack, List<Song>>();
|
||||
foreach(var v in this.musicPacks)
|
||||
{
|
||||
try
|
||||
{
|
||||
var songList = v.Value.songInformation.getSongList(songListKey).Value;
|
||||
if (songList.Count > 0)
|
||||
|
@ -179,6 +182,11 @@ namespace StardewSymphonyRemastered.Framework
|
|||
listOfValidDictionaries.Add(v.Value, songList);
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return listOfValidDictionaries;
|
||||
}
|
||||
|
||||
|
@ -188,13 +196,100 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// <param name="songListKey"></param>
|
||||
public void selectMusic(string songListKey)
|
||||
{
|
||||
|
||||
var listOfValidMusicPacks = getListOfApplicableMusicPacks(songListKey);
|
||||
|
||||
string subKey = songListKey;
|
||||
//Try to get more specific.
|
||||
|
||||
//This chunk is to determine song specifics for location.
|
||||
while (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
if (subKey.Length == 0) break;
|
||||
string[] subList= subKey.Split(SongSpecifics.seperator);
|
||||
if (subList.Length == 0) break; //Because things would go bad otherwise.
|
||||
subKey = "";
|
||||
for(int i = 0; i < subList.Length-1; i++)
|
||||
{
|
||||
subKey += subList[i];
|
||||
if (i != subList.Length - 2)
|
||||
{
|
||||
subKey += SongSpecifics.seperator;
|
||||
}
|
||||
}
|
||||
if (subKey == "") break;
|
||||
StardewSymphony.ModMonitor.Log(subKey,StardewModdingAPI.LogLevel.Alert);
|
||||
listOfValidMusicPacks = getListOfApplicableMusicPacks(subKey);
|
||||
if (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
//No valid songs to play at this time.
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack. Are you sure you did this properly?");
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". Are you sure you did this properly?");
|
||||
//return;
|
||||
}
|
||||
}
|
||||
|
||||
if (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
//This chunk is used to determine more general seasonal specifics if song specifics couldn't be found.
|
||||
subKey = songListKey;
|
||||
string[] season = subKey.Split(SongSpecifics.seperator);
|
||||
subKey = "";
|
||||
for (int i = 1; i < season.Length; i++)
|
||||
{
|
||||
subKey += season[i];
|
||||
if (i != season.Length - 1)
|
||||
{
|
||||
subKey += SongSpecifics.seperator;
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(subKey))
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ". Are you sure you did this properly?");
|
||||
return;
|
||||
}
|
||||
StardewSymphony.ModMonitor.Log(subKey, StardewModdingAPI.LogLevel.Alert);
|
||||
listOfValidMusicPacks = getListOfApplicableMusicPacks(subKey);
|
||||
if (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
//No valid songs to play at this time.
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". Are you sure you did this properly?");
|
||||
//return;
|
||||
}
|
||||
//Try to get more specific.
|
||||
|
||||
while (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
if (subKey.Length == 0) break;
|
||||
string[] subList = subKey.Split(SongSpecifics.seperator);
|
||||
if (subList.Length == 0) break; //Because things would go bad otherwise.
|
||||
subKey = "";
|
||||
for (int i = 0; i < subList.Length - 1; i++)
|
||||
{
|
||||
subKey += subList[i];
|
||||
if (i != subList.Length - 2)
|
||||
{
|
||||
subKey += SongSpecifics.seperator;
|
||||
}
|
||||
}
|
||||
if (subKey == "") break;
|
||||
StardewSymphony.ModMonitor.Log(subKey, StardewModdingAPI.LogLevel.Alert);
|
||||
listOfValidMusicPacks = getListOfApplicableMusicPacks(subKey);
|
||||
if (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
//No valid songs to play at this time.
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + subKey + ". Are you sure you did this properly?");
|
||||
//return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (listOfValidMusicPacks.Count == 0)
|
||||
{
|
||||
//No valid songs to play at this time.
|
||||
StardewSymphony.ModMonitor.Log("Error: There are no songs to play across any music pack for the song key: " + songListKey + ". Are you sure you did this properly?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int randInt = packSelector.Next(0, listOfValidMusicPacks.Count-1);
|
||||
|
||||
|
@ -207,25 +302,57 @@ namespace StardewSymphonyRemastered.Framework
|
|||
|
||||
var songName = musicPackPair.Value.ElementAt(randInt2);
|
||||
|
||||
this.currentMusicPack.playSong(songName);
|
||||
this.currentMusicPack.playSong(songName.name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Make WAV MUSIC PACKS
|
||||
/// </summary>
|
||||
/// <param name="wavMusicPack"></param>
|
||||
public void addMusicPack(WavMusicPack wavMusicPack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a valid xwb music pack to the list of music packs available.
|
||||
/// </summary>
|
||||
/// <param name="xwbMusicPack"></param>
|
||||
public void addMusicPack(XACTMusicPack xwbMusicPack)
|
||||
/// <param name="musicPack"></param>
|
||||
/// <param name="displayLogInformation">Whether or not to display the process to the console. Will include information from the pack's metadata. Default:False</param>
|
||||
/// <param name="xwbMusicPack">If displayLogInformation is also true this will display the name of all of the songs in the music pack when it is added in.</param>
|
||||
public void addMusicPack(MusicPack musicPack,bool displayLogInformation=false,bool displaySongs=false)
|
||||
{
|
||||
this.musicPacks.Add(xwbMusicPack.musicPackInformation.name,xwbMusicPack);
|
||||
if (displayLogInformation == true)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Adding a new music pack!");
|
||||
|
||||
|
||||
StardewSymphony.ModMonitor.Log(" Location:" + musicPack.shortenedDirectory);
|
||||
StardewSymphony.ModMonitor.Log(" Name:" + musicPack.musicPackInformation.name);
|
||||
StardewSymphony.ModMonitor.Log(" Author:" + musicPack.musicPackInformation.author);
|
||||
StardewSymphony.ModMonitor.Log(" Description:" + musicPack.musicPackInformation.description);
|
||||
StardewSymphony.ModMonitor.Log(" Version Info:" + musicPack.musicPackInformation.versionInfo);
|
||||
StardewSymphony.ModMonitor.Log(" Song List:");
|
||||
|
||||
if (displaySongs == true)
|
||||
{
|
||||
foreach(var song in musicPack.songInformation.listOfSongsWithoutTriggers)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log(" " + song.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(musicPack.GetType()==typeof(WavMusicPack)){
|
||||
foreach (var song in musicPack.songInformation.listOfSongsWithoutTriggers)
|
||||
{
|
||||
(musicPack as WavMusicPack).LoadWavFromFileToStream(song.pathToSong);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
this.musicPacks.Add(musicPack.musicPackInformation.name,musicPack);
|
||||
}
|
||||
|
||||
|
||||
public void initializeSeasonalMusic()
|
||||
{
|
||||
foreach(var pack in this.musicPacks)
|
||||
{
|
||||
pack.Value.songInformation.initializeSeasonalMusic();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -13,6 +14,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
public class MusicPack
|
||||
{
|
||||
public string directory;
|
||||
public string shortenedDirectory;
|
||||
public StardewSymphonyRemastered.Framework.SongSpecifics songInformation;
|
||||
public MusicPackMetaData musicPackInformation;
|
||||
|
||||
|
@ -52,5 +54,47 @@ namespace StardewSymphonyRemastered.Framework
|
|||
return "";
|
||||
}
|
||||
|
||||
public virtual void setModDirectoryFromFullDirectory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public virtual void writeToJson()
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Loading in music for this pack:"+this.musicPackInformation.name+". Please wait.");
|
||||
string data = Path.Combine(this.directory, "data");
|
||||
if (!Directory.Exists(data))
|
||||
{
|
||||
Directory.CreateDirectory(data);
|
||||
}
|
||||
foreach (var list in this.songInformation.listOfSongsWithTriggers)
|
||||
{
|
||||
if (list.Value.Count == 0) continue;
|
||||
SongListNode node = new SongListNode(list.Key, list.Value);
|
||||
node.WriteToJson(Path.Combine(data, node.trigger+".json"));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void readFromJson()
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Saving music for this pack:" + this.musicPackInformation.name + ". Please wait as this will take quite soem time.");
|
||||
string data = Path.Combine(this.directory, "data");
|
||||
if (!Directory.Exists(data))
|
||||
{
|
||||
Directory.CreateDirectory(data);
|
||||
}
|
||||
string[] files = Directory.GetFiles(data);
|
||||
foreach (var file in files)
|
||||
{
|
||||
SongListNode node = SongListNode.ReadFromJson(Path.Combine(data,file));
|
||||
var pair = this.songInformation.getSongList(node.trigger+".json");
|
||||
foreach (var v in node.songList)
|
||||
{
|
||||
this.songInformation.addSongToList(node.trigger, v.name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -16,7 +17,8 @@ namespace StardewSymphonyRemastered.Framework
|
|||
public string author;
|
||||
public string description;
|
||||
public string versionInfo;
|
||||
|
||||
public string pathToMusicPackIcon;
|
||||
public Texture2D Icon;
|
||||
/// <summary>
|
||||
/// Constrctor
|
||||
/// </summary>
|
||||
|
@ -24,12 +26,22 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// <param name="Author">The author who compiled ths music pack.</param>
|
||||
/// <param name="Description">The description of</param>
|
||||
/// <param name="VersionInfo"></param>
|
||||
public MusicPackMetaData(string Name,string Author,string Description,string VersionInfo)
|
||||
public MusicPackMetaData(string Name,string Author,string Description,string VersionInfo,string PathToMusicPackIcon)
|
||||
{
|
||||
this.name = Name;
|
||||
this.author = Author;
|
||||
this.description = Description;
|
||||
this.versionInfo = VersionInfo;
|
||||
this.pathToMusicPackIcon = PathToMusicPackIcon;
|
||||
try
|
||||
{
|
||||
this.Icon = StardewSymphony.ModHelper.Content.Load<Texture2D>(this.pathToMusicPackIcon);
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
this.Icon = null;
|
||||
StardewSymphony.ModMonitor.Log(err.ToString());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Blank Constructor
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// The class to be used to manage individual songs.
|
||||
///
|
||||
///
|
||||
///
|
||||
/// TODO: MAKE SMALL RELATIVE PATH TO SONG. /CONTENT/MUSIC/SONG
|
||||
/// </summary>
|
||||
public class Song
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to the song. In the case of XACT songs this points to the .xwb file. For WAV files this points directly to the WAV file itself.
|
||||
/// </summary>
|
||||
public string pathToSong;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the song itself.
|
||||
/// </summary>
|
||||
public string name;
|
||||
|
||||
/// <summary>
|
||||
/// The relative path to the song.
|
||||
/// </summary>
|
||||
public string relativePath;
|
||||
|
||||
/// <summary>
|
||||
/// Blank Constructor;
|
||||
/// </summary>
|
||||
public Song()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to be used for WAV files.
|
||||
/// </summary>
|
||||
/// <param name="PathToSong"></param>
|
||||
public Song(string PathToSong)
|
||||
{
|
||||
this.pathToSong=PathToSong;
|
||||
this.name = getNameFromPath(this.pathToSong);
|
||||
this.relativePath = this.getRelativePathFromFullPath();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to be used for XACT music packs.
|
||||
/// </summary>
|
||||
/// <param name="PathToSong"></param>
|
||||
/// <param name="Name"></param>
|
||||
public Song(string PathToSong,string Name)
|
||||
{
|
||||
this.pathToSong = PathToSong;
|
||||
this.name = Name;
|
||||
this.relativePath = this.getRelativePathFromFullPath();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse the name of the file from the path provided.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public string getNameFromPath(string path)
|
||||
{
|
||||
return Path.GetFileNameWithoutExtension(path);
|
||||
}
|
||||
|
||||
public string getRelativePathFromFullPath()
|
||||
{
|
||||
string[] spliter = this.pathToSong.Split(Path.DirectorySeparatorChar);
|
||||
string relative = "";
|
||||
int index = 0;
|
||||
foreach(var str in spliter) //iterate across all of the strings until Content is found.
|
||||
{
|
||||
|
||||
if (str == "Content")
|
||||
{
|
||||
//Once content is found add it to the relative string and append a newline character.
|
||||
for(int i = index; i < spliter.Length; i++)
|
||||
{
|
||||
relative += spliter[i];
|
||||
if (i != spliter.Length - 1)
|
||||
{
|
||||
relative += Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return relative; //Return the relative path string
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the info from a .json file.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static Song ReadFromJson(string path)
|
||||
{
|
||||
return StardewSymphony.ModHelper.ReadJsonFile<Song>(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the information of the instance to a .json file.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to which the json file is written to.</param>
|
||||
public void writeToJson(string path)
|
||||
{
|
||||
StardewSymphony.ModHelper.WriteJsonFile<Song>(path, this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework
|
||||
{
|
||||
class SongListNode
|
||||
{
|
||||
public string trigger;
|
||||
public List<Song> songList;
|
||||
|
||||
public SongListNode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SongListNode(string Trigger, List<Song> SongList)
|
||||
{
|
||||
this.trigger = Trigger;
|
||||
this.songList = SongList;
|
||||
}
|
||||
|
||||
public void WriteToJson(string path)
|
||||
{
|
||||
StardewSymphony.ModHelper.WriteJsonFile(path, this);
|
||||
}
|
||||
|
||||
public static SongListNode ReadFromJson(string path)
|
||||
{
|
||||
return StardewSymphony.ModHelper.ReadJsonFile<SongListNode>(path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -14,13 +14,13 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// </summary>
|
||||
public class SongSpecifics
|
||||
{
|
||||
Dictionary<string, List<string>> listOfSongsWithTriggers; //triggerName, <songs>
|
||||
public Dictionary<string, List<Song>> listOfSongsWithTriggers; //triggerName, <songs>
|
||||
|
||||
Dictionary<string, List<string>> eventSongs;
|
||||
public Dictionary<string, List<Song>> eventSongs;
|
||||
|
||||
Dictionary<string, List<string>> festivalSongs;
|
||||
public Dictionary<string, List<Song>> festivalSongs;
|
||||
|
||||
public List<string> listOfSongsWithoutTriggers;
|
||||
public List<Song> listOfSongsWithoutTriggers;
|
||||
|
||||
public static List<string> locations = new List<string>();
|
||||
public static List<string> festivals = new List<string>();
|
||||
|
@ -30,6 +30,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
string[] weather;
|
||||
string[] daysOfWeek;
|
||||
string[] timesOfDay;
|
||||
List<string> menus;
|
||||
public static char seperator = '_';
|
||||
|
||||
/// <summary>
|
||||
|
@ -70,15 +71,17 @@ namespace StardewSymphonyRemastered.Framework
|
|||
"day",
|
||||
"night"
|
||||
};
|
||||
menus = new List<string>();
|
||||
|
||||
listOfSongsWithTriggers = new Dictionary<string, List<string>>();
|
||||
eventSongs = new Dictionary<string, List<string>>();
|
||||
festivalSongs = new Dictionary<string, List<string>>();
|
||||
menus.Add(typeof(StardewValley.Menus.TitleMenu).ToString().Replace('.', seperator));
|
||||
|
||||
this.listOfSongsWithoutTriggers = new List<string>();
|
||||
|
||||
this.addSongLists();
|
||||
listOfSongsWithTriggers = new Dictionary<string, List<Song>>();
|
||||
eventSongs = new Dictionary<string, List<Song>>();
|
||||
festivalSongs = new Dictionary<string, List<Song>>();
|
||||
|
||||
this.listOfSongsWithoutTriggers = new List<Song>();
|
||||
this.addMenuMusic();
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,6 +99,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
public static string getCurrentConditionalString()
|
||||
{
|
||||
string key = "";
|
||||
bool foundMenuString = false;
|
||||
if (Game1.eventUp == true)
|
||||
{
|
||||
//Get the event id an hijack it with some different music
|
||||
|
@ -106,10 +110,25 @@ namespace StardewSymphonyRemastered.Framework
|
|||
//hijack the name of the festival and load some different songs
|
||||
// string s="Festival_FestivalName";
|
||||
}
|
||||
else if (Game1.activeClickableMenu!=null)
|
||||
{
|
||||
if (Game1.activeClickableMenu.GetType() == typeof(StardewValley.Menus.TitleMenu))
|
||||
{
|
||||
key = Game1.activeClickableMenu.GetType().ToString().Replace('.',seperator);
|
||||
foundMenuString = true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
key = getLocationString() + seperator + getSeasonNameString() + seperator + getWeatherString() + seperator + getDayOfWeekString() + seperator + getTimeOfDayString();
|
||||
}
|
||||
|
||||
if(foundMenuString==false && key == "")
|
||||
{
|
||||
key = getLocationString() + seperator + getSeasonNameString() + seperator + getWeatherString() + seperator + getDayOfWeekString() + seperator + getTimeOfDayString();
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -123,6 +142,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
foreach (var v in Game1.locations)
|
||||
{
|
||||
locations.Add(v.name);
|
||||
StardewSymphony.ModMonitor.Log("Adding in song triggers for location: " + v.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,6 +272,12 @@ namespace StardewSymphonyRemastered.Framework
|
|||
{
|
||||
return Game1.currentLocation.name;
|
||||
}
|
||||
|
||||
public static string getCurrentMenuString()
|
||||
{
|
||||
if (Game1.activeClickableMenu == null) return "";
|
||||
else return Game1.activeClickableMenu.GetType().ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
@ -263,9 +289,17 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// Adds the song's reference to a music pack.
|
||||
/// </summary>
|
||||
/// <param name="songName"></param>
|
||||
public void addSongToMusicPack(string songName)
|
||||
public void addSongToMusicPack(Song song)
|
||||
{
|
||||
this.listOfSongsWithoutTriggers.Add(songName);
|
||||
this.listOfSongsWithoutTriggers.Add(song);
|
||||
}
|
||||
|
||||
public void addMenuMusic()
|
||||
{
|
||||
foreach(var v in menus)
|
||||
{
|
||||
this.listOfSongsWithTriggers.Add(v, new List<Song>());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -275,28 +309,29 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// <returns></returns>
|
||||
public bool isSongInList(string songName)
|
||||
{
|
||||
return listOfSongsWithoutTriggers.Contains(songName);
|
||||
Song s = getSongFromList(listOfSongsWithoutTriggers, songName);
|
||||
return listOfSongsWithoutTriggers.Contains(s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A pretty big function to add in all of the specific songs that play at certain locations_seasons_weather_dayOfWeek_times.
|
||||
/// </summary>
|
||||
public void addSongLists()
|
||||
public void initializeSeasonalMusic()
|
||||
{
|
||||
foreach (var loc in locations)
|
||||
{
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season, new List<string>());
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season, new List<Song>());
|
||||
foreach(var Weather in weather)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List<string>());
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather, new List<Song>());
|
||||
foreach(var day in daysOfWeek)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List<string>());
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day, new List<Song>());
|
||||
foreach(var time in timesOfDay)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List<string>());
|
||||
listOfSongsWithTriggers.Add(loc + seperator + season + seperator + Weather + seperator + day + seperator + time, new List<Song>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,16 +341,16 @@ namespace StardewSymphonyRemastered.Framework
|
|||
//Add in some default seasonal music because maybe a location doesn't have some music?
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(season, new List<string>());
|
||||
listOfSongsWithTriggers.Add(season, new List<Song>());
|
||||
foreach (var Weather in weather)
|
||||
{
|
||||
listOfSongsWithTriggers.Add( season + seperator + Weather, new List<string>());
|
||||
listOfSongsWithTriggers.Add( season + seperator + Weather, new List<Song>());
|
||||
foreach (var day in daysOfWeek)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List<string>());
|
||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day, new List<Song>());
|
||||
foreach (var time in timesOfDay)
|
||||
{
|
||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List<string>());
|
||||
listOfSongsWithTriggers.Add(season + seperator + Weather + seperator + day + seperator + time, new List<Song>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,40 +363,49 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public KeyValuePair<string,List<string>>getSongList(string key)
|
||||
public KeyValuePair<string,List<Song>>getSongList(string key)
|
||||
{
|
||||
string keyPhrase = key.Split(seperator).ElementAt(0);
|
||||
|
||||
string keyPhrase = "";
|
||||
try
|
||||
{
|
||||
keyPhrase= key.Split(seperator).ElementAt(0);
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
keyPhrase = key;
|
||||
}
|
||||
if (keyPhrase == "event")
|
||||
{
|
||||
/*
|
||||
foreach (KeyValuePair<string, List<string>> pair in eventSongs)
|
||||
|
||||
foreach (KeyValuePair<string, List<Song>> pair in eventSongs)
|
||||
{
|
||||
if (pair.Key == key) return pair;
|
||||
}
|
||||
*/
|
||||
return new KeyValuePair<string, List<string>>(key, eventSongs[key]);
|
||||
|
||||
//return new KeyValuePair<string, List<Song>>(key, eventSongs[key]);
|
||||
}
|
||||
else if (keyPhrase == "festival")
|
||||
{
|
||||
/*
|
||||
foreach (KeyValuePair<string, List<string>> pair in festivalSongs)
|
||||
|
||||
foreach (KeyValuePair<string, List<Song>> pair in festivalSongs)
|
||||
{
|
||||
if (pair.Key == key) return pair;
|
||||
}
|
||||
*/
|
||||
return new KeyValuePair<string, List<string>>(key, festivalSongs[key]);
|
||||
|
||||
//return new KeyValuePair<string, List<string>>(key, festivalSongs[key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
foreach(KeyValuePair<string,List<string>> pair in listOfSongsWithTriggers)
|
||||
|
||||
foreach(KeyValuePair<string,List<Song>> pair in listOfSongsWithTriggers)
|
||||
{
|
||||
//StardewSymphony.ModMonitor.Log(pair.Key);
|
||||
if (pair.Key == key) return pair;
|
||||
}
|
||||
*/
|
||||
return new KeyValuePair<string, List<string>>(key, listOfSongsWithTriggers[key]);
|
||||
|
||||
//return new KeyValuePair<string, List<string>>(key, listOfSongsWithTriggers[key]);
|
||||
}
|
||||
return new KeyValuePair<string, List<Song>>("",null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -371,9 +415,9 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// <param name="songName"></param>
|
||||
public void addSongToList(string songListKey,string songName)
|
||||
{
|
||||
var songList = getSongList(songListKey);
|
||||
|
||||
songList.Value.Add(songName);
|
||||
var songKeyPair = getSongList(songListKey);
|
||||
var song = getSongFromList(songKeyPair.Value, songName);
|
||||
songKeyPair.Value.Add(song);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -383,8 +427,24 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// <param name="songName"></param>
|
||||
public void removeSongFromList(string songListKey,string songName)
|
||||
{
|
||||
var songList = getSongList(songListKey);
|
||||
songList.Value.Remove(songName);
|
||||
var songKeyPair = getSongList(songListKey);
|
||||
var song = getSongFromList(songKeyPair.Value, songName);
|
||||
songKeyPair.Value.Remove(song);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Song instance that is referenced with the song's name.
|
||||
/// </summary>
|
||||
/// <param name="songList"></param>
|
||||
/// <param name="songName"></param>
|
||||
/// <returns></returns>
|
||||
public Song getSongFromList(List<Song> songList,string songName)
|
||||
{
|
||||
foreach(var song in songList)
|
||||
{
|
||||
if (song.name == songName) return song;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -11,5 +14,224 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// </summary>
|
||||
public class WavMusicPack : MusicPack
|
||||
{
|
||||
public Song currentSong;
|
||||
public string songsDirectory;
|
||||
|
||||
/// <summary>
|
||||
/// Used to actually play the song.
|
||||
/// </summary>
|
||||
DynamicSoundEffectInstance dynamicSound;
|
||||
/// <summary>
|
||||
/// Used to keep track of where in the song we are.
|
||||
/// </summary>
|
||||
int position;
|
||||
/// <summary>
|
||||
/// ???
|
||||
/// </summary>
|
||||
int count;
|
||||
/// <summary>
|
||||
/// Used to store the info for the song.
|
||||
/// </summary>
|
||||
byte[] byteArray;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="directoryToMusicPack"></param>
|
||||
public WavMusicPack(string directoryToMusicPack)
|
||||
{
|
||||
this.directory = directoryToMusicPack;
|
||||
this.setModDirectoryFromFullDirectory();
|
||||
this.songsDirectory = Path.Combine(this.directory, "Songs");
|
||||
this.songInformation = new SongSpecifics();
|
||||
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToMusicPack, "MusicPackInformation.json"));
|
||||
|
||||
if (this.musicPackInformation == null)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToMusicPack + ". Blank information will be put in place.", StardewModdingAPI.LogLevel.Warn);
|
||||
this.musicPackInformation = new MusicPackMetaData("???", "???", "", "0.0.0","");
|
||||
}
|
||||
this.loadMusicFiles();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A shortened directory name for display purposes.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override void setModDirectoryFromFullDirectory()
|
||||
{
|
||||
string[] spliter = this.directory.Split(Path.DirectorySeparatorChar);
|
||||
string directoryLocation = "";
|
||||
for (int i = spliter.Length - 6; i < spliter.Length; i++)
|
||||
{
|
||||
directoryLocation += spliter[i];
|
||||
|
||||
if (i != spliter.Length - 1)
|
||||
{
|
||||
directoryLocation += Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
this.shortenedDirectory = directoryLocation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load a wav file into the stream to be played.
|
||||
/// </summary>
|
||||
public void LoadWavFromFileToStream(string p)
|
||||
{
|
||||
// Create a new SpriteBatch, which can be used to draw textures.
|
||||
|
||||
string file =p;
|
||||
System.IO.Stream waveFileStream = File.OpenRead(file); //TitleContainer.OpenStream(file);
|
||||
|
||||
BinaryReader reader = new BinaryReader(waveFileStream);
|
||||
|
||||
int chunkID = reader.ReadInt32();
|
||||
int fileSize = reader.ReadInt32();
|
||||
int riffType = reader.ReadInt32();
|
||||
int fmtID = reader.ReadInt32();
|
||||
int fmtSize = reader.ReadInt32();
|
||||
int fmtCode = reader.ReadInt16();
|
||||
int channels = reader.ReadInt16();
|
||||
int sampleRate = reader.ReadInt32();
|
||||
int fmtAvgBPS = reader.ReadInt32();
|
||||
int fmtBlockAlign = reader.ReadInt16();
|
||||
int bitDepth = reader.ReadInt16();
|
||||
|
||||
if (fmtSize == 18)
|
||||
{
|
||||
// Read any extra values
|
||||
int fmtExtraSize = reader.ReadInt16();
|
||||
reader.ReadBytes(fmtExtraSize);
|
||||
}
|
||||
|
||||
int dataID = reader.ReadInt32();
|
||||
int dataSize = reader.ReadInt32();
|
||||
|
||||
byteArray = reader.ReadBytes(dataSize);
|
||||
|
||||
dynamicSound = new DynamicSoundEffectInstance(sampleRate, (AudioChannels)channels);
|
||||
count = dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(100));
|
||||
|
||||
dynamicSound.BufferNeeded += new EventHandler<EventArgs>(DynamicSound_BufferNeeded);
|
||||
this.currentSong = new Song(p);
|
||||
}
|
||||
|
||||
void DynamicSound_BufferNeeded(object sender, EventArgs e)
|
||||
{
|
||||
dynamicSound.SubmitBuffer(byteArray, position, count / 2);
|
||||
dynamicSound.SubmitBuffer(byteArray, position + count / 2, count / 2);
|
||||
|
||||
position += count;
|
||||
if (position + count > byteArray.Length)
|
||||
{
|
||||
position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the currently playing song.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string getNameOfCurrentSong()
|
||||
{
|
||||
if (this.currentSong == null) return "";
|
||||
return this.currentSong.name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load in the music files from the pack's respective Directory/Songs folder. Typically Content/Music/Wav/FolderName/Songs
|
||||
/// </summary>
|
||||
public override void loadMusicFiles()
|
||||
{
|
||||
string[] wavFiles = Directory.GetFiles(this.songsDirectory, "*.wav");
|
||||
List<Song> listOfSongs = new List<Song>();
|
||||
foreach(var wav in wavFiles)
|
||||
{
|
||||
Song song = new Song(wav);
|
||||
listOfSongs.Add(song);
|
||||
}
|
||||
this.songInformation.listOfSongsWithoutTriggers = listOfSongs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to pause the current song.
|
||||
/// </summary>
|
||||
public override void pauseSong()
|
||||
{
|
||||
if (dynamicSound != null) dynamicSound.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to play a song.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public override void playSong(string name)
|
||||
{
|
||||
string pathToSong = getSongPathFromName(name);
|
||||
LoadWavFromFileToStream(pathToSong);
|
||||
dynamicSound.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to resume the currently playing song.
|
||||
/// </summary>
|
||||
public override void resumeSong()
|
||||
{
|
||||
if (dynamicSound == null) return;
|
||||
dynamicSound.Resume();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to stop the currently playing song.
|
||||
/// </summary>
|
||||
public override void stopSong()
|
||||
{
|
||||
if (dynamicSound != null)
|
||||
{
|
||||
dynamicSound.Stop();
|
||||
dynamicSound = null;
|
||||
this.currentSong = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to change from one playing song to another;
|
||||
/// </summary>
|
||||
/// <param name="songName"></param>
|
||||
public override void swapSong(string songName)
|
||||
{
|
||||
this.stopSong();
|
||||
this.playSong(songName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the son's name from the path.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public string getSongNameFromPath(string path)
|
||||
{
|
||||
foreach(var song in this.songInformation.listOfSongsWithoutTriggers)
|
||||
{
|
||||
if (song.pathToSong == path) return song.name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the song's path that shares the same name.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public string getSongPathFromName(string name)
|
||||
{
|
||||
foreach (var song in this.songInformation.listOfSongsWithoutTriggers)
|
||||
{
|
||||
if (song.name == name) return song.pathToSong;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,33 +17,36 @@ namespace StardewSymphonyRemastered.Framework
|
|||
public Microsoft.Xna.Framework.Audio.WaveBank WaveBank;
|
||||
public Microsoft.Xna.Framework.Audio.SoundBank SoundBank;
|
||||
|
||||
|
||||
|
||||
public Cue currentCue;
|
||||
|
||||
|
||||
//Make Music pack meta data. Includes author, version, description.
|
||||
|
||||
public string XWBPath;
|
||||
public string WaveBankPath;
|
||||
public string SoundBankPath;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="directoryToXwb"></param>
|
||||
/// <param name="pathToXWB"></param>
|
||||
public XACTMusicPack(string directoryToXwb,string pathToXWB)
|
||||
/// <param name="pathToWaveBank"></param>
|
||||
/// <param name="pathToSoundBank"></param>
|
||||
public XACTMusicPack(string directoryToXwb,string pathToWaveBank,string pathToSoundBank)
|
||||
{
|
||||
this.directory = directoryToXwb;
|
||||
this.XWBPath = pathToXWB;
|
||||
this.WaveBankPath = pathToWaveBank;
|
||||
this.SoundBankPath = pathToSoundBank;
|
||||
this.setModDirectoryFromFullDirectory();
|
||||
this.songInformation = new SongSpecifics();
|
||||
this.currentCue = null;
|
||||
this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToXwb, "MusicPackInformation.json"));
|
||||
if (this.musicPackInformation == null)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToXwb + ". Blank information will be put in place.",StardewModdingAPI.LogLevel.Warn);
|
||||
this.musicPackInformation = new MusicPackMetaData("???","???","","0.0.0");
|
||||
this.musicPackInformation = new MusicPackMetaData("???","???","","0.0.0","");
|
||||
}
|
||||
|
||||
this.WaveBank = new WaveBank(Game1.audioEngine, this.WaveBankPath);
|
||||
this.SoundBank = new SoundBank(Game1.audioEngine,this.SoundBankPath);
|
||||
this.loadMusicFiles();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -51,7 +54,21 @@ namespace StardewSymphonyRemastered.Framework
|
|||
/// </summary>
|
||||
public override void loadMusicFiles()
|
||||
{
|
||||
this.songInformation.listOfSongsWithoutTriggers=StardewSymphonyRemastered.Framework.MusicHexProcessor.ProcessSongNamesFromHex(this,StardewSymphony.Reset,this.XWBPath);
|
||||
|
||||
var listOfSongStrings = StardewSymphonyRemastered.Framework.MusicHexProcessor.ProcessSongNamesFromHex(this, StardewSymphony.Reset, this.SoundBankPath);
|
||||
|
||||
List<Song> listofSongs = new List<Song>();
|
||||
foreach(var songname in listOfSongStrings)
|
||||
{
|
||||
Song song = new Song(this.WaveBankPath, songname);
|
||||
listofSongs.Add(song);
|
||||
}
|
||||
|
||||
this.songInformation.listOfSongsWithoutTriggers = listofSongs;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,7 +79,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
private Cue getCue(string name) {
|
||||
if (this.songInformation.isSongInList(name) == false)
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("Error! The song " + name + " could not be found in music pack " + this.musicPackInformation.name+". Please ensure that this song is part of this music pack located at: "+ this.XWBPath+ " or contact the music pack author: "+this.musicPackInformation.author,StardewModdingAPI.LogLevel.Error);
|
||||
StardewSymphony.ModMonitor.Log("Error! The song " + name + " could not be found in music pack " + this.musicPackInformation.name+". Please ensure that this song is part of this music pack located at: "+ this.WaveBankPath+ " or contact the music pack author: "+this.musicPackInformation.author,StardewModdingAPI.LogLevel.Error);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
|
@ -156,5 +173,25 @@ namespace StardewSymphonyRemastered.Framework
|
|||
return this.currentCue.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a shortened directory name for display purposes.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override void setModDirectoryFromFullDirectory()
|
||||
{
|
||||
string[] spliter = this.WaveBankPath.Split(Path.DirectorySeparatorChar);
|
||||
string directoryLocation="";
|
||||
for (int i = spliter.Length - 5; i < spliter.Length; i++)
|
||||
{
|
||||
directoryLocation += spliter[i];
|
||||
|
||||
if (i != spliter.Length - 1)
|
||||
{
|
||||
directoryLocation += Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
this.shortenedDirectory = directoryLocation;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,7 @@ namespace StardewSymphonyRemastered
|
|||
/// BIG WIP. Don't use this at all because it does nothing right now.
|
||||
/// TODO:
|
||||
/// 1.Make Xwb packs work
|
||||
/// 1.5. Make way to load in music packs.
|
||||
/// 2.Make stream files work
|
||||
/// 2.5. Make Music Manager
|
||||
/// 3.Make interface.
|
||||
/// 4.Make sure stuff doesn't blow up.
|
||||
/// 5.Release
|
||||
|
@ -42,7 +40,12 @@ namespace StardewSymphonyRemastered
|
|||
public static string XACTMusicDirectory;
|
||||
public static string TemplateMusicDirectory;
|
||||
|
||||
public bool musicPacksInitialized;
|
||||
|
||||
/// <summary>
|
||||
/// Entry point for the mod.
|
||||
/// </summary>
|
||||
/// <param name="helper"></param>
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
DefaultSoundBank = Game1.soundBank;
|
||||
|
@ -52,7 +55,9 @@ namespace StardewSymphonyRemastered
|
|||
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
StardewModdingAPI.Events.LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged;
|
||||
|
||||
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||
StardewModdingAPI.Events.ControlEvents.KeyPressed += ControlEvents_KeyPressed;
|
||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||
musicManager = new MusicManager();
|
||||
|
||||
MusicPath = Path.Combine(ModHelper.DirectoryPath, "Content", "Music");
|
||||
|
@ -62,9 +67,58 @@ namespace StardewSymphonyRemastered
|
|||
|
||||
this.createDirectories();
|
||||
this.createBlankXACTTemplate();
|
||||
//load in all packs here.
|
||||
this.createBlankWAVTemplate();
|
||||
|
||||
musicPacksInitialized = false;
|
||||
}
|
||||
|
||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
||||
{
|
||||
/* THIS IS WAY TO LONG to run. Better make it save individual lists when I am editing songs.
|
||||
foreach(var musicPack in musicManager.musicPacks)
|
||||
{
|
||||
musicPack.Value.writeToJson();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
|
||||
{
|
||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
|
||||
{
|
||||
Game1.activeClickableMenu = new StardewSymphonyRemastered.Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Raised every frame. Mainly used just to initiate the music packs. Probably not needed.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||
{
|
||||
if (musicPacksInitialized == false)
|
||||
{
|
||||
initializeMusicPacks();
|
||||
musicPacksInitialized = true;
|
||||
musicManager.selectMusic(SongSpecifics.getCurrentConditionalString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load in the music packs to the music manager.
|
||||
/// </summary>
|
||||
public void initializeMusicPacks()
|
||||
{
|
||||
//load in all packs here.
|
||||
loadXACTMusicPacks();
|
||||
loadWAVMusicPacks();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the core directories needed by the mod.
|
||||
/// </summary>
|
||||
public void createDirectories()
|
||||
{
|
||||
if (!Directory.Exists(MusicPath)) Directory.CreateDirectory(MusicPath);
|
||||
|
@ -72,6 +126,11 @@ namespace StardewSymphonyRemastered
|
|||
if (!Directory.Exists(XACTMusicDirectory)) Directory.CreateDirectory(XACTMusicDirectory);
|
||||
if (!Directory.Exists(TemplateMusicDirectory)) Directory.CreateDirectory(TemplateMusicDirectory);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to create a blank XACT music pack example.
|
||||
/// </summary>
|
||||
public void createBlankXACTTemplate()
|
||||
{
|
||||
string path= Path.Combine(TemplateMusicDirectory, "XACT");
|
||||
|
@ -80,46 +139,116 @@ namespace StardewSymphonyRemastered
|
|||
Directory.CreateDirectory(path);
|
||||
}
|
||||
if(!File.Exists(Path.Combine(path, "MusicPackInformation.json"))){
|
||||
MusicPackMetaData blankMetaData = new MusicPackMetaData();
|
||||
MusicPackMetaData blankMetaData = new MusicPackMetaData("Omegas's Music Data Example","Omegasis","Just a simple example of how metadata is formated for music packs. Feel free to copy and edit this one!","1.0.0 CoolExample","Icon.png");
|
||||
blankMetaData.writeToJson(Path.Combine(path, "MusicPackInformation.json"));
|
||||
}
|
||||
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||
{
|
||||
string info = "Place the Wave Bank.xwb file and Sound Bank.xsb file you created in XACT in a similar directory in Content/Music/XACT/SoundPackName with a new meta data to load it!";
|
||||
string info = "Place the Wave Bank.xwb file and Sound Bank.xsb file you created in XACT in a similar directory in Content/Music/XACT/SoundPackName.\nModify MusicPackInformation.json as desire!\nRun the mod!";
|
||||
File.WriteAllText(Path.Combine(path, "readme.txt"),info);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// USed to create a blank WAV music pack example.
|
||||
/// </summary>
|
||||
public void createBlankWAVTemplate()
|
||||
{
|
||||
string path = Path.Combine(TemplateMusicDirectory, "WAV");
|
||||
string pathSongs = Path.Combine(path, "Songs");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
if (!Directory.Exists(pathSongs))
|
||||
{
|
||||
Directory.CreateDirectory(pathSongs);
|
||||
}
|
||||
if (!File.Exists(Path.Combine(path, "MusicPackInformation.json")))
|
||||
{
|
||||
MusicPackMetaData blankMetaData = new MusicPackMetaData("Omegas's Music Data Example", "Omegasis", "Just a simple example of how metadata is formated for music packs. Feel free to copy and edit this one!", "1.0.0 CoolExample","Icon");
|
||||
blankMetaData.writeToJson(Path.Combine(path, "MusicPackInformation.json"));
|
||||
}
|
||||
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||
{
|
||||
string info = "Place the .wav song files in the Songs folder, modify the MusicPackInformation.json as desired, and then run!";
|
||||
File.WriteAllText(Path.Combine(path, "readme.txt"), info);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load in the XACT music packs.
|
||||
/// </summary>
|
||||
public static void loadXACTMusicPacks()
|
||||
{
|
||||
string[] listOfDirectories= Directory.GetDirectories(XACTMusicDirectory);
|
||||
foreach(string folder in listOfDirectories)
|
||||
{
|
||||
string waveBank = Path.Combine(folder, "Wave Bank.xwb");
|
||||
string soundBank = Path.Combine(folder, "Sound Bank.xwb");
|
||||
string metaData = Path.Combine(folder, "MusicPackInformation.json");
|
||||
if (!File.Exists(waveBank))
|
||||
//This chunk essentially allows people to name .xwb and .xsb files whatever they want.
|
||||
string[] xwb=Directory.GetFiles(folder, "*.xwb");
|
||||
string[] xsb = Directory.GetFiles(folder, "*.xsb");
|
||||
|
||||
string[] debug = Directory.GetFiles(folder);
|
||||
if (xwb.Length == 0)
|
||||
{
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no file Wave Bank.xwb located in this directory. AKA there is no valid music here.", LogLevel.Error);
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no wave bank music file: .xwb located in this directory. AKA there is no valid music here.", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
if (xwb.Length >= 2)
|
||||
{
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There are too many wave bank music files or .xwbs located in this directory. Please ensure that there is only one music pack in this folder. You can make another music pack but putting a wave bank file in a different folder.", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(soundBank))
|
||||
if (xsb.Length == 0)
|
||||
{
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no file Sound Bank.xwb located in this directory. This is needed to play the music from Wave Bank.xwb", LogLevel.Error);
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There is no sound bank music file: .xsb located in this directory. AKA there is no valid music here.", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
if (xsb.Length >= 2)
|
||||
{
|
||||
ModMonitor.Log("Error loading in attempting to load music pack from: " + folder + ". There are too many sound bank music files or .xsbs located in this directory. Please ensure that there is only one sound reference file in this folder. You can make another music pack but putting a sound file in a different folder.", LogLevel.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
string waveBank = xwb[0];
|
||||
string soundBank = xsb[0];
|
||||
string metaData = Path.Combine(folder, "MusicPackInformation.json");
|
||||
|
||||
if (!File.Exists(metaData))
|
||||
{
|
||||
ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error);
|
||||
}
|
||||
StardewSymphonyRemastered.Framework.XACTMusicPack musicPack = new XACTMusicPack(folder, waveBank);
|
||||
musicManager.addMusicPack(musicPack);
|
||||
StardewSymphonyRemastered.Framework.XACTMusicPack musicPack = new XACTMusicPack(folder, waveBank,soundBank);
|
||||
musicManager.addMusicPack(musicPack,true,true);
|
||||
|
||||
musicPack.readFromJson();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load in WAV music packs.
|
||||
/// </summary>
|
||||
public static void loadWAVMusicPacks()
|
||||
{
|
||||
string[] listOfDirectories = Directory.GetDirectories(WavMusicDirectory);
|
||||
foreach (string folder in listOfDirectories)
|
||||
{
|
||||
string metaData = Path.Combine(folder, "MusicPackInformation.json");
|
||||
|
||||
if (!File.Exists(metaData))
|
||||
{
|
||||
ModMonitor.Log("WARNING! Loading in a music pack from: " + folder + ". There is no MusicPackInformation.json associated with this music pack meaning that while songs can be played from this pack, no information about it will be displayed.", LogLevel.Error);
|
||||
}
|
||||
|
||||
StardewSymphonyRemastered.Framework.WavMusicPack musicPack = new WavMusicPack(folder);
|
||||
musicManager.addMusicPack(musicPack,true,true);
|
||||
|
||||
musicPack.readFromJson();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the player changes locations. This should determine the next song to play.
|
||||
|
@ -141,9 +270,7 @@ namespace StardewSymphonyRemastered
|
|||
StardewSymphonyRemastered.Framework.SongSpecifics.addLocations();
|
||||
StardewSymphonyRemastered.Framework.SongSpecifics.addFestivals();
|
||||
StardewSymphonyRemastered.Framework.SongSpecifics.addEvents();
|
||||
|
||||
|
||||
|
||||
musicManager.initializeSeasonalMusic();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="StardustCore">
|
||||
<HintPath>..\..\StardustCore\bin\Release\StardustCore.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
@ -42,7 +45,10 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Framework\Menus\MusicManagerMenu.cs" />
|
||||
<Compile Include="Framework\MusicPackMetaData.cs" />
|
||||
<Compile Include="Framework\Song.cs" />
|
||||
<Compile Include="Framework\SongListNode.cs" />
|
||||
<Compile Include="StaticExtentions.cs" />
|
||||
<Compile Include="StardewSymphony.cs" />
|
||||
<Compile Include="Framework\MusicHexProcessor.cs" />
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"Name": "Stardew Symphony",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "2.0.0",
|
||||
"Description": "Adding more music to the game one beep at a time. Now with streaming!",
|
||||
"UniqueID": "Omegasis.StardewSymphony",
|
||||
"EntryDll": "StardewSymphonyRemastered.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ "Nexus:425" ]
|
||||
}
|
|
@ -120,10 +120,17 @@ namespace StardustCore.Animations
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the animation manager to an on state, meaning that this animation will update on the draw frame.
|
||||
/// </summary>
|
||||
public void enableAnimation()
|
||||
{
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the animation manager to an off state, meaning that this animation will no longer update on the draw frame.
|
||||
/// </summary>
|
||||
public void disableAnimation()
|
||||
{
|
||||
this.enabled = false;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace StardustCore.IlluminateFramework
|
|||
/// <summary>
|
||||
/// Make sure all colors are inverted.
|
||||
/// </summary>
|
||||
public class ColorsList
|
||||
public class LightColorsList
|
||||
{
|
||||
public static Color AliceBlue = new Color(15, 7, 0, 255);
|
||||
|
||||
|
@ -639,7 +639,7 @@ namespace StardustCore.IlluminateFramework
|
|||
|
||||
}
|
||||
|
||||
public Color getColorFromList(string s)
|
||||
public static Color getColorFromList(string s)
|
||||
{
|
||||
Color color;
|
||||
bool f = ColorDictionary.TryGetValue(s, out color);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.StardustMath
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for hex representation.
|
||||
/// </summary>
|
||||
public class Hex
|
||||
{
|
||||
/// <summary>
|
||||
/// The hex value represented as a string.
|
||||
/// </summary>
|
||||
public string hexValue;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public Hex()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Empty Constructor;
|
||||
/// </summary>
|
||||
/// <param name="HexValue"></param>
|
||||
public Hex(string HexValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that the hex is of the specified length.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool verifyHexLength()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trims the hex value by removing the leading 0x;
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual string trimHex()
|
||||
{
|
||||
return this.hexValue.Split('x')[1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A virtual function to be overriden.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual List<string> getBytes()
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Hex byte (represented as a length two string) to an int equal or less than 255. Ex ff=255;
|
||||
/// </summary>
|
||||
/// <param name="value">The length two value to be converted.</param>
|
||||
/// <returns></returns>
|
||||
public virtual int convertHexByteTo255Int(string value)
|
||||
{
|
||||
int val1 = convertHexValueToInt(value[0]);
|
||||
int val2 = convertHexValueToInt(value[1]);
|
||||
val1 *= 16;
|
||||
val2 *= 16;
|
||||
return val1 + val2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a hex char to an int.
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int convertHexValueToInt(char c)
|
||||
{
|
||||
if (c == 'a') return 10;
|
||||
else if (c == 'b') return 11;
|
||||
else if (c == 'c') return 12;
|
||||
else if (c == 'd') return 13;
|
||||
else if (c == 'e') return 14;
|
||||
else if (c == 'f') return 15;
|
||||
else return Convert.ToInt32(c);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the associated byte from the hex positioning.
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public virtual string getByte(int index)
|
||||
{
|
||||
string hex = this.trimHex();
|
||||
int val = index * 2 + 1;
|
||||
char str1 = hex[index * 2];
|
||||
char str2 = hex[val];
|
||||
return (str1.ToString() + str2.ToString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.StardustMath
|
||||
{
|
||||
/// <summary>
|
||||
/// A Class that helps represents 32 bit hex.
|
||||
/// </summary>
|
||||
class Hex32 : Hex
|
||||
{
|
||||
/// <summary>
|
||||
/// A default constructor.
|
||||
/// </summary>
|
||||
public Hex32()
|
||||
{
|
||||
this.hexValue = "0x00000000";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="hexValue">A string in hex representation. Ex) 0x00000000</param>
|
||||
public Hex32(string hexValue)
|
||||
{
|
||||
this.hexValue = hexValue;
|
||||
if (verifyHexLength() == false) this.hexValue = "0x00000000";
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="value">An int to be converted into Hex.</param>
|
||||
public Hex32(int value)
|
||||
{
|
||||
this.hexValue= value.ToString("X");
|
||||
if (verifyHexLength() == false) this.hexValue = "0x00000000";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Makes sure the hex value is the appropriate length.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool verifyHexLength()
|
||||
{
|
||||
if (this.hexValue.Length != 10) return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trims the hex to get rid of the leading 0x;
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string trimHex()
|
||||
{
|
||||
return base.trimHex();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a hex value to a string.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Color toColor()
|
||||
{
|
||||
var bytes = getBytes();
|
||||
int red = convertHexByteTo255Int(bytes[0]);
|
||||
int green = convertHexByteTo255Int(bytes[1]);
|
||||
int blue = convertHexByteTo255Int(bytes[2]);
|
||||
int alpha = convertHexByteTo255Int(bytes[3]);
|
||||
return new Color(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the individual byte strings associated with this hex value.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override List<string> getBytes()
|
||||
{
|
||||
List<string> bytes = new List<string>();
|
||||
bytes.Add(getByte(0));
|
||||
bytes.Add(getByte(1));
|
||||
bytes.Add(getByte(2));
|
||||
bytes.Add(getByte(3));
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,14 +18,16 @@ namespace StardustCore
|
|||
public static IModHelper ModHelper;
|
||||
public static IMonitor ModMonitor;
|
||||
public static Serialization.SerializationManager SerializationManager;
|
||||
|
||||
public static string ContentDirectory;
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = helper;
|
||||
ModMonitor = this.Monitor;
|
||||
ModMonitor = Monitor;
|
||||
//Unused MetaData information. Works in player inventory but not in chests. Besides who really care where an object is from anyways. Also doesn't work 100% like I intended since it only gets base mod object that this runs from, not extensions?
|
||||
|
||||
// StardewModdingAPI.Events.GraphicsEvents.OnPostRenderGuiEvent += Metadata.GameEvents_UpdateTick;
|
||||
StardewModdingAPI.Events.ControlEvents.MouseChanged += ControlEvents_MouseChanged;
|
||||
//StardewModdingAPI.Events.ControlEvents.MouseChanged += ControlEvents_MouseChanged;
|
||||
string invPath = Path.Combine(ModCore.ModHelper.DirectoryPath, "PlayerData", Game1.player.name, "PlayerInventory");
|
||||
string worldPath = Path.Combine(ModCore.ModHelper.DirectoryPath, Game1.player.name, "ObjectsInWorld"); ;
|
||||
string trashPath = Path.Combine(ModCore.ModHelper.DirectoryPath, "ModTrashFolder");
|
||||
|
@ -36,8 +38,10 @@ namespace StardustCore
|
|||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
|
||||
|
||||
IlluminateFramework.Colors.initializeColors();
|
||||
ContentDirectory = Path.Combine(ModHelper.DirectoryPath, "Content");
|
||||
if (!Directory.Exists(ContentDirectory)) Directory.CreateDirectory(ContentDirectory);
|
||||
UIUtilities.SpriteFonts.SpriteFont.initialize();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,15 @@
|
|||
<Compile Include="Animations\Animation.cs" />
|
||||
<Compile Include="Animations\AnimationManager.cs" />
|
||||
<Compile Include="IlluminateFramework\Colors.cs" />
|
||||
<Compile Include="Math\Hex.cs" />
|
||||
<Compile Include="Math\Hex32.cs" />
|
||||
<Compile Include="UIUtilities\LayeredTexture.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\CharacterSheets\GenericCharacterSheets.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\CharacterSheets\VanillaCharacterSheet.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\Fonts\Components\CharacterSpacing.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\Fonts\GenericFont.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\Fonts\Components\TexturedCharacter.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\Fonts\Components\TexturedString.cs" />
|
||||
<Compile Include="ModCore.cs" />
|
||||
<Compile Include="CoreObject.cs" />
|
||||
<Compile Include="ModInfo\Metadata.cs" />
|
||||
|
@ -52,12 +61,17 @@
|
|||
<Compile Include="Serialization\Serialization.cs" />
|
||||
<Compile Include="Serialization\SerializerDataNode.cs" />
|
||||
<Compile Include="StaticClass.cs" />
|
||||
<Compile Include="UIUtilities\MenuComponents\Button.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\Fonts\VanillaFont.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\SpriteFont.cs" />
|
||||
<Compile Include="UIUtilities\Texture2DExtended.cs" />
|
||||
<Compile Include="Utilities.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<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')" />
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities
|
||||
{
|
||||
public class LayeredTexture
|
||||
{
|
||||
public List<Texture2DExtended> textureLayers;
|
||||
|
||||
public LayeredTexture(List<Texture2DExtended> textures)
|
||||
{
|
||||
this.textureLayers = textures;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new texture as the top layer.
|
||||
/// </summary>
|
||||
/// <param name="texture"></param>
|
||||
public void addTexture(Texture2DExtended texture)
|
||||
{
|
||||
this.textureLayers.Add(texture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new texture at a specific layer depth.
|
||||
/// </summary>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="index"></param>
|
||||
public void addTexture(Texture2DExtended texture, int index)
|
||||
{
|
||||
this.textureLayers.Insert(index, texture);
|
||||
}
|
||||
|
||||
public LayeredTexture Copy()
|
||||
{
|
||||
return new LayeredTexture(this.textureLayers);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.MenuComponents
|
||||
{
|
||||
public class Button : StardewValley.Menus.ClickableTextureComponent
|
||||
{
|
||||
public Animations.AnimationManager animationManager;
|
||||
public Color textureColor;
|
||||
public Color textColor;
|
||||
/// <summary>
|
||||
/// Basic Button constructor.
|
||||
/// </summary>
|
||||
/// <param name="Bounds"></param>
|
||||
/// <param name="Texture"></param>
|
||||
/// <param name="sourceRect"></param>
|
||||
/// <param name="Scale"></param>
|
||||
/// <param name="defaultAnimation"></param>
|
||||
/// <param name="AnimationEnabled"></param>
|
||||
public Button(string Name,Rectangle Bounds,Texture2D Texture,string displayText,Rectangle sourceRect,float Scale,Animations.Animation defaultAnimation, Color DrawColor,Color TextColor, bool AnimationEnabled=true) : base(Bounds,Texture,sourceRect,Scale)
|
||||
{
|
||||
this.animationManager = new Animations.AnimationManager(Texture, defaultAnimation,AnimationEnabled);
|
||||
this.label = displayText;
|
||||
this.name = Name;
|
||||
this.textureColor = DrawColor;
|
||||
if (this.textureColor == null)
|
||||
{
|
||||
this.textureColor = StardustCore.IlluminateFramework.Colors.getColorFromList("White");
|
||||
}
|
||||
this.textColor = DrawColor;
|
||||
if (this.textColor == null)
|
||||
{
|
||||
this.textColor = StardustCore.IlluminateFramework.Colors.getColorFromList("White");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A more advanced Button constructor that deals with an animation manager.
|
||||
/// </summary>
|
||||
/// <param name="Name"></param>
|
||||
/// <param name="Bounds"></param>
|
||||
/// <param name="Texture"></param>
|
||||
/// <param name="displayText"></param>
|
||||
/// <param name="sourceRect"></param>
|
||||
/// <param name="Scale"></param>
|
||||
/// <param name="defaultAnimation"></param>
|
||||
/// <param name="animationsToPlay"></param>
|
||||
/// <param name="startingAnimationKey"></param>
|
||||
/// <param name="startingAnimationFrame"></param>
|
||||
/// <param name="AnimationEnabled"></param>
|
||||
public Button(string Name,Rectangle Bounds,Texture2D Texture, string displayText, Rectangle sourceRect,float Scale, Animations.Animation defaultAnimation,Dictionary<string, List<Animations.Animation>> animationsToPlay,string startingAnimationKey,Color DrawColor,Color TextColor,int startingAnimationFrame=0,bool AnimationEnabled=true) : base(Bounds, Texture, sourceRect, Scale)
|
||||
{
|
||||
this.animationManager = new Animations.AnimationManager(Texture, defaultAnimation, animationsToPlay, startingAnimationKey, startingAnimationFrame, AnimationEnabled);
|
||||
this.label = displayText;
|
||||
this.name = Name;
|
||||
this.textureColor = DrawColor;
|
||||
if (this.textureColor == null)
|
||||
{
|
||||
this.textureColor = StardustCore.IlluminateFramework.Colors.getColorFromList("White");
|
||||
}
|
||||
this.textColor = DrawColor;
|
||||
if (this.textColor == null)
|
||||
{
|
||||
this.textColor = StardustCore.IlluminateFramework.Colors.getColorFromList("White");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the button and all of it's components.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="layerDepth"></param>
|
||||
public void draw(SpriteBatch b, float layerDepth)
|
||||
{
|
||||
|
||||
this.animationManager.tickAnimation();
|
||||
if (!this.visible)
|
||||
return;
|
||||
if (this.drawShadow)
|
||||
Utility.drawWithShadow(b, this.texture, new Vector2((float)this.bounds.X + (float)(this.sourceRect.Width / 2) * this.baseScale, (float)this.bounds.Y + (float)(this.sourceRect.Height / 2) * this.baseScale), this.sourceRect, this.textureColor, 0.0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, false, layerDepth, -1, -1, 0.35f);
|
||||
else
|
||||
b.Draw(this.texture, new Vector2((float)this.bounds.X + (float)(this.sourceRect.Width / 2) * this.baseScale, (float)this.bounds.Y + (float)(this.sourceRect.Height / 2) * this.baseScale), new Rectangle?(this.sourceRect), this.textureColor, 0.0f, new Vector2((float)(this.sourceRect.Width / 2), (float)(this.sourceRect.Height / 2)), this.scale, SpriteEffects.None, layerDepth);
|
||||
if (string.IsNullOrEmpty(this.label))
|
||||
return;
|
||||
b.DrawString(Game1.smallFont, this.label, new Vector2((float)(this.bounds.X + this.bounds.Width), (float)this.bounds.Y + ((float)(this.bounds.Height / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)), this.textColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swaps if the button is visible or not. Also toggles the animation manager appropriately.
|
||||
/// </summary>
|
||||
public void swapVisibility()
|
||||
{
|
||||
if (this.visible == true)
|
||||
{
|
||||
this.visible = false;
|
||||
this.animationManager.disableAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardustCore.UIUtilities.SpriteFonts.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.CharacterSheets
|
||||
{
|
||||
public class GenericCharacterSheets
|
||||
{
|
||||
public Dictionary<char, TexturedCharacter> CharacterAtlus;
|
||||
|
||||
public virtual TexturedCharacter getTexturedCharacter(char c)
|
||||
{
|
||||
return new TexturedCharacter();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,239 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardustCore.UIUtilities.SpriteFonts.Components;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.CharacterSheets
|
||||
{
|
||||
public class VanillaCharacterSheet :GenericCharacterSheets
|
||||
{
|
||||
|
||||
public VanillaCharacterSheet(string directoryToFonts)
|
||||
{
|
||||
Color fontColor = StardustCore.IlluminateFramework.Colors.getColorFromList("Black");
|
||||
this.CharacterAtlus = new Dictionary<char, TexturedCharacter>();
|
||||
this.CharacterAtlus.Add('0', new TexturedCharacter('0', Path.Combine(Utilities.getRelativePath(directoryToFonts), "0"), fontColor));
|
||||
this.CharacterAtlus.Add('1', new TexturedCharacter('1', Path.Combine(Utilities.getRelativePath(directoryToFonts), "1"), fontColor));
|
||||
this.CharacterAtlus.Add('2', new TexturedCharacter('2', Path.Combine(Utilities.getRelativePath(directoryToFonts), "2"), fontColor));
|
||||
this.CharacterAtlus.Add('3', new TexturedCharacter('3', Path.Combine(Utilities.getRelativePath(directoryToFonts), "3"), fontColor));
|
||||
this.CharacterAtlus.Add('4', new TexturedCharacter('4', Path.Combine(Utilities.getRelativePath(directoryToFonts), "4"), fontColor));
|
||||
this.CharacterAtlus.Add('5', new TexturedCharacter('5', Path.Combine(Utilities.getRelativePath(directoryToFonts), "5"), fontColor));
|
||||
this.CharacterAtlus.Add('6', new TexturedCharacter('6', Path.Combine(Utilities.getRelativePath(directoryToFonts), "6"), fontColor));
|
||||
this.CharacterAtlus.Add('7', new TexturedCharacter('7', Path.Combine(Utilities.getRelativePath(directoryToFonts), "7"), fontColor));
|
||||
this.CharacterAtlus.Add('8', new TexturedCharacter('8', Path.Combine(Utilities.getRelativePath(directoryToFonts), "8"), fontColor));
|
||||
this.CharacterAtlus.Add('9', new TexturedCharacter('9', Path.Combine(Utilities.getRelativePath(directoryToFonts), "9"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('&', new TexturedCharacter('&', Path.Combine(Utilities.getRelativePath(directoryToFonts), "ampersand"), fontColor));
|
||||
this.CharacterAtlus.Add('*', new TexturedCharacter('*', Path.Combine(Utilities.getRelativePath(directoryToFonts), "asterisk"), fontColor));
|
||||
this.CharacterAtlus.Add('\\', new TexturedCharacter('\\', Path.Combine(Utilities.getRelativePath(directoryToFonts), "backSlash"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('A', new TexturedCharacter('A', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalA"), fontColor));
|
||||
this.CharacterAtlus.Add('B', new TexturedCharacter('B', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalB"), fontColor));
|
||||
this.CharacterAtlus.Add('C', new TexturedCharacter('C', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalC"), fontColor));
|
||||
this.CharacterAtlus.Add('D', new TexturedCharacter('D', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalD"), fontColor));
|
||||
this.CharacterAtlus.Add('E', new TexturedCharacter('E', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalE"), fontColor));
|
||||
this.CharacterAtlus.Add('F', new TexturedCharacter('F', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalF"), fontColor));
|
||||
this.CharacterAtlus.Add('G', new TexturedCharacter('G', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalG"), fontColor));
|
||||
this.CharacterAtlus.Add('H', new TexturedCharacter('H', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalH"), fontColor));
|
||||
this.CharacterAtlus.Add('I', new TexturedCharacter('I', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalI"), fontColor));
|
||||
this.CharacterAtlus.Add('J', new TexturedCharacter('J', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalJ"), fontColor));
|
||||
this.CharacterAtlus.Add('K', new TexturedCharacter('K', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalK"), fontColor));
|
||||
this.CharacterAtlus.Add('L', new TexturedCharacter('L', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalL"), fontColor));
|
||||
this.CharacterAtlus.Add('M', new TexturedCharacter('M', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalM"), fontColor));
|
||||
this.CharacterAtlus.Add('N', new TexturedCharacter('N', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalN"), fontColor));
|
||||
this.CharacterAtlus.Add('O', new TexturedCharacter('O', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalO"), fontColor));
|
||||
this.CharacterAtlus.Add('P', new TexturedCharacter('P', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalP"), fontColor));
|
||||
this.CharacterAtlus.Add('Q', new TexturedCharacter('Q', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalQ"), fontColor));
|
||||
this.CharacterAtlus.Add('R', new TexturedCharacter('R', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalR"), fontColor));
|
||||
this.CharacterAtlus.Add('S', new TexturedCharacter('S', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalS"), fontColor));
|
||||
this.CharacterAtlus.Add('T', new TexturedCharacter('T', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalT"), fontColor));
|
||||
this.CharacterAtlus.Add('U', new TexturedCharacter('U', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalU"), fontColor));
|
||||
this.CharacterAtlus.Add('V', new TexturedCharacter('V', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalV"), fontColor));
|
||||
this.CharacterAtlus.Add('W', new TexturedCharacter('W', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalW"), fontColor));
|
||||
this.CharacterAtlus.Add('X', new TexturedCharacter('X', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalX"), fontColor));
|
||||
this.CharacterAtlus.Add('Y', new TexturedCharacter('Y', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalY"), fontColor));
|
||||
this.CharacterAtlus.Add('Z', new TexturedCharacter('Z', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalZ"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('^', new TexturedCharacter('^', Path.Combine(Utilities.getRelativePath(directoryToFonts), "caret"), fontColor));
|
||||
this.CharacterAtlus.Add(':', new TexturedCharacter(':', Path.Combine(Utilities.getRelativePath(directoryToFonts), "colon"), fontColor));
|
||||
this.CharacterAtlus.Add(',', new TexturedCharacter(',', Path.Combine(Utilities.getRelativePath(directoryToFonts), "comma"), fontColor));
|
||||
this.CharacterAtlus.Add('\"', new TexturedCharacter('\"', Path.Combine(Utilities.getRelativePath(directoryToFonts), "doubleQuotes"), fontColor));
|
||||
this.CharacterAtlus.Add('!', new TexturedCharacter('!', Path.Combine(Utilities.getRelativePath(directoryToFonts), "exclamationMark"), fontColor));
|
||||
this.CharacterAtlus.Add('/', new TexturedCharacter('/', Path.Combine(Utilities.getRelativePath(directoryToFonts), "forwardSlash"), fontColor));
|
||||
this.CharacterAtlus.Add('`', new TexturedCharacter('`', Path.Combine(Utilities.getRelativePath(directoryToFonts), "grave"), fontColor));
|
||||
this.CharacterAtlus.Add('[', new TexturedCharacter('[', Path.Combine(Utilities.getRelativePath(directoryToFonts), "leftBracket"), fontColor));
|
||||
this.CharacterAtlus.Add('{', new TexturedCharacter('{', Path.Combine(Utilities.getRelativePath(directoryToFonts), "leftCurlyBracket"), fontColor));
|
||||
this.CharacterAtlus.Add('(', new TexturedCharacter('(', Path.Combine(Utilities.getRelativePath(directoryToFonts), "leftParenthesis"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('a', new TexturedCharacter('a', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseA"), fontColor));
|
||||
this.CharacterAtlus.Add('b', new TexturedCharacter('b', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseB"), fontColor));
|
||||
this.CharacterAtlus.Add('c', new TexturedCharacter('c', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseC"), fontColor));
|
||||
this.CharacterAtlus.Add('d', new TexturedCharacter('d', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseD"), fontColor));
|
||||
this.CharacterAtlus.Add('e', new TexturedCharacter('e', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseE"), fontColor));
|
||||
this.CharacterAtlus.Add('f', new TexturedCharacter('f', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseF"), fontColor));
|
||||
this.CharacterAtlus.Add('g', new TexturedCharacter('g', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseG"), fontColor));
|
||||
this.CharacterAtlus.Add('h', new TexturedCharacter('h', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseH"), fontColor));
|
||||
this.CharacterAtlus.Add('i', new TexturedCharacter('i', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseI"), fontColor));
|
||||
this.CharacterAtlus.Add('j', new TexturedCharacter('j', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseJ"), fontColor));
|
||||
this.CharacterAtlus.Add('k', new TexturedCharacter('k', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseK"), fontColor));
|
||||
this.CharacterAtlus.Add('l', new TexturedCharacter('l', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseL"), fontColor));
|
||||
this.CharacterAtlus.Add('m', new TexturedCharacter('m', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseM"), fontColor));
|
||||
this.CharacterAtlus.Add('n', new TexturedCharacter('n', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseN"), fontColor));
|
||||
this.CharacterAtlus.Add('o', new TexturedCharacter('o', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseO"), fontColor));
|
||||
this.CharacterAtlus.Add('p', new TexturedCharacter('p', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseP"), fontColor));
|
||||
this.CharacterAtlus.Add('q', new TexturedCharacter('q', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseQ"), fontColor));
|
||||
this.CharacterAtlus.Add('r', new TexturedCharacter('r', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseR"), fontColor));
|
||||
this.CharacterAtlus.Add('s', new TexturedCharacter('s', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseS"), fontColor));
|
||||
this.CharacterAtlus.Add('t', new TexturedCharacter('t', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseT"), fontColor));
|
||||
this.CharacterAtlus.Add('u', new TexturedCharacter('u', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseU"), fontColor));
|
||||
this.CharacterAtlus.Add('v', new TexturedCharacter('v', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseV"), fontColor));
|
||||
this.CharacterAtlus.Add('w', new TexturedCharacter('w', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseW"), fontColor));
|
||||
this.CharacterAtlus.Add('x', new TexturedCharacter('x', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseX"), fontColor));
|
||||
this.CharacterAtlus.Add('y', new TexturedCharacter('y', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseY"), fontColor));
|
||||
this.CharacterAtlus.Add('z', new TexturedCharacter('z', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseZ"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('-', new TexturedCharacter('-', Path.Combine(Utilities.getRelativePath(directoryToFonts), "minus"), fontColor));
|
||||
this.CharacterAtlus.Add('%', new TexturedCharacter('%', Path.Combine(Utilities.getRelativePath(directoryToFonts), "percent"), fontColor));
|
||||
this.CharacterAtlus.Add('.', new TexturedCharacter('.', Path.Combine(Utilities.getRelativePath(directoryToFonts), "period"), fontColor));
|
||||
this.CharacterAtlus.Add('+', new TexturedCharacter('+', Path.Combine(Utilities.getRelativePath(directoryToFonts), "plus"), fontColor));
|
||||
this.CharacterAtlus.Add('#', new TexturedCharacter('#', Path.Combine(Utilities.getRelativePath(directoryToFonts), "pound"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('?', new TexturedCharacter('?', Path.Combine(Utilities.getRelativePath(directoryToFonts), "questionMark"), fontColor));
|
||||
this.CharacterAtlus.Add(']', new TexturedCharacter(']', Path.Combine(Utilities.getRelativePath(directoryToFonts), "rightBracket"), fontColor));
|
||||
this.CharacterAtlus.Add('}', new TexturedCharacter('}', Path.Combine(Utilities.getRelativePath(directoryToFonts), "rightCurlyBracket"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add(')', new TexturedCharacter(')', Path.Combine(Utilities.getRelativePath(directoryToFonts), "rightParenthesis"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add(';', new TexturedCharacter(';', Path.Combine(Utilities.getRelativePath(directoryToFonts), "semicolon"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('\'', new TexturedCharacter('\'', Path.Combine(Utilities.getRelativePath(directoryToFonts), "singleQuote"), fontColor));
|
||||
this.CharacterAtlus.Add(' ', new TexturedCharacter(' ', Path.Combine(Utilities.getRelativePath(directoryToFonts), "space"), fontColor));
|
||||
this.CharacterAtlus.Add('~', new TexturedCharacter('~', Path.Combine(Utilities.getRelativePath(directoryToFonts), "tilde"), fontColor));
|
||||
this.CharacterAtlus.Add('_', new TexturedCharacter('_', Path.Combine(Utilities.getRelativePath(directoryToFonts), "underScore"), fontColor));
|
||||
this.CharacterAtlus.Add('|', new TexturedCharacter('|', Path.Combine(Utilities.getRelativePath(directoryToFonts), "verticalLine"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('$', new TexturedCharacter('$', Path.Combine(Utilities.getRelativePath(directoryToFonts), "coin"), fontColor));
|
||||
this.CharacterAtlus.Add('=', new TexturedCharacter('=', Path.Combine(Utilities.getRelativePath(directoryToFonts), "star"), fontColor));
|
||||
this.CharacterAtlus.Add('@', new TexturedCharacter('@', Path.Combine(Utilities.getRelativePath(directoryToFonts), "heart"), fontColor));
|
||||
}
|
||||
|
||||
public VanillaCharacterSheet(string directoryToFonts, Color fontColor)
|
||||
{
|
||||
this.CharacterAtlus = new Dictionary<char, TexturedCharacter>();
|
||||
this.CharacterAtlus.Add('0', new TexturedCharacter('0', Path.Combine(Utilities.getRelativePath(directoryToFonts), "0"), fontColor));
|
||||
this.CharacterAtlus.Add('1', new TexturedCharacter('1', Path.Combine(Utilities.getRelativePath(directoryToFonts), "1"), fontColor));
|
||||
this.CharacterAtlus.Add('2', new TexturedCharacter('2', Path.Combine(Utilities.getRelativePath(directoryToFonts), "2"), fontColor));
|
||||
this.CharacterAtlus.Add('3', new TexturedCharacter('3', Path.Combine(Utilities.getRelativePath(directoryToFonts), "3"), fontColor));
|
||||
this.CharacterAtlus.Add('4', new TexturedCharacter('4', Path.Combine(Utilities.getRelativePath(directoryToFonts), "4"), fontColor));
|
||||
this.CharacterAtlus.Add('5', new TexturedCharacter('5', Path.Combine(Utilities.getRelativePath(directoryToFonts), "5"), fontColor));
|
||||
this.CharacterAtlus.Add('6', new TexturedCharacter('6', Path.Combine(Utilities.getRelativePath(directoryToFonts), "6"), fontColor));
|
||||
this.CharacterAtlus.Add('7', new TexturedCharacter('7', Path.Combine(Utilities.getRelativePath(directoryToFonts), "7"), fontColor));
|
||||
this.CharacterAtlus.Add('8', new TexturedCharacter('8', Path.Combine(Utilities.getRelativePath(directoryToFonts), "8"), fontColor));
|
||||
this.CharacterAtlus.Add('9', new TexturedCharacter('9', Path.Combine(Utilities.getRelativePath(directoryToFonts), "9"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('&', new TexturedCharacter('&', Path.Combine(Utilities.getRelativePath(directoryToFonts), "ampersand"), fontColor));
|
||||
this.CharacterAtlus.Add('*', new TexturedCharacter('*', Path.Combine(Utilities.getRelativePath(directoryToFonts), "asterisk"), fontColor));
|
||||
this.CharacterAtlus.Add('\\', new TexturedCharacter('\\', Path.Combine(Utilities.getRelativePath(directoryToFonts), "backSlash"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('A', new TexturedCharacter('A', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalA"), fontColor));
|
||||
this.CharacterAtlus.Add('B', new TexturedCharacter('B', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalB"), fontColor));
|
||||
this.CharacterAtlus.Add('C', new TexturedCharacter('C', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalC"), fontColor));
|
||||
this.CharacterAtlus.Add('D', new TexturedCharacter('D', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalD"), fontColor));
|
||||
this.CharacterAtlus.Add('E', new TexturedCharacter('E', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalE"), fontColor));
|
||||
this.CharacterAtlus.Add('F', new TexturedCharacter('F', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalF"), fontColor));
|
||||
this.CharacterAtlus.Add('G', new TexturedCharacter('G', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalG"), fontColor));
|
||||
this.CharacterAtlus.Add('H', new TexturedCharacter('H', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalH"), fontColor));
|
||||
this.CharacterAtlus.Add('I', new TexturedCharacter('I', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalI"), fontColor));
|
||||
this.CharacterAtlus.Add('J', new TexturedCharacter('J', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalJ"), fontColor));
|
||||
this.CharacterAtlus.Add('K', new TexturedCharacter('K', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalK"), fontColor));
|
||||
this.CharacterAtlus.Add('L', new TexturedCharacter('L', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalL"), fontColor));
|
||||
this.CharacterAtlus.Add('M', new TexturedCharacter('M', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalM"), fontColor));
|
||||
this.CharacterAtlus.Add('N', new TexturedCharacter('N', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalN"), fontColor));
|
||||
this.CharacterAtlus.Add('O', new TexturedCharacter('O', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalO"), fontColor));
|
||||
this.CharacterAtlus.Add('P', new TexturedCharacter('P', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalP"), fontColor));
|
||||
this.CharacterAtlus.Add('Q', new TexturedCharacter('Q', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalQ"), fontColor));
|
||||
this.CharacterAtlus.Add('R', new TexturedCharacter('R', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalR"), fontColor));
|
||||
this.CharacterAtlus.Add('S', new TexturedCharacter('S', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalS"), fontColor));
|
||||
this.CharacterAtlus.Add('T', new TexturedCharacter('T', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalT"), fontColor));
|
||||
this.CharacterAtlus.Add('U', new TexturedCharacter('U', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalU"), fontColor));
|
||||
this.CharacterAtlus.Add('V', new TexturedCharacter('V', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalV"), fontColor));
|
||||
this.CharacterAtlus.Add('W', new TexturedCharacter('W', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalW"), fontColor));
|
||||
this.CharacterAtlus.Add('X', new TexturedCharacter('X', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalX"), fontColor));
|
||||
this.CharacterAtlus.Add('Y', new TexturedCharacter('Y', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalY"), fontColor));
|
||||
this.CharacterAtlus.Add('Z', new TexturedCharacter('Z', Path.Combine(Utilities.getRelativePath(directoryToFonts), "capitalZ"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('^', new TexturedCharacter('^', Path.Combine(Utilities.getRelativePath(directoryToFonts), "caret"), fontColor));
|
||||
this.CharacterAtlus.Add(':', new TexturedCharacter(':', Path.Combine(Utilities.getRelativePath(directoryToFonts), "colon"), fontColor));
|
||||
this.CharacterAtlus.Add(',', new TexturedCharacter(',', Path.Combine(Utilities.getRelativePath(directoryToFonts), "comma"), fontColor));
|
||||
this.CharacterAtlus.Add('\"', new TexturedCharacter('\"', Path.Combine(Utilities.getRelativePath(directoryToFonts), "doubleQuotes"), fontColor));
|
||||
this.CharacterAtlus.Add('!', new TexturedCharacter('!', Path.Combine(Utilities.getRelativePath(directoryToFonts), "exclamationMark"), fontColor));
|
||||
this.CharacterAtlus.Add('/', new TexturedCharacter('/', Path.Combine(Utilities.getRelativePath(directoryToFonts), "forwardSlash"), fontColor));
|
||||
this.CharacterAtlus.Add('`', new TexturedCharacter('`', Path.Combine(Utilities.getRelativePath(directoryToFonts), "grave"), fontColor));
|
||||
this.CharacterAtlus.Add('[', new TexturedCharacter('[', Path.Combine(Utilities.getRelativePath(directoryToFonts), "leftBracket"), fontColor));
|
||||
this.CharacterAtlus.Add('{', new TexturedCharacter('{', Path.Combine(Utilities.getRelativePath(directoryToFonts), "leftCurlyBracket"), fontColor));
|
||||
this.CharacterAtlus.Add('(', new TexturedCharacter('(', Path.Combine(Utilities.getRelativePath(directoryToFonts), "leftParenthesis"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('a', new TexturedCharacter('a', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseA"), fontColor));
|
||||
this.CharacterAtlus.Add('b', new TexturedCharacter('b', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseB"), fontColor));
|
||||
this.CharacterAtlus.Add('c', new TexturedCharacter('c', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseC"), fontColor));
|
||||
this.CharacterAtlus.Add('d', new TexturedCharacter('d', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseD"), fontColor));
|
||||
this.CharacterAtlus.Add('e', new TexturedCharacter('e', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseE"), fontColor));
|
||||
this.CharacterAtlus.Add('f', new TexturedCharacter('f', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseF"), fontColor));
|
||||
this.CharacterAtlus.Add('g', new TexturedCharacter('g', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseG"), fontColor));
|
||||
this.CharacterAtlus.Add('h', new TexturedCharacter('h', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseH"), fontColor));
|
||||
this.CharacterAtlus.Add('i', new TexturedCharacter('i', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseI"), fontColor));
|
||||
this.CharacterAtlus.Add('j', new TexturedCharacter('j', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseJ"), fontColor));
|
||||
this.CharacterAtlus.Add('k', new TexturedCharacter('k', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseK"), fontColor));
|
||||
this.CharacterAtlus.Add('l', new TexturedCharacter('l', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseL"), fontColor));
|
||||
this.CharacterAtlus.Add('m', new TexturedCharacter('m', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseM"), fontColor));
|
||||
this.CharacterAtlus.Add('n', new TexturedCharacter('n', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseN"), fontColor));
|
||||
this.CharacterAtlus.Add('o', new TexturedCharacter('o', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseO"), fontColor));
|
||||
this.CharacterAtlus.Add('p', new TexturedCharacter('p', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseP"), fontColor));
|
||||
this.CharacterAtlus.Add('q', new TexturedCharacter('q', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseQ"), fontColor));
|
||||
this.CharacterAtlus.Add('r', new TexturedCharacter('r', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseR"), fontColor));
|
||||
this.CharacterAtlus.Add('s', new TexturedCharacter('s', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseS"), fontColor));
|
||||
this.CharacterAtlus.Add('t', new TexturedCharacter('t', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseT"), fontColor));
|
||||
this.CharacterAtlus.Add('u', new TexturedCharacter('u', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseU"), fontColor));
|
||||
this.CharacterAtlus.Add('v', new TexturedCharacter('v', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseV"), fontColor));
|
||||
this.CharacterAtlus.Add('w', new TexturedCharacter('w', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseW"), fontColor));
|
||||
this.CharacterAtlus.Add('x', new TexturedCharacter('x', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseX"), fontColor));
|
||||
this.CharacterAtlus.Add('y', new TexturedCharacter('y', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseY"), fontColor));
|
||||
this.CharacterAtlus.Add('z', new TexturedCharacter('z', Path.Combine(Utilities.getRelativePath(directoryToFonts), "lowercaseZ"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('-', new TexturedCharacter('-', Path.Combine(Utilities.getRelativePath(directoryToFonts), "minus"), fontColor));
|
||||
this.CharacterAtlus.Add('%', new TexturedCharacter('%', Path.Combine(Utilities.getRelativePath(directoryToFonts), "percent"), fontColor));
|
||||
this.CharacterAtlus.Add('.', new TexturedCharacter('.', Path.Combine(Utilities.getRelativePath(directoryToFonts), "period"), fontColor));
|
||||
this.CharacterAtlus.Add('+', new TexturedCharacter('+', Path.Combine(Utilities.getRelativePath(directoryToFonts), "plus"), fontColor));
|
||||
this.CharacterAtlus.Add('#', new TexturedCharacter('#', Path.Combine(Utilities.getRelativePath(directoryToFonts), "pound"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('?', new TexturedCharacter('?', Path.Combine(Utilities.getRelativePath(directoryToFonts), "questionMark"), fontColor));
|
||||
this.CharacterAtlus.Add(']', new TexturedCharacter(']', Path.Combine(Utilities.getRelativePath(directoryToFonts), "rightBracket"), fontColor));
|
||||
this.CharacterAtlus.Add('}', new TexturedCharacter('}', Path.Combine(Utilities.getRelativePath(directoryToFonts), "rightCurlyBracket"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add(')', new TexturedCharacter(')', Path.Combine(Utilities.getRelativePath(directoryToFonts), "rightParenthesis"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add(';', new TexturedCharacter(';', Path.Combine(Utilities.getRelativePath(directoryToFonts), "semicolon"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('\'', new TexturedCharacter('\'', Path.Combine(Utilities.getRelativePath(directoryToFonts), "singleQuote"), fontColor));
|
||||
this.CharacterAtlus.Add(' ', new TexturedCharacter(' ', Path.Combine(Utilities.getRelativePath(directoryToFonts), "space"), fontColor));
|
||||
this.CharacterAtlus.Add('~', new TexturedCharacter('~', Path.Combine(Utilities.getRelativePath(directoryToFonts), "tilde"), fontColor));
|
||||
this.CharacterAtlus.Add('_', new TexturedCharacter('_', Path.Combine(Utilities.getRelativePath(directoryToFonts), "underScore"), fontColor));
|
||||
this.CharacterAtlus.Add('|', new TexturedCharacter('|', Path.Combine(Utilities.getRelativePath(directoryToFonts), "verticalLine"), fontColor));
|
||||
|
||||
this.CharacterAtlus.Add('$', new TexturedCharacter('$', Path.Combine(Utilities.getRelativePath(directoryToFonts), "coin"), fontColor));
|
||||
this.CharacterAtlus.Add('=', new TexturedCharacter('=', Path.Combine(Utilities.getRelativePath(directoryToFonts), "star"), fontColor));
|
||||
this.CharacterAtlus.Add('@', new TexturedCharacter('@', Path.Combine(Utilities.getRelativePath(directoryToFonts), "heart"), fontColor));
|
||||
}
|
||||
|
||||
public override TexturedCharacter getTexturedCharacter(char c)
|
||||
{
|
||||
var original = this.CharacterAtlus[c];
|
||||
return TexturedCharacter.Copy(original);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to determine spacing between TexturedCharacters.
|
||||
/// </summary>
|
||||
public class CharacterSpacing
|
||||
{
|
||||
/// <summary>
|
||||
/// Padding to offset this chaarcter by the previous character;
|
||||
/// </summary>
|
||||
public int LeftPadding;
|
||||
/// <summary>
|
||||
/// Padding to offset the following character by.
|
||||
/// </summary>
|
||||
public int RightPadding;
|
||||
/// <summary>
|
||||
/// Padding to offset the top character by. Not sure if this will be used.
|
||||
/// </summary>
|
||||
public int TopPadding;
|
||||
/// <summary>
|
||||
/// Padding to offset the bottom character by. Not sure if this will be used.
|
||||
/// </summary>
|
||||
public int BottomPadding;
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor;
|
||||
/// </summary>
|
||||
public CharacterSpacing()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <param name="right"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="bottom"></param>
|
||||
public CharacterSpacing(int left, int right, int top, int bottom)
|
||||
{
|
||||
this.LeftPadding = left;
|
||||
this.RightPadding = right;
|
||||
this.TopPadding = top;
|
||||
this.BottomPadding = bottom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save this to a .json file.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void WriteToJson(string path)
|
||||
{
|
||||
StardustCore.ModCore.ModHelper.WriteJsonFile(path, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the data from the .json file.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static CharacterSpacing ReadFromJson(string path)
|
||||
{
|
||||
return StardustCore.ModCore.ModHelper.ReadJsonFile<CharacterSpacing>(path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.Components
|
||||
{
|
||||
public class TexturedCharacter
|
||||
{
|
||||
public char character;
|
||||
public string pathToTexture;
|
||||
public Texture2D texture;
|
||||
public CharacterSpacing spacing;
|
||||
public Color drawColor;
|
||||
public Vector2 position;
|
||||
|
||||
public TexturedCharacter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TexturedCharacter(char Character,string PathToTexture,Color color)
|
||||
{
|
||||
this.character = Character;
|
||||
this.pathToTexture = PathToTexture;
|
||||
string text = this.pathToTexture.Remove(0, 1);
|
||||
this.texture = StardustCore.ModCore.ModHelper.Content.Load<Texture2D>(text+".png");
|
||||
this.spacing = new CharacterSpacing();
|
||||
this.drawColor = color;
|
||||
this.position = new Vector2();
|
||||
}
|
||||
|
||||
public TexturedCharacter(char Character, string PathToTexture,Color color,int left, int right,int top, int bottom)
|
||||
{
|
||||
this.character = Character;
|
||||
this.pathToTexture = PathToTexture;
|
||||
string text = this.pathToTexture.Remove(0, 1);
|
||||
this.texture = StardustCore.ModCore.ModHelper.Content.Load<Texture2D>(text + ".png");
|
||||
this.spacing = new CharacterSpacing(left,right,top,bottom);
|
||||
this.drawColor = color;
|
||||
this.position = new Vector2();
|
||||
}
|
||||
|
||||
public static TexturedCharacter Copy(TexturedCharacter original)
|
||||
{
|
||||
TexturedCharacter copy = new TexturedCharacter(original.character,original.pathToTexture,original.drawColor);
|
||||
copy.spacing = new CharacterSpacing(original.spacing.LeftPadding, original.spacing.RightPadding, original.spacing.TopPadding, original.spacing.BottomPadding);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
public void draw(SpriteBatch b)
|
||||
{
|
||||
b.Draw(this.texture, this.position, this.drawColor);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.Components
|
||||
{
|
||||
public class TexturedString
|
||||
{
|
||||
List<TexturedCharacter> characters;
|
||||
Vector2 position;
|
||||
|
||||
public TexturedString(Vector2 Position,List<TexturedCharacter> Characters)
|
||||
{
|
||||
this.characters = Characters;
|
||||
this.position = Position;
|
||||
setCharacterPositions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the character positions relative to the string's position on screen.
|
||||
/// </summary>
|
||||
public void setCharacterPositions()
|
||||
{
|
||||
int index = 0;
|
||||
TexturedCharacter lastSeenChar=new TexturedCharacter();
|
||||
foreach(var c in characters)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
c.position = new Vector2(this.position.X + c.spacing.LeftPadding,this.position.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
c.position = new Vector2(this.position.X + c.spacing.LeftPadding + lastSeenChar.spacing.RightPadding+lastSeenChar.texture.Width*index, this.position.Y);
|
||||
}
|
||||
StardustCore.ModCore.ModMonitor.Log(c.character.ToString());
|
||||
StardustCore.ModCore.ModMonitor.Log(c.position.ToString());
|
||||
lastSeenChar = c;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a textured character to a textured string.
|
||||
/// </summary>
|
||||
/// <param name="ch"></param>
|
||||
public void addCharacterToEnd(TexturedCharacter ch)
|
||||
{
|
||||
this.characters.Add(ch);
|
||||
this.setCharacterPositions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a list of textured characters to a textured string.
|
||||
/// </summary>
|
||||
/// <param name="chList"></param>
|
||||
public void addCharactersToEnd(List<TexturedCharacter> chList)
|
||||
{
|
||||
foreach(var ch in chList)
|
||||
{
|
||||
this.characters.Add(ch);
|
||||
}
|
||||
this.setCharacterPositions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the strings together and allows the position to be set.
|
||||
/// </summary>
|
||||
/// <param name="first"></param>
|
||||
/// <param name="second"></param>
|
||||
/// <param name="NewPosition"></param>
|
||||
/// <returns></returns>
|
||||
public TexturedString addStrings(TexturedString first,TexturedString second,Vector2 NewPosition)
|
||||
{
|
||||
var newString = first + second;
|
||||
newString.position = NewPosition;
|
||||
newString.setCharacterPositions();
|
||||
return newString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operator overload of +. Adds the two strings together and sets a new 0,0 position.
|
||||
/// </summary>
|
||||
/// <param name="first"></param>
|
||||
/// <param name="second"></param>
|
||||
/// <returns></returns>
|
||||
public static TexturedString operator+(TexturedString first, TexturedString second)
|
||||
{
|
||||
List<TexturedCharacter> characterList = new List<TexturedCharacter>();
|
||||
foreach(var v in first.characters)
|
||||
{
|
||||
characterList.Add(v);
|
||||
}
|
||||
foreach (var v in second.characters)
|
||||
{
|
||||
characterList.Add(v);
|
||||
}
|
||||
TexturedString newString = new TexturedString(new Vector2(0, 0), characterList);
|
||||
return newString;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Removes the characters from the textured word.
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="howMany"></param>
|
||||
public void removeCharactersFromEnd(int index,int howMany)
|
||||
{
|
||||
this.characters.RemoveRange(index, howMany);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the textured string.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void draw(SpriteBatch b)
|
||||
{
|
||||
foreach(var v in this.characters)
|
||||
{
|
||||
v.draw(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.Fonts
|
||||
{
|
||||
public class GenericFont
|
||||
{
|
||||
|
||||
public CharacterSheets.GenericCharacterSheets characterSheet;
|
||||
public string path;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using StardustCore.UIUtilities.SpriteFonts.CharacterSheets;
|
||||
using StardustCore.UIUtilities.SpriteFonts.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts.Fonts
|
||||
{
|
||||
public class VanillaFont :GenericFont
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor;
|
||||
/// </summary>
|
||||
public VanillaFont()
|
||||
{
|
||||
this.path = Path.Combine(StardustCore.UIUtilities.SpriteFonts.SpriteFont.FontDirectory, "Vanilla");
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
this.characterSheet = new VanillaCharacterSheet(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a string and returns a textured string in it's place.
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public TexturedString voidParseString(string str)
|
||||
{
|
||||
List<TexturedCharacter> characters=new List<TexturedCharacter>();
|
||||
foreach(var chr in str)
|
||||
{
|
||||
characters.Add(characterSheet.getTexturedCharacter(chr));
|
||||
}
|
||||
var tStr = new TexturedString(new Microsoft.Xna.Framework.Vector2(0, 0), characters);
|
||||
return tStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a string and returns a textured string in it's place. Also sets the new position.
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <param name="Position"></param>
|
||||
/// <returns></returns>
|
||||
public TexturedString ParseString(string str,Vector2 Position)
|
||||
{
|
||||
List<TexturedCharacter> characters = new List<TexturedCharacter>();
|
||||
foreach (var chr in str)
|
||||
{
|
||||
characters.Add(characterSheet.getTexturedCharacter(chr));
|
||||
}
|
||||
var tStr = new TexturedString(Position, characters);
|
||||
return tStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a string and returns a textured string in it's place. Also sets the new position and string color.
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <param name="Position"></param>
|
||||
/// <param name="stringColor"></param>
|
||||
/// <returns></returns>
|
||||
public TexturedString ParseString(string str, Vector2 Position, Color stringColor)
|
||||
{
|
||||
List<TexturedCharacter> characters = new List<TexturedCharacter>();
|
||||
foreach (var chr in str)
|
||||
{
|
||||
var c = characterSheet.getTexturedCharacter(chr);
|
||||
c.drawColor = stringColor;
|
||||
characters.Add(c);
|
||||
}
|
||||
var tStr = new TexturedString(Position, characters);
|
||||
return tStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a string and returns a textured string in it's place. Also sets the new position and string color.
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <param name="Position"></param>
|
||||
/// <param name="stringColor">The color for the individual characters.</param>
|
||||
/// <returns></returns>
|
||||
public TexturedString ParseString(string str, Vector2 Position, List<Color> stringColor)
|
||||
{
|
||||
List<TexturedCharacter> characters = new List<TexturedCharacter>();
|
||||
int index = 0;
|
||||
foreach (var chr in str)
|
||||
{
|
||||
var c = characterSheet.getTexturedCharacter(chr);
|
||||
c.drawColor = stringColor.ElementAt(index);
|
||||
characters.Add(c);
|
||||
index++;
|
||||
}
|
||||
var tStr = new TexturedString(Position, characters);
|
||||
return tStr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using StardustCore.UIUtilities.SpriteFonts.Fonts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities.SpriteFonts
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages Fonts for Stardust core. While all fonts variables can be accessed from their classes, they can also hold a reference here.
|
||||
/// </summary>
|
||||
public class SpriteFont
|
||||
{
|
||||
public static string FontDirectory;
|
||||
|
||||
public static VanillaFont vanillaFont;
|
||||
|
||||
public static void initialize()
|
||||
{
|
||||
StardustCore.ModCore.ModMonitor.Log("HEY THERE!!");
|
||||
FontDirectory = Path.Combine(StardustCore.ModCore.ContentDirectory, "Fonts");
|
||||
if (!Directory.Exists(FontDirectory)) Directory.CreateDirectory(FontDirectory);
|
||||
vanillaFont = new VanillaFont();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities
|
||||
{
|
||||
public class Texture2DExtended
|
||||
{
|
||||
public string Name;
|
||||
public Texture2D texture;
|
||||
public string path;
|
||||
|
||||
public Texture2DExtended(string path)
|
||||
{
|
||||
this.Name = Path.GetFileName(path);
|
||||
this.path = path;
|
||||
this.texture = StardustCore.ModCore.ModHelper.Content.Load<Texture2D>(path);
|
||||
}
|
||||
|
||||
public Texture2DExtended Copy()
|
||||
{
|
||||
return new Texture2DExtended(this.path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,8 +30,16 @@ namespace StardustCore
|
|||
return (int)((double)c.price * (1.0 + (double)c.quality * 0.25));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns an absolute path past the mod's directory.
|
||||
/// </summary>
|
||||
/// <param name="absolutePath"></param>
|
||||
/// <returns></returns>
|
||||
public static string getRelativePath(string absolutePath)
|
||||
{
|
||||
var ok= absolutePath.Split(new string[] { "StardustCore" }, StringSplitOptions.None);
|
||||
return ok.ElementAt(1);
|
||||
}
|
||||
|
||||
|
||||
public static void createObjectDebris(Item I, int xTileOrigin, int yTileOrigin, int xTileTarget, int yTileTarget, int groundLevel = -1, int itemQuality = 0, float velocityMultiplyer = 1f, GameLocation location = null)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,32 @@
|
|||
using StardewModdingAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EventSystem;
|
||||
using StardewValley;
|
||||
using EventSystem.Framework.FunctionEvents;
|
||||
using EventSystem.Framework.Information;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace SundropMapEvents
|
||||
{
|
||||
public class Class1 :Mod
|
||||
{
|
||||
|
||||
public static IModHelper ModHelper;
|
||||
public static IMonitor ModMonitor;
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = this.Helper;
|
||||
ModMonitor = this.Monitor;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||
}
|
||||
|
||||
private void SaveEvents_AfterLoad(object sender, EventArgs e)
|
||||
{
|
||||
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new EventSystem.Framework.Events.WarpEvent("toRR", Game1.getLocationFromName("BusStop"), new Vector2(6, 11), new PlayerEvents(null, null), new WarpInformation("BusStop", 10, 12, 2, false)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SundropMapEvents")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SundropMapEvents")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("29a68f94-b23c-442b-8867-8b8f3502e64f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{29A68F94-B23C-442B-8867-8B8F3502E64F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SundropMapEvents</RootNamespace>
|
||||
<AssemblyName>SundropMapEvents</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EventSystem">
|
||||
<HintPath>..\MapEvents\bin\Release\EventSystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</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')" />
|
||||
<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'))" />
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"Name": "SunDropMapEvents",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "0.1.0",
|
||||
"Description": "A system to add events to the SunDropMod",
|
||||
"UniqueID": "SunDrop.MapEvents",
|
||||
"EntryDll": "SunDropMapEvents.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ ],
|
||||
"Dependencies": [
|
||||
{
|
||||
"UniqueID": "Omegasis.EventSystem",
|
||||
"IsRequired": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 14 for Windows Desktop
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIUtilities", "UIUtilities\UIUtilities.csproj", "{ABA29468-BAC9-47E9-983A-393FC5489124}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{ABA29468-BAC9-47E9-983A-393FC5489124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ABA29468-BAC9-47E9-983A-393FC5489124}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ABA29468-BAC9-47E9-983A-393FC5489124}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ABA29468-BAC9-47E9-983A-393FC5489124}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UIUtilities
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UIUtilities.MenuComponents
|
||||
{
|
||||
class Button : StardewValley.Menus.ClickableComponent
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("UIUtilities")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UIUtilities")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("aba29468-bac9-47e9-983a-393fc5489124")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{ABA29468-BAC9-47E9-983A-393FC5489124}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UIUtilities</RootNamespace>
|
||||
<AssemblyName>UIUtilities</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="MenuComponents\Button.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</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')" />
|
||||
<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'))" />
|
||||
</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.2" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue