Made dialogue map event, and updated Button for UIUtilities to use Texture2DExtended. Spent awhile just fixing it.
This commit is contained in:
parent
68c831029b
commit
4fc3466608
|
@ -946,7 +946,7 @@ namespace AdditionalCropsFramework
|
|||
else
|
||||
{
|
||||
//Log.AsyncC("Animation Manager is working!");
|
||||
spriteBatch.Draw(animationManager.objectTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(animationManager.currentAnimation.sourceRectangle), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
this.animationManager.draw(spriteBatch,animationManager.objectTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(animationManager.currentAnimation.sourceRectangle), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
try
|
||||
{
|
||||
this.animationManager.tickAnimation();
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace CustomNPCFramework
|
|||
{
|
||||
ModMonitor.Log("UGGGGGGG", LogLevel.Error);
|
||||
}
|
||||
ExtendedNPC myNpc3 = new ExtendedNPC(new Framework.ModularNPCS.Sprite(pair.Key,pair.Value),null, new Vector2(14, 14)*Game1.tileSize, 2, "b2");
|
||||
ExtendedNPC myNpc3 = new ExtendedNPC(new Framework.ModularNPCS.Sprite(pair.Key,pair.Value),null,null, new Vector2(14, 14)*Game1.tileSize, 2, "b2");
|
||||
npcTracker.addNewNPCToLocation(Game1.getLocationFromName("BusStop"),myNpc3);
|
||||
myNpc3.SetMovingDown(true);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
<Compile Include="EventSystem.cs" />
|
||||
<Compile Include="Framework\Delegates.cs" />
|
||||
<Compile Include="Framework\EventManager.cs" />
|
||||
<Compile Include="Framework\Events\DialogueDisplayEvent.cs" />
|
||||
<Compile Include="Framework\Events\WarpEvent.cs" />
|
||||
<Compile Include="Framework\FunctionEvents\functionEvent.cs" />
|
||||
<Compile Include="Framework\FunctionEvents\MouseButtonEvents.cs" />
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
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
|
||||
{
|
||||
public class DialogueDisplayEvent :MapEvent
|
||||
{
|
||||
string dialogue;
|
||||
public DialogueDisplayEvent(string Name, GameLocation Location, Vector2 Position, PlayerEvents playerEvents, string Dialogue) : base(Name, Location, Position, playerEvents)
|
||||
{
|
||||
this.name = Name;
|
||||
this.location = Location;
|
||||
this.tilePosition = Position;
|
||||
this.playerEvents = playerEvents;
|
||||
|
||||
this.doesInteractionNeedToRun = true;
|
||||
this.dialogue = Dialogue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the player enters the warp tile event position.
|
||||
/// </summary>s
|
||||
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.activeClickableMenu =new StardewValley.Menus.DialogueBox(this.dialogue);
|
||||
//Game1.drawDialogueBox(this.dialogue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 14 for Windows Desktop
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoSpeed", "AutoSpeed\AutoSpeed.csproj", "{57E7D17E-C237-448B-A50F-CFB67F9BB146}"
|
||||
EndProject
|
||||
|
@ -61,11 +61,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RuneFactoryCropsMod", "Rune
|
|||
{C5F88D48-EA20-40CD-91E2-C8725DC11795} = {C5F88D48-EA20-40CD-91E2-C8725DC11795}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarAI", "..\StarAI\StarAI\StarAI.csproj", "{93632675-991D-425B-96F9-9C2B6BFC4EFE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0756D36A-95C8-480D-8EA6-4584C03010C6} = {0756D36A-95C8-480D-8EA6-4584C03010C6}
|
||||
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}
|
||||
|
@ -174,10 +169,6 @@ Global
|
|||
{8415BB0C-94A7-4E11-B6D5-C31649C3A95D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8415BB0C-94A7-4E11-B6D5-C31649C3A95D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8415BB0C-94A7-4E11-B6D5-C31649C3A95D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{93632675-991D-425B-96F9-9C2B6BFC4EFE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{19F64B03-6A9B-49E1-854A-C05D5A014646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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
|
||||
|
@ -205,4 +196,7 @@ Global
|
|||
{29A68F94-B23C-442B-8867-8B8F3502E64F} = {BAAC8F21-C12F-42B0-A51C-0C5F33B52575}
|
||||
{89C7DF45-8AE5-49AC-ADA9-6312E9590829} = {3EE26DA0-0337-4991-8B02-BCB8D408008C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4135247C-1326-43F4-A762-3916E50635EF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -3,31 +3,40 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
using StardustCore.UIUtilities.MenuComponents;
|
||||
|
||||
namespace StardewSymphonyRemastered.Framework.Menus
|
||||
{
|
||||
class MusicManagerMenu : StardewValley.Menus.IClickableMenu
|
||||
public class MusicManagerMenu : IClickableMenuExtended
|
||||
{
|
||||
public List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString> texturedStrings;
|
||||
private string musicNotePath;
|
||||
|
||||
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)));
|
||||
this.buttons = new List<StardustCore.UIUtilities.MenuComponents.Button>();
|
||||
this.buttons.Add(new Button("myButton", new Rectangle(100, 100, 200, 100), StardewSymphony.textureManager.getTexture("MusicNote").Copy(StardewSymphony.ModHelper), "mynote", new Rectangle(0, 0, 16, 16), 4f, new StardustCore.Animations.Animation(new Rectangle(0, 0, 16, 16)), Color.White, Color.White, false));
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -38,6 +47,12 @@ namespace StardewSymphonyRemastered.Framework.Menus
|
|||
{
|
||||
v.draw(b);
|
||||
}
|
||||
|
||||
foreach (var v in buttons)
|
||||
{
|
||||
v.draw(b);
|
||||
}
|
||||
this.drawMouse(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ using StardewModdingAPI;
|
|||
using StardewValley;
|
||||
using StardewSymphonyRemastered.Framework;
|
||||
using System.IO;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace StardewSymphonyRemastered
|
||||
{
|
||||
|
@ -42,6 +43,8 @@ namespace StardewSymphonyRemastered
|
|||
|
||||
public bool musicPacksInitialized;
|
||||
|
||||
|
||||
public static TextureManager textureManager;
|
||||
/// <summary>
|
||||
/// Entry point for the mod.
|
||||
/// </summary>
|
||||
|
@ -64,12 +67,14 @@ namespace StardewSymphonyRemastered
|
|||
WavMusicDirectory = Path.Combine(MusicPath, "Wav");
|
||||
XACTMusicDirectory = Path.Combine(MusicPath, "XACT");
|
||||
TemplateMusicDirectory = Path.Combine(MusicPath, "Templates");
|
||||
|
||||
textureManager = new TextureManager();
|
||||
this.createDirectories();
|
||||
this.createBlankXACTTemplate();
|
||||
this.createBlankWAVTemplate();
|
||||
|
||||
musicPacksInitialized = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SaveEvents_BeforeSave(object sender, EventArgs e)
|
||||
|
@ -84,9 +89,9 @@ namespace StardewSymphonyRemastered
|
|||
|
||||
private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
|
||||
{
|
||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.O)
|
||||
if (e.KeyPressed == Microsoft.Xna.Framework.Input.Keys.K)
|
||||
{
|
||||
Game1.activeClickableMenu = new StardewSymphonyRemastered.Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height);
|
||||
Game1.activeClickableMenu = new Framework.Menus.MusicManagerMenu(Game1.viewport.Width,Game1.viewport.Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,6 +126,11 @@ namespace StardewSymphonyRemastered
|
|||
/// </summary>
|
||||
public void createDirectories()
|
||||
{
|
||||
string path = Path.Combine(ModHelper.DirectoryPath, "Content", "Graphics", "MusicMenu");
|
||||
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
|
||||
string musicNote = Path.Combine(path, "MusicNote.png");
|
||||
textureManager.addTexture("MusicNote",new Texture2DExtended(ModHelper,StardustCore.Utilities.getRelativeDirectory("StardewSymphonyRemastered", musicNote)));
|
||||
|
||||
if (!Directory.Exists(MusicPath)) Directory.CreateDirectory(MusicPath);
|
||||
if (!Directory.Exists(WavMusicDirectory)) Directory.CreateDirectory(WavMusicDirectory);
|
||||
if (!Directory.Exists(XACTMusicDirectory)) Directory.CreateDirectory(XACTMusicDirectory);
|
||||
|
|
|
@ -46,17 +46,17 @@
|
|||
</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="Framework\Music\MusicPackMetaData.cs" />
|
||||
<Compile Include="Framework\Music\Song.cs" />
|
||||
<Compile Include="Framework\Music\SongListNode.cs" />
|
||||
<Compile Include="StaticExtentions.cs" />
|
||||
<Compile Include="StardewSymphony.cs" />
|
||||
<Compile Include="Framework\MusicHexProcessor.cs" />
|
||||
<Compile Include="Framework\MusicManager.cs" />
|
||||
<Compile Include="Framework\MusicPack.cs" />
|
||||
<Compile Include="Framework\SongSpecifics.cs" />
|
||||
<Compile Include="Framework\WavMusicPack.cs" />
|
||||
<Compile Include="Framework\XACTMusicPack.cs" />
|
||||
<Compile Include="Framework\Music\MusicHexProcessor.cs" />
|
||||
<Compile Include="Framework\Music\MusicManager.cs" />
|
||||
<Compile Include="Framework\Music\MusicPack.cs" />
|
||||
<Compile Include="Framework\Music\SongSpecifics.cs" />
|
||||
<Compile Include="Framework\Music\WavMusicPack.cs" />
|
||||
<Compile Include="Framework\Music\XACTMusicPack.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -6,5 +6,11 @@
|
|||
"UniqueID": "Omegasis.StardewSymphony",
|
||||
"EntryDll": "StardewSymphonyRemastered.dll",
|
||||
"MinimumApiVersion": "2.0",
|
||||
"UpdateKeys": [ "Nexus:425" ]
|
||||
"UpdateKeys": [ "Nexus:425" ],
|
||||
"Dependencies": [
|
||||
{
|
||||
"UniqueID": "Omegasis.StardustCore",
|
||||
"IsRequired": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -13,17 +13,40 @@ namespace StardustCore.Animations
|
|||
public readonly int frameDuration;
|
||||
public int frameCountUntilNextAnimation;
|
||||
|
||||
public Animation(Rectangle rec,int existForXFrames)
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that causes the animation frame count to be set to -1; This forces it to never change.
|
||||
/// </summary>
|
||||
/// <param name="SourceRectangle">The draw source for this animation.</param>
|
||||
public Animation(Rectangle SourceRectangle)
|
||||
{
|
||||
sourceRectangle = rec;
|
||||
sourceRectangle = SourceRectangle;
|
||||
frameDuration = -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="SourceRectangle">The draw source for this animation.</param>
|
||||
/// <param name="existForXFrames">How many on screen frames this animation stays for. Every draw frame decrements an active animation by 1 frame. Set this to -1 to have it be on the screen infinitely.</param>
|
||||
public Animation(Rectangle SourceRectangle,int existForXFrames)
|
||||
{
|
||||
sourceRectangle = SourceRectangle;
|
||||
frameDuration = existForXFrames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrements the amount of frames this animation is on the screen for by 1.
|
||||
/// </summary>
|
||||
public void tickAnimationFrame()
|
||||
{
|
||||
frameCountUntilNextAnimation--;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This sets the animation frame count to be the max duration. I.E restart the timer.
|
||||
/// </summary>
|
||||
public void startAnimation()
|
||||
{
|
||||
frameCountUntilNextAnimation = frameDuration;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -18,7 +20,7 @@ namespace StardustCore.Animations
|
|||
public string currentAnimationName;
|
||||
public int currentAnimationListIndex;
|
||||
public List<Animation> currentAnimationList = new List<Animation>();
|
||||
public Texture2D objectTexture; ///Might not be necessary if I use the CoreObject texture sheet.
|
||||
public Texture2DExtended objectTexture; ///Might not be necessary if I use the CoreObject texture sheet.
|
||||
public Animation defaultDrawFrame;
|
||||
public Animation currentAnimation;
|
||||
bool enabled;
|
||||
|
@ -29,7 +31,7 @@ namespace StardustCore.Animations
|
|||
/// <param name="ObjectTexture">The texture that will be used for the animation. This is typically the same as the object this class is attached to.</param>
|
||||
/// <param name="DefaultFrame">This is used if no animations will be available to the animation manager.</param>
|
||||
/// <param name="EnabledByDefault">Whether or not animations play by default. Default value is true.</param>
|
||||
public AnimationManager (Texture2D ObjectTexture,Animation DefaultFrame, bool EnabledByDefault=true)
|
||||
public AnimationManager (Texture2DExtended ObjectTexture,Animation DefaultFrame, bool EnabledByDefault=true)
|
||||
{
|
||||
currentAnimationListIndex = 0;
|
||||
this.objectTexture = ObjectTexture;
|
||||
|
@ -38,7 +40,7 @@ namespace StardustCore.Animations
|
|||
currentAnimation = this.defaultDrawFrame;
|
||||
}
|
||||
|
||||
public AnimationManager(Texture2D ObjectTexture,Animation DefaultFrame ,Dictionary<string, List<Animation>> animationsToPlay, string startingAnimationKey, int startingAnimationFrame=0,bool EnabledByDefault=true)
|
||||
public AnimationManager(Texture2DExtended ObjectTexture,Animation DefaultFrame ,Dictionary<string, List<Animation>> animationsToPlay, string startingAnimationKey, int startingAnimationFrame=0,bool EnabledByDefault=true)
|
||||
{
|
||||
currentAnimationListIndex = 0;
|
||||
this.objectTexture = ObjectTexture;
|
||||
|
@ -187,6 +189,33 @@ namespace StardustCore.Animations
|
|||
}
|
||||
return ok;
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to handle general drawing functionality using the animation manager.
|
||||
/// </summary>
|
||||
/// <param name="spriteBatch">We need a spritebatch to draw.</param>
|
||||
/// <param name="texture">The texture to draw.</param>
|
||||
/// <param name="Position">The onscreen position to draw to.</param>
|
||||
/// <param name="sourceRectangle">The source rectangle on the texture to draw.</param>
|
||||
/// <param name="drawColor">The color to draw the thing passed in.</param>
|
||||
/// <param name="rotation">The rotation of the animation texture being drawn.</param>
|
||||
/// <param name="origin">The origin of the texture.</param>
|
||||
/// <param name="scale">The scale of the texture.</param>
|
||||
/// <param name="spriteEffects">Effects that get applied to the sprite.</param>
|
||||
/// <param name="LayerDepth">The dept at which to draw the texture.</param>
|
||||
public void draw(SpriteBatch spriteBatch,Texture2D texture, Vector2 Position, Rectangle? sourceRectangle,Color drawColor, float rotation, Vector2 origin, float scale,SpriteEffects spriteEffects, float LayerDepth)
|
||||
{
|
||||
//Log.AsyncC("Animation Manager is working!");
|
||||
spriteBatch.Draw(texture, Position, sourceRectangle, drawColor, rotation, origin, scale, spriteEffects, LayerDepth);
|
||||
try
|
||||
{
|
||||
this.tickAnimation();
|
||||
// Log.AsyncC("Tick animation");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ModCore.ModMonitor.Log(err.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<Compile Include="IlluminateFramework\Colors.cs" />
|
||||
<Compile Include="Math\Hex.cs" />
|
||||
<Compile Include="Math\Hex32.cs" />
|
||||
<Compile Include="UIUtilities\IClickableMenuExtended.cs" />
|
||||
<Compile Include="UIUtilities\LayeredTexture.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\CharacterSheets\GenericCharacterSheets.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\CharacterSheets\VanillaCharacterSheet.cs" />
|
||||
|
@ -65,6 +66,7 @@
|
|||
<Compile Include="UIUtilities\SpriteFonts\Fonts\VanillaFont.cs" />
|
||||
<Compile Include="UIUtilities\SpriteFonts\SpriteFont.cs" />
|
||||
<Compile Include="UIUtilities\Texture2DExtended.cs" />
|
||||
<Compile Include="UIUtilities\TextureManager.cs" />
|
||||
<Compile Include="Utilities.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities
|
||||
{
|
||||
public class IClickableMenuExtended : StardewValley.Menus.IClickableMenu
|
||||
{
|
||||
public List<StardustCore.UIUtilities.SpriteFonts.Components.TexturedString> texturedStrings;
|
||||
public List<StardustCore.UIUtilities.MenuComponents.Button> buttons;
|
||||
|
||||
public override void receiveRightClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,12 +18,12 @@ namespace StardustCore.UIUtilities.MenuComponents
|
|||
/// Basic Button constructor.
|
||||
/// </summary>
|
||||
/// <param name="Bounds"></param>
|
||||
/// <param name="Texture"></param>
|
||||
/// <param name="Texture">The texture sheet to be drawn to the screen. Used with the animation manager this allows you to reference different parts of the sheet at any given time.</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)
|
||||
public Button(string Name,Rectangle Bounds,Texture2DExtended Texture,string displayText,Rectangle sourceRect,float Scale,Animations.Animation defaultAnimation, Color DrawColor,Color TextColor, bool AnimationEnabled=true) : base(Bounds,Texture.texture,sourceRect,Scale)
|
||||
{
|
||||
this.animationManager = new Animations.AnimationManager(Texture, defaultAnimation,AnimationEnabled);
|
||||
this.label = displayText;
|
||||
|
@ -54,7 +54,7 @@ namespace StardustCore.UIUtilities.MenuComponents
|
|||
/// <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)
|
||||
public Button(string Name,Rectangle Bounds,Texture2DExtended 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.texture, sourceRect, Scale)
|
||||
{
|
||||
this.animationManager = new Animations.AnimationManager(Texture, defaultAnimation, animationsToPlay, startingAnimationKey, startingAnimationFrame, AnimationEnabled);
|
||||
this.label = displayText;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -14,16 +15,20 @@ namespace StardustCore.UIUtilities
|
|||
public Texture2D texture;
|
||||
public string path;
|
||||
|
||||
public Texture2DExtended(string path)
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="path">The relative path to file on disk. See StardustCore.Utilities.getRelativePath(modname,path);
|
||||
public Texture2DExtended(IModHelper helper,string path)
|
||||
{
|
||||
this.Name = Path.GetFileName(path);
|
||||
this.path = path;
|
||||
this.texture = StardustCore.ModCore.ModHelper.Content.Load<Texture2D>(path);
|
||||
this.texture = helper.Content.Load<Texture2D>(path);
|
||||
}
|
||||
|
||||
public Texture2DExtended Copy()
|
||||
public Texture2DExtended Copy(IModHelper helper)
|
||||
{
|
||||
return new Texture2DExtended(this.path);
|
||||
return new Texture2DExtended(helper,this.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StardustCore.UIUtilities
|
||||
{
|
||||
public class TextureManager
|
||||
{
|
||||
public Dictionary<string,Texture2DExtended> textures;
|
||||
|
||||
public TextureManager()
|
||||
{
|
||||
this.textures = new Dictionary<string,Texture2DExtended>();
|
||||
}
|
||||
|
||||
public void addTexture(string name,Texture2DExtended texture)
|
||||
{
|
||||
this.textures.Add(name,texture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a Texture2DExtended held by the manager.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public Texture2DExtended getTexture(string name)
|
||||
{
|
||||
foreach(var v in textures)
|
||||
{
|
||||
if (v.Key == name) return v.Value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -25,6 +25,19 @@ namespace StardustCore
|
|||
public static List<CoreObject> masterRemovalList = new List<CoreObject>();
|
||||
|
||||
|
||||
public static string getShortenedDirectory(string modName,string path)
|
||||
{
|
||||
string lol = (string)path.Clone();
|
||||
string[] spliter = lol.Split(new string[] { modName }, StringSplitOptions.None);
|
||||
return spliter[1];
|
||||
}
|
||||
|
||||
public static string getRelativeDirectory(string modName,string path)
|
||||
{
|
||||
string s = getShortenedDirectory(modName,path);
|
||||
return s.Remove(0, 1);
|
||||
}
|
||||
|
||||
public static int sellToStorePrice(CoreObject c)
|
||||
{
|
||||
return (int)((double)c.price * (1.0 + (double)c.quality * 0.25));
|
||||
|
|
|
@ -9,7 +9,7 @@ using StardewValley;
|
|||
using EventSystem.Framework.FunctionEvents;
|
||||
using EventSystem.Framework.Information;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
using EventSystem.Framework.Events;
|
||||
namespace SundropMapEvents
|
||||
{
|
||||
public class Class1 :Mod
|
||||
|
@ -26,7 +26,8 @@ namespace SundropMapEvents
|
|||
|
||||
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)));
|
||||
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new WarpEvent("toRR", Game1.getLocationFromName("BusStop"), new Vector2(6, 11), new PlayerEvents(null, null), new WarpInformation("BusStop", 10, 12, 2, false)));
|
||||
EventSystem.EventSystem.eventManager.addEvent(Game1.getLocationFromName("BusStop"), new DialogueDisplayEvent("Hello.", Game1.getLocationFromName("BusStop"), new Vector2(10, 13), new PlayerEvents(null, null), "Hello there!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue