Added in controller support for characters and made the menu a stack.
This commit is contained in:
parent
02e6bd7e49
commit
bac0f12dc5
|
@ -16,5 +16,13 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
Right
|
||||
}
|
||||
|
||||
public enum PlayerID
|
||||
{
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
Four
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
|
||||
{
|
||||
/// <summary>
|
||||
/// Deals with handling all menus for the minigame.
|
||||
/// </summary>
|
||||
public class SSCMenuManager
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the active menu aka the top of the menu stack.
|
||||
/// </summary>
|
||||
public IClickableMenuExtended activeMenu
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.menus == null) return null;
|
||||
if (this.menus.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return this.menus.Peek();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if there is a menu up.
|
||||
/// </summary>
|
||||
public bool isMenuUp
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.menus == null) return false;
|
||||
return this.menus.Count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A stack that controlls all active menus.
|
||||
/// </summary>
|
||||
public Stack<IClickableMenuExtended> menus;
|
||||
|
||||
|
||||
public SSCMenuManager()
|
||||
{
|
||||
this.menus = new Stack<IClickableMenuExtended>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new menu to the menu stack.
|
||||
/// </summary>
|
||||
/// <param name="menu"></param>
|
||||
public void addNewMenu(IClickableMenuExtended menu)
|
||||
{
|
||||
this.menus.Push(menu);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the top most active menu on the menu stack.
|
||||
/// </summary>
|
||||
public void closeActiveMenu()
|
||||
{
|
||||
if (this.menus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.menus.Count == 0) return;
|
||||
IClickableMenuExtended m = this.menus.Pop();
|
||||
m.exitMenu();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes all menus in the menu stack.
|
||||
/// </summary>
|
||||
public void closeAllMenus()
|
||||
{
|
||||
if (this.menus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.menus.Count == 0) return;
|
||||
while (this.isMenuUp)
|
||||
{
|
||||
this.closeActiveMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes menus until the passed in menu is on top of the stack.
|
||||
/// </summary>
|
||||
/// <param name="menu"></param>
|
||||
public void closeUntilThisMenu(IClickableMenuExtended menu)
|
||||
{
|
||||
while (this.activeMenu != menu)
|
||||
{
|
||||
this.closeActiveMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the give menu is the active menu.
|
||||
/// </summary>
|
||||
/// <param name="menu"></param>
|
||||
/// <returns></returns>
|
||||
public bool isThisActiveMenu(IClickableMenuExtended menu)
|
||||
{
|
||||
return this.menus.Peek() == menu;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws all menus in the menu stack.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void drawAll(SpriteBatch b)
|
||||
{
|
||||
for(int i = this.menus.Count - 1; i>=0; i--)
|
||||
{
|
||||
this.menus.ElementAt(i).draw(b);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -12,6 +12,9 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
|
|||
{
|
||||
StardustCore.UIUtilities.Texture2DExtended background;
|
||||
StardustCore.UIUtilities.MenuComponents.BlinkingText menuText;
|
||||
|
||||
public bool closeMenu;
|
||||
|
||||
public TitleScreen(int x, int y, int width, int height):base(x,y,width,height,false)
|
||||
{
|
||||
this.background = SeasideScramble.self.textureUtils.getExtendedTexture("SSCMaps", "TitleScreenBackground");
|
||||
|
@ -23,6 +26,11 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What happens when the game's window size changes.
|
||||
/// </summary>
|
||||
/// <param name="oldBounds"></param>
|
||||
/// <param name="newBounds"></param>
|
||||
public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
|
||||
{
|
||||
this.xPositionOnScreen = newBounds.X;
|
||||
|
@ -33,37 +41,69 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus
|
|||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// What happens when the menu receives a left click.
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="playSound"></param>
|
||||
public override void receiveLeftClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
//Start the game!
|
||||
if (SeasideScramble.self.menuManager.isThisActiveMenu(this) == false) return;
|
||||
this.closeMenu = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the menu is ready to close.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool readyToClose()
|
||||
{
|
||||
if (this.closeMenu == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//When menu is closed!
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the menu.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
public override void update(GameTime time)
|
||||
{
|
||||
if (SeasideScramble.self.menuManager.isThisActiveMenu(this) == false) return;
|
||||
this.menuText.update(time);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the menu to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public override void draw(SpriteBatch b)
|
||||
{
|
||||
|
||||
b.GraphicsDevice.Clear(Color.Black);
|
||||
this.drawTitleBackground(b);
|
||||
this.drawTitleText(b);
|
||||
this.drawMouse(b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the background for the title screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void drawTitleBackground(SpriteBatch b)
|
||||
{
|
||||
b.Draw(this.background.texture,new Vector2(this.xPositionOnScreen,this.yPositionOnScreen),SeasideScramble.self.camera.getXNARect() ,Color.White);
|
||||
//this.drawDialogueBoxBackground(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, Color.Black);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the text for the title screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void drawTitleText(SpriteBatch b)
|
||||
{
|
||||
Vector2 offset=StardewValley.Game1.dialogueFont.MeasureString(this.menuText.displayText);
|
||||
|
|
|
@ -11,19 +11,24 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
{
|
||||
public class SSCPlayer
|
||||
{
|
||||
//TODO: Hint when left animations are played make sure to FLIP THE SPRITE;
|
||||
//Make game camera class!!!
|
||||
//TODO: Add gamepad input
|
||||
//TODO: Add movement speed variable
|
||||
//TODO: Add in health
|
||||
//TODO: Add in player HUD
|
||||
public AnimationManager characterSpriteController;
|
||||
public bool flipSprite;
|
||||
public SSCEnums.FacingDirection facingDirection;
|
||||
public Microsoft.Xna.Framework.Vector2 position;
|
||||
public bool isMoving;
|
||||
private bool movedThisFrame;
|
||||
public Color playerColor;
|
||||
public SSCEnums.PlayerID playerID;
|
||||
|
||||
public const int junimoWalkingAnimationSpeed = 10;
|
||||
|
||||
public SSCPlayer()
|
||||
public SSCPlayer(SSCEnums.PlayerID PlayerID)
|
||||
{
|
||||
this.playerID = PlayerID;
|
||||
this.facingDirection = SSCEnums.FacingDirection.Down;
|
||||
this.characterSpriteController = new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("SSCPlayer", "Junimo"), new Animation(0, 0, 16, 16), new Dictionary<string, List<Animation>>{
|
||||
{"Idle_F",new List<Animation>()
|
||||
|
@ -87,29 +92,43 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
new Animation(16*7,16*4,16,16,junimoWalkingAnimationSpeed),
|
||||
} },
|
||||
|
||||
|
||||
|
||||
|
||||
},"Idle_F",0,true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the color for the player.
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
public void setColor(Color color)
|
||||
{
|
||||
this.playerColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plays an animation for the character.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public void playAnimation(string name)
|
||||
{
|
||||
this.characterSpriteController.setAnimation(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the character to the screen.
|
||||
/// </summary>
|
||||
/// <param name="b"></param>
|
||||
public void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch b)
|
||||
{
|
||||
this.characterSpriteController.draw(b, SeasideScramble.GlobalToLocal(SeasideScramble.self.camera.viewport,this.position), this.playerColor, 4f, this.flipSprite == true ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (this.position.Y) / 10000f));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called every frame to do update logic.
|
||||
/// </summary>
|
||||
/// <param name="Time"></param>
|
||||
public void update(GameTime Time)
|
||||
{
|
||||
this.movedThisFrame = false;
|
||||
if (this.isMoving == false)
|
||||
{
|
||||
if(this.facingDirection== SSCEnums.FacingDirection.Down)
|
||||
|
@ -156,6 +175,11 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Movement logic //
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
#region
|
||||
|
||||
/// <summary>
|
||||
/// Checks for moving the player.
|
||||
/// </summary>
|
||||
|
@ -163,6 +187,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
public void movePlayer(SSCEnums.FacingDirection direction)
|
||||
{
|
||||
this.isMoving = true;
|
||||
this.movedThisFrame = true;
|
||||
if(direction== SSCEnums.FacingDirection.Up)
|
||||
{
|
||||
this.facingDirection = direction;
|
||||
|
@ -183,15 +208,59 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
this.facingDirection = direction;
|
||||
this.position += new Vector2(1, 0);
|
||||
}
|
||||
ModCore.log(this.position);
|
||||
//ModCore.log(this.position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks when the player presses a key on the keyboard.
|
||||
/// </summary>
|
||||
/// <param name="k"></param>
|
||||
public void receiveKeyPress(Microsoft.Xna.Framework.Input.Keys k)
|
||||
{
|
||||
this.checkForMovementInput(k);
|
||||
if (this.playerID == SSCEnums.PlayerID.One)
|
||||
{
|
||||
this.checkForMovementInput(k);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Checks when the gamepad receives input.
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
public void receiveGamepadInput(GamePadState state)
|
||||
{
|
||||
if (SeasideScramble.self.menuManager.isMenuUp == false)
|
||||
{
|
||||
//Do gamepad input here!
|
||||
if (state.ThumbSticks.Left.X < 0)
|
||||
{
|
||||
this.movePlayer(SSCEnums.FacingDirection.Left);
|
||||
}
|
||||
else if (state.ThumbSticks.Left.X > 0)
|
||||
{
|
||||
this.movePlayer(SSCEnums.FacingDirection.Right);
|
||||
}
|
||||
if (state.ThumbSticks.Left.Y < 0)
|
||||
{
|
||||
this.movePlayer(SSCEnums.FacingDirection.Down);
|
||||
}
|
||||
else if (state.ThumbSticks.Left.Y > 0)
|
||||
{
|
||||
this.movePlayer(SSCEnums.FacingDirection.Up);
|
||||
}
|
||||
if (state.ThumbSticks.Left.X == 0 && state.ThumbSticks.Left.Y == 0 && this.movedThisFrame==false)
|
||||
{
|
||||
this.isMoving = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers when there isn't a key being pressed.
|
||||
/// </summary>
|
||||
/// <param name="K"></param>
|
||||
public void receiveKeyRelease(Keys K)
|
||||
{
|
||||
if (this.playerID != SSCEnums.PlayerID.One) return;
|
||||
//throw new NotImplementedException();
|
||||
if (K == Keys.A)
|
||||
{
|
||||
|
@ -221,7 +290,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
/// <param name="K"></param>
|
||||
private void checkForMovementInput(Keys K)
|
||||
{
|
||||
if (SeasideScramble.self.isMenuUp) return;
|
||||
if (this.playerID != SSCEnums.PlayerID.One) return;
|
||||
if (SeasideScramble.self.menuManager.isMenuUp) return;
|
||||
//Microsoft.Xna.Framework.Input.GamePadState state = this.getGamepadState(PlayerIndex.One);
|
||||
if (K == Keys.A)
|
||||
{
|
||||
|
@ -243,12 +313,9 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
ModCore.log("D pressed for player!");
|
||||
this.movePlayer(SSCEnums.FacingDirection.Right);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,33 +13,24 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
{
|
||||
public class SeasideScramble : StardewValley.Minigames.IMinigame
|
||||
{
|
||||
|
||||
public static SeasideScramble self;
|
||||
|
||||
SeasideScrambleMap currentMap;
|
||||
public Dictionary<string, SeasideScrambleMap> SeasideScrambleMaps;
|
||||
|
||||
public int currentNumberOfPlayers = 0;
|
||||
public const int maxPlayers = 4;
|
||||
public Dictionary<SSCEnums.PlayerID, SSCPlayer> players;
|
||||
|
||||
public Dictionary<string, SeasideScrambleMap> SeasideScrambleMaps;
|
||||
public bool quitGame;
|
||||
public Vector2 topLeftScreenCoordinate;
|
||||
|
||||
|
||||
public SSCTextureUtilities textureUtils;
|
||||
|
||||
public SSCPlayer player;
|
||||
|
||||
//public xTile.Dimensions.Rectangle viewport;
|
||||
|
||||
public SSCCamera camera;
|
||||
|
||||
public IClickableMenuExtended activeMenu;
|
||||
public bool isMenuUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.activeMenu != null;
|
||||
}
|
||||
}
|
||||
public SSCMenus.SSCMenuManager menuManager;
|
||||
|
||||
public SeasideScramble()
|
||||
{
|
||||
|
@ -48,17 +39,31 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
//this.viewport = new xTile.Dimensions.Rectangle(StardewValley.Game1.viewport);
|
||||
this.topLeftScreenCoordinate = new Vector2((float)(this.camera.viewport.Width / 2 - 384), (float)(this.camera.viewport.Height / 2 - 384));
|
||||
|
||||
|
||||
this.LoadTextures();
|
||||
|
||||
this.LoadMaps();
|
||||
this.loadStartingMap();
|
||||
this.quitGame = false;
|
||||
|
||||
this.player = new SSCPlayer();
|
||||
this.player.setColor(Color.Red);
|
||||
this.players = new Dictionary<SSCEnums.PlayerID, SSCPlayer>();
|
||||
this.players.Add(SSCEnums.PlayerID.One, new SSCPlayer(SSCEnums.PlayerID.One));
|
||||
|
||||
this.activeMenu = new SSCMenus.TitleScreen(this.camera.viewport);
|
||||
this.getPlayer(SSCEnums.PlayerID.One).setColor(Color.PaleVioletRed);
|
||||
|
||||
|
||||
this.menuManager = new SSCMenus.SSCMenuManager();
|
||||
|
||||
this.menuManager.addNewMenu(new SSCMenus.TitleScreen(this.camera.viewport));
|
||||
|
||||
}
|
||||
|
||||
public SSCPlayer getPlayer(SSCEnums.PlayerID id)
|
||||
{
|
||||
if (this.players.ContainsKey(id))
|
||||
{
|
||||
return this.players[id];
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
|
||||
private void LoadTextures()
|
||||
|
@ -117,16 +122,18 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
this.currentMap.draw(b);
|
||||
}
|
||||
b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null);
|
||||
if (this.player != null)
|
||||
{
|
||||
this.player.draw(b);
|
||||
|
||||
foreach(SSCPlayer p in this.players.Values) {
|
||||
p.draw(b);
|
||||
}
|
||||
|
||||
if (this.activeMenu != null)
|
||||
/*
|
||||
if (this.menuManager.activeMenu != null)
|
||||
{
|
||||
this.activeMenu.draw(b);
|
||||
this.menuManager.activeMenu.draw(b);
|
||||
}
|
||||
|
||||
*/
|
||||
this.menuManager.drawAll(b);
|
||||
b.End();
|
||||
}
|
||||
|
||||
|
@ -156,7 +163,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
/// <returns></returns>
|
||||
public bool overrideFreeMouseMovement()
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
@ -180,29 +187,63 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
{
|
||||
this.quitGame = true;
|
||||
}
|
||||
this.player.receiveKeyPress(k);
|
||||
|
||||
foreach(SSCPlayer player in this.players.Values)
|
||||
{
|
||||
player.receiveKeyPress(k);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private GamePadState getGamepadState(PlayerIndex index)
|
||||
/// <summary>
|
||||
/// Gets a gamepad state.
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public GamePadState getGamepadState(PlayerIndex index)
|
||||
{
|
||||
return Microsoft.Xna.Framework.Input.GamePad.GetState(PlayerIndex.One);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the minigame registeres a key on the keyboard being released.
|
||||
/// </summary>
|
||||
/// <param name="K"></param>
|
||||
public void receiveKeyRelease(Keys K)
|
||||
{
|
||||
this.player.receiveKeyRelease(K);
|
||||
foreach (SSCPlayer player in this.players.Values)
|
||||
{
|
||||
player.receiveKeyRelease(K);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the minigame receives a left click.
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="playSound"></param>
|
||||
public void receiveLeftClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
if (this.menuManager.activeMenu != null)
|
||||
{
|
||||
this.menuManager.activeMenu.receiveLeftClick(x, y, playSound);
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the minigame receives a right click.
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="playSound"></param>
|
||||
public void receiveRightClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
if (this.menuManager.activeMenu != null)
|
||||
{
|
||||
this.menuManager.activeMenu.receiveRightClick(x, y, playSound);
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseLeftClick(int x, int y)
|
||||
|
@ -215,6 +256,19 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
private void receiveGamepadInput(GamePadState state,SSCEnums.PlayerID ID)
|
||||
{
|
||||
if (state == null) return;
|
||||
else
|
||||
{
|
||||
if (this.players.ContainsKey(ID))
|
||||
{
|
||||
this.players[ID].receiveGamepadInput(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called every update frame.
|
||||
/// </summary>
|
||||
|
@ -222,12 +276,18 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
/// <returns></returns>
|
||||
public bool tick(GameTime time)
|
||||
{
|
||||
KeyboardState state = Keyboard.GetState();
|
||||
KeyboardState kState = Keyboard.GetState();
|
||||
|
||||
foreach (Keys k in state.GetPressedKeys())
|
||||
foreach (Keys k in kState.GetPressedKeys())
|
||||
{
|
||||
this.receiveKeyPress(k);
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
GamePadState state = this.getGamepadState((PlayerIndex)i);
|
||||
this.receiveGamepadInput(state,(SSCEnums.PlayerID)i);
|
||||
}
|
||||
|
||||
|
||||
if (this.quitGame)
|
||||
{
|
||||
|
@ -237,14 +297,19 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame
|
|||
{
|
||||
this.currentMap.update(time);
|
||||
}
|
||||
if (this.player != null)
|
||||
foreach(SSCPlayer player in this.players.Values)
|
||||
{
|
||||
this.player.update(time);
|
||||
this.camera.centerOnPosition(this.player.position);
|
||||
if(player.playerID== SSCEnums.PlayerID.One) this.camera.centerOnPosition(player.position);
|
||||
player.update(time);
|
||||
}
|
||||
if (this.activeMenu != null)
|
||||
|
||||
if (this.menuManager.activeMenu != null)
|
||||
{
|
||||
this.activeMenu.update(time);
|
||||
this.menuManager.activeMenu.update(time);
|
||||
if (this.menuManager.activeMenu.readyToClose())
|
||||
{
|
||||
this.menuManager.closeActiveMenu();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SeasideScrambleMap.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCCamera.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCEnums.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCMenus\SSCMenuManager.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCMenus\TitleScreen.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCPlayer.cs" />
|
||||
<Compile Include="Framework\Minigame\SeasideScrambleMinigame\SSCTextureUtilities.cs" />
|
||||
|
|
|
@ -512,5 +512,11 @@ namespace StardustCore.UIUtilities
|
|||
{
|
||||
return new Vector2(this.xPositionOnScreen + relx, this.yPositionOnScreen + rely);
|
||||
}
|
||||
|
||||
public virtual void exitMenu(bool playSound=true)
|
||||
{
|
||||
//Do extra stuff here.
|
||||
this.exitThisMenu(playSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue