Integrated StardustCore with UIUtilities a new framework that makes making menus easier. It adds buttons and TexturedFonts that are loaded in as individual images for each character. Colors can be applied to these chararacters for some nice graphical effects.
This commit is contained in:
parent
ff6456d9ec
commit
13e1d9591a
|
@ -67,6 +67,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarAI", "..\StarAI\StarAI\
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewSymphonyRemastered", "StardewSymphonyRemastered\StardewSymphonyRemastered\StardewSymphonyRemastered.csproj", "{19F64B03-6A9B-49E1-854A-C05D5A014646}"
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
@ -4,11 +4,21 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using StardewValley;
|
||||||
|
|
||||||
namespace StardewSymphonyRemastered.Framework.Menus
|
namespace StardewSymphonyRemastered.Framework.Menus
|
||||||
{
|
{
|
||||||
class MusicManagerMenu : StardewValley.Menus.IClickableMenu
|
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)
|
public override void receiveRightClick(int x, int y, bool playSound = true)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -16,7 +26,18 @@ namespace StardewSymphonyRemastered.Framework.Menus
|
||||||
|
|
||||||
public override void drawBackground(SpriteBatch b)
|
public override void drawBackground(SpriteBatch b)
|
||||||
{
|
{
|
||||||
base.drawBackground(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -16,7 +17,8 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
public string author;
|
public string author;
|
||||||
public string description;
|
public string description;
|
||||||
public string versionInfo;
|
public string versionInfo;
|
||||||
|
public string pathToMusicPackIcon;
|
||||||
|
public Texture2D Icon;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constrctor
|
/// Constrctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -24,12 +26,22 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
/// <param name="Author">The author who compiled ths music pack.</param>
|
/// <param name="Author">The author who compiled ths music pack.</param>
|
||||||
/// <param name="Description">The description of</param>
|
/// <param name="Description">The description of</param>
|
||||||
/// <param name="VersionInfo"></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.name = Name;
|
||||||
this.author = Author;
|
this.author = Author;
|
||||||
this.description = Description;
|
this.description = Description;
|
||||||
this.versionInfo = VersionInfo;
|
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>
|
/// <summary>
|
||||||
/// Blank Constructor
|
/// Blank Constructor
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
if (this.musicPackInformation == null)
|
if (this.musicPackInformation == null)
|
||||||
{
|
{
|
||||||
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToMusicPack + ". Blank information will be put in place.", StardewModdingAPI.LogLevel.Warn);
|
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.musicPackInformation = new MusicPackMetaData("???", "???", "", "0.0.0","");
|
||||||
}
|
}
|
||||||
this.loadMusicFiles();
|
this.loadMusicFiles();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace StardewSymphonyRemastered.Framework
|
||||||
if (this.musicPackInformation == null)
|
if (this.musicPackInformation == null)
|
||||||
{
|
{
|
||||||
StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToXwb + ". Blank information will be put in place.",StardewModdingAPI.LogLevel.Warn);
|
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.WaveBank = new WaveBank(Game1.audioEngine, this.WaveBankPath);
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace StardewSymphonyRemastered
|
||||||
{
|
{
|
||||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
|
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
|
||||||
{
|
{
|
||||||
Game1.activeClickableMenu = new StardewSymphonyRemastered.Framework.Menus.MusicManagerMenu();
|
Game1.activeClickableMenu = new StardewSymphonyRemastered.Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ namespace StardewSymphonyRemastered
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
}
|
}
|
||||||
if(!File.Exists(Path.Combine(path, "MusicPackInformation.json"))){
|
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");
|
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"));
|
blankMetaData.writeToJson(Path.Combine(path, "MusicPackInformation.json"));
|
||||||
}
|
}
|
||||||
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||||
|
@ -166,7 +166,7 @@ namespace StardewSymphonyRemastered
|
||||||
}
|
}
|
||||||
if (!File.Exists(Path.Combine(path, "MusicPackInformation.json")))
|
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");
|
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"));
|
blankMetaData.writeToJson(Path.Combine(path, "MusicPackInformation.json"));
|
||||||
}
|
}
|
||||||
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
if (!File.Exists(Path.Combine(path, "readme.txt")))
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="StardustCore">
|
||||||
|
<HintPath>..\..\StardustCore\bin\Release\StardustCore.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
|
|
@ -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()
|
public void enableAnimation()
|
||||||
{
|
{
|
||||||
this.enabled = true;
|
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()
|
public void disableAnimation()
|
||||||
{
|
{
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace StardustCore.IlluminateFramework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make sure all colors are inverted.
|
/// Make sure all colors are inverted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ColorsList
|
public class LightColorsList
|
||||||
{
|
{
|
||||||
public static Color AliceBlue = new Color(15, 7, 0, 255);
|
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;
|
Color color;
|
||||||
bool f = ColorDictionary.TryGetValue(s, out color);
|
bool f = ColorDictionary.TryGetValue(s, out color);
|
||||||
|
|
|
@ -18,14 +18,16 @@ namespace StardustCore
|
||||||
public static IModHelper ModHelper;
|
public static IModHelper ModHelper;
|
||||||
public static IMonitor ModMonitor;
|
public static IMonitor ModMonitor;
|
||||||
public static Serialization.SerializationManager SerializationManager;
|
public static Serialization.SerializationManager SerializationManager;
|
||||||
|
|
||||||
|
public static string ContentDirectory;
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
ModHelper = 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?
|
//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.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 invPath = Path.Combine(ModCore.ModHelper.DirectoryPath, "PlayerData", Game1.player.name, "PlayerInventory");
|
||||||
string worldPath = Path.Combine(ModCore.ModHelper.DirectoryPath, Game1.player.name, "ObjectsInWorld"); ;
|
string worldPath = Path.Combine(ModCore.ModHelper.DirectoryPath, Game1.player.name, "ObjectsInWorld"); ;
|
||||||
string trashPath = Path.Combine(ModCore.ModHelper.DirectoryPath, "ModTrashFolder");
|
string trashPath = Path.Combine(ModCore.ModHelper.DirectoryPath, "ModTrashFolder");
|
||||||
|
@ -36,8 +38,10 @@ namespace StardustCore
|
||||||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||||
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
|
||||||
|
|
||||||
|
|
||||||
IlluminateFramework.Colors.initializeColors();
|
IlluminateFramework.Colors.initializeColors();
|
||||||
|
ContentDirectory = Path.Combine(ModHelper.DirectoryPath, "Content");
|
||||||
|
if (!Directory.Exists(ContentDirectory)) Directory.CreateDirectory(ContentDirectory);
|
||||||
|
UIUtilities.SpriteFonts.SpriteFont.initialize();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,12 @@
|
||||||
<Compile Include="Animations\Animation.cs" />
|
<Compile Include="Animations\Animation.cs" />
|
||||||
<Compile Include="Animations\AnimationManager.cs" />
|
<Compile Include="Animations\AnimationManager.cs" />
|
||||||
<Compile Include="IlluminateFramework\Colors.cs" />
|
<Compile Include="IlluminateFramework\Colors.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="ModCore.cs" />
|
||||||
<Compile Include="CoreObject.cs" />
|
<Compile Include="CoreObject.cs" />
|
||||||
<Compile Include="ModInfo\Metadata.cs" />
|
<Compile Include="ModInfo\Metadata.cs" />
|
||||||
|
@ -52,12 +58,16 @@
|
||||||
<Compile Include="Serialization\Serialization.cs" />
|
<Compile Include="Serialization\Serialization.cs" />
|
||||||
<Compile Include="Serialization\SerializerDataNode.cs" />
|
<Compile Include="Serialization\SerializerDataNode.cs" />
|
||||||
<Compile Include="StaticClass.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="Utilities.cs" />
|
<Compile Include="Utilities.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="manifest.json" />
|
<None Include="manifest.json" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\deploy.targets" />
|
<Import Project="$(SolutionDir)\deploy.targets" />
|
||||||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.2\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,8 +30,16 @@ namespace StardustCore
|
||||||
return (int)((double)c.price * (1.0 + (double)c.quality * 0.25));
|
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)
|
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)
|
||||||
|
|
|
@ -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