From 0e1483605a223579606d0ced48264ed147b64c40 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Fri, 19 Jul 2019 11:17:37 -0700 Subject: [PATCH] More work on title screen. Also made animated sprite class. --- .../SeasideScramble/Graphics/UI/AButton.png | Bin 0 -> 316 bytes .../Graphics/UI/MouseClick.png | Bin 0 -> 437 bytes .../SSCMenus/CharacterSelectScreen.cs | 24 +++++ .../SeasideScramble.cs | 6 ++ GeneralMods/Revitalize/Revitalize.csproj | 6 ++ .../StardustCore/Animations/AnimatedSprite.cs | 88 ++++++++++++++++++ GeneralMods/StardustCore/StardustCore.csproj | 1 + 7 files changed, 125 insertions(+) create mode 100644 GeneralMods/Revitalize/Content/Minigames/SeasideScramble/Graphics/UI/AButton.png create mode 100644 GeneralMods/Revitalize/Content/Minigames/SeasideScramble/Graphics/UI/MouseClick.png create mode 100644 GeneralMods/StardustCore/Animations/AnimatedSprite.cs diff --git a/GeneralMods/Revitalize/Content/Minigames/SeasideScramble/Graphics/UI/AButton.png b/GeneralMods/Revitalize/Content/Minigames/SeasideScramble/Graphics/UI/AButton.png new file mode 100644 index 0000000000000000000000000000000000000000..85d10d123eaf2e2c554617fe943745f3e917d223 GIT binary patch literal 316 zcmV-C0mJ@@P)ZqPXNI8egy!0vfAmN=Q#kIsUHocW*W%s@0?wn{zkk`Q@>fNWh1rIK)ckE@rt78 z?$%L<5>mVOt<@}kyllIorHREEZvTh98p`ZsX8~&KObxYcHL)&+T4#yV0so$C^~;d+ zOzSwTKMB^OgfSmG_+eUADEx2w53jf)wv4u-@g_R=4C`CX8TZ298= O0000P9=zMaB!W?ae-`ol@E}@D!pAEz-rsuK#ptd4)Oqk2tI-jaJ9{( z2rkjM>gHxcF1a5TWM-VtamHN%uDa@9h*2croMYc6r5w!7IY*uEqS!;=Av@)*=0>QeO%S28f=j5#G&00000NkvXXu0mjfm|Mv> literal 0 HcmV?d00001 diff --git a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/CharacterSelectScreen.cs b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/CharacterSelectScreen.cs index d3133ce6..e7a400ed 100644 --- a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/CharacterSelectScreen.cs +++ b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/CharacterSelectScreen.cs @@ -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 { + /// + /// TODO: Finish adding in a button prompts and click prompt and draw them to the screen. + /// public class CharacterSelectScreen: IClickableMenuExtended { StardustCore.UIUtilities.Texture2DExtended background; @@ -27,6 +32,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus public Dictionary inputDelays; public int maxInputDelay = 20; + public Dictionary 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(); + + 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>() + { + {"Click1",new List(){ + 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) diff --git a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SeasideScramble.cs b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SeasideScramble.cs index 8f6a7019..7d4b3589 100644 --- a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SeasideScramble.cs +++ b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SeasideScramble.cs @@ -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() diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index d76ac4f6..6dd36a7c 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -133,6 +133,12 @@ Always + + Always + + + Always + Always diff --git a/GeneralMods/StardustCore/Animations/AnimatedSprite.cs b/GeneralMods/StardustCore/Animations/AnimatedSprite.cs new file mode 100644 index 00000000..1a7955ee --- /dev/null +++ b/GeneralMods/StardustCore/Animations/AnimatedSprite.cs @@ -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 +{ + /// + /// Deals with animated sprites. + /// + public class AnimatedSprite + { + /// + /// The position of the sprite. + /// + public Vector2 position; + /// + /// The animation manager for the sprite. + /// + public AnimationManager animation; + /// + /// The name of the sprite. + /// + public string name; + /// + /// The draw color for the sprite. + /// + public Color color; + + /// + /// Constructor. + /// + public AnimatedSprite() + { + + } + + /// + /// Constructor. + /// + /// The name of the sprite. + /// The position of the sprite. + /// The animation manager for the sprite. + /// The draw color for the sprite. + public AnimatedSprite(string Name, Vector2 Position, AnimationManager Animation, Color DrawColor) + { + this.position = Position; + this.name = Name; + this.animation = Animation; + this.color = DrawColor; + } + + /// + /// Updates the sprite's logic. + /// + /// + public virtual void Update(GameTime Time) + { + + } + + /// + /// Draws the sprite to the screen. + /// + /// + public virtual void draw(SpriteBatch b) + { + this.draw(b, 1f, 0f); + } + + /// + /// Draws the sprite to the screen. + /// + /// + /// + /// + public virtual void draw(SpriteBatch b, float scale, float depth) + { + this.animation.draw(b, this.position, this.color, scale, SpriteEffects.None, depth); + } + + + } +} diff --git a/GeneralMods/StardustCore/StardustCore.csproj b/GeneralMods/StardustCore/StardustCore.csproj index 4f4111bf..2ed4ed41 100644 --- a/GeneralMods/StardustCore/StardustCore.csproj +++ b/GeneralMods/StardustCore/StardustCore.csproj @@ -93,6 +93,7 @@ +