More work on title screen. Also made animated sprite class.

This commit is contained in:
JoshuaNavarro 2019-07-19 11:17:37 -07:00
parent 7c170ade98
commit 0e1483605a
7 changed files with 125 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

View File

@ -7,10 +7,15 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using StardewValley;
using StardustCore.Animations;
using StardustCore.UIUtilities;
using StardustCore.UIUtilities.MenuComponents;
namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
{
/// <summary>
/// TODO: Finish adding in a button prompts and click prompt and draw them to the screen.
/// </summary>
public class CharacterSelectScreen: IClickableMenuExtended
{
StardustCore.UIUtilities.Texture2DExtended background;
@ -27,6 +32,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
public Dictionary<SSCEnums.PlayerID, int> inputDelays;
public int maxInputDelay = 20;
public Dictionary<string, StardustCore.Animations.AnimatedSprite> animatedSprites;
public CharacterSelectScreen(int x, int y, int width, int height) : base(x, y, width, height, false)
{
this.background = SeasideScramble.self.textureUtils.getExtendedTexture("SSCMaps", "TitleScreenBackground");
@ -65,6 +72,23 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
{ SSCEnums.PlayerID.Four,0},
};
SeasideScramble.self.camera.snapToPosition(new Vector2(0, 0));
this.animatedSprites = new Dictionary<string, StardustCore.Animations.AnimatedSprite>();
this.animatedSprites.Add("P1 A Button" ,new StardustCore.Animations.AnimatedSprite("P1AButton",new Vector2(100,100),new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("SSCUI", "AButton"), new Animation(0, 0, 28, 27)),Color.White));
/*
this.animatedSprites.Add(new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("SSCUI", "MouseClick"), new Animation(0, 0, 31, 32), new Dictionary<string, List<Animation>>()
{
{"Click1",new List<Animation>(){
new Animation(0,0,31,32,60),
new Animation(31,0,31,32,60)
} }
}, "Click1"));
*/
}
public CharacterSelectScreen(xTile.Dimensions.Rectangle viewport) : this(0, 0, viewport.Width, viewport.Height)

View File

@ -88,8 +88,14 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
playerManager.searchForTextures(ModCore.ModHelper, ModCore.Manifest, Path.Combine("Content", "Minigames", "SeasideScramble", "Graphics", "Player"));
TextureManager mapTextureManager = new TextureManager("SSCMaps");
mapTextureManager.searchForTextures(ModCore.ModHelper, ModCore.Manifest, Path.Combine("Content", "Minigames", "SeasideScramble", "Maps", "Backgrounds"));
TextureManager UIManager = new TextureManager("SSCUI");
UIManager.searchForTextures(ModCore.ModHelper, ModCore.Manifest, Path.Combine("Content", "Minigames", "SeasideScramble", "Graphics", "UI"));
this.textureUtils.addTextureManager(playerManager);
this.textureUtils.addTextureManager(mapTextureManager);
this.textureUtils.addTextureManager(UIManager);
}
private void LoadMaps()

View File

@ -133,6 +133,12 @@
<Content Include="Content\Minigames\SeasideScramble\Graphics\Player\Junimo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Minigames\SeasideScramble\Graphics\UI\AButton.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Minigames\SeasideScramble\Graphics\UI\MouseClick.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Minigames\SeasideScramble\Maps\Backgrounds\TitleScreenBackground.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardustCore.Animations;
namespace StardustCore.Animations
{
/// <summary>
/// Deals with animated sprites.
/// </summary>
public class AnimatedSprite
{
/// <summary>
/// The position of the sprite.
/// </summary>
public Vector2 position;
/// <summary>
/// The animation manager for the sprite.
/// </summary>
public AnimationManager animation;
/// <summary>
/// The name of the sprite.
/// </summary>
public string name;
/// <summary>
/// The draw color for the sprite.
/// </summary>
public Color color;
/// <summary>
/// Constructor.
/// </summary>
public AnimatedSprite()
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="Name">The name of the sprite.</param>
/// <param name="Position">The position of the sprite.</param>
/// <param name="Animation">The animation manager for the sprite.</param>
/// <param name="DrawColor">The draw color for the sprite.</param>
public AnimatedSprite(string Name, Vector2 Position, AnimationManager Animation, Color DrawColor)
{
this.position = Position;
this.name = Name;
this.animation = Animation;
this.color = DrawColor;
}
/// <summary>
/// Updates the sprite's logic.
/// </summary>
/// <param name="Time"></param>
public virtual void Update(GameTime Time)
{
}
/// <summary>
/// Draws the sprite to the screen.
/// </summary>
/// <param name="b"></param>
public virtual void draw(SpriteBatch b)
{
this.draw(b, 1f, 0f);
}
/// <summary>
/// Draws the sprite to the screen.
/// </summary>
/// <param name="b"></param>
/// <param name="scale"></param>
/// <param name="depth"></param>
public virtual void draw(SpriteBatch b, float scale, float depth)
{
this.animation.draw(b, this.position, this.color, scale, SpriteEffects.None, depth);
}
}
}

View File

@ -93,6 +93,7 @@
<Compile Include="ModConfig.cs" />
<Compile Include="UIUtilities\IClickableMenuExtended.cs" />
<Compile Include="UIUtilities\LayeredTexture.cs" />
<Compile Include="Animations\AnimatedSprite.cs" />
<Compile Include="UIUtilities\MenuComponents\BlinkingText.cs" />
<Compile Include="UIUtilities\MenuComponents\CycleButton.cs" />
<Compile Include="UIUtilities\MenuComponents\Delegates\Delegates.cs" />