/// <summary> /// Creates a new StatisticsScreen object for the given player. /// </summary> public StatisticsScreen(Player player) : base() { this.IsPopup = true; this.player = player; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation(new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); }
/// <summary> /// Handle user input. /// </summary> public override void HandleInput() { bool equClicked = false; bool backClicked = false; bool spellClicked = false; if (InputManager.IsButtonClicked(new Rectangle( (int)(backButtonPosition.X), (int)(backButtonPosition.Y), (int)(backButton.Width * ScaledVector2.DrawFactor ), (int)(backButton.Height * ScaledVector2.DrawFactor)))) { backClicked = true; } if (InputManager.IsButtonClicked(equipmentRecangle)) { equClicked = true; } if (InputManager.IsButtonClicked(spellRecangle)) { spellClicked = true; } // exit the screen if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked) { ExitScreen(); return; } // shows the spells for this player else if (spellClicked) //InputManager.IsActionTriggered(InputManager.Action.Ok)) { ScreenManager.AddScreen(new SpellbookScreen(player, player.CharacterStatistics)); return; } // show the equipment for this player, allowing the user to unequip else if (InputManager.IsActionTriggered(InputManager.Action.TakeView) || equClicked) { ScreenManager.AddScreen(new EquipmentScreen(player)); return; } else if (Session.Party.Players.Contains(player)) // player is in the party { // move to the previous screen if (InputManager.IsActionTriggered(InputManager.Action.PageLeft)) { ExitScreen(); ScreenManager.AddScreen(new QuestLogScreen(null)); return; } // move to the next screen else if (InputManager.IsActionTriggered(InputManager.Action.PageRight)) { ExitScreen(); ScreenManager.AddScreen(new InventoryScreen(true)); return; } // move to the previous party member else if (InputManager.IsActionTriggered(InputManager.Action.TargetUp)) { playerIndex--; if (playerIndex < 0) { playerIndex = Session.Party.Players.Count - 1; } Player newPlayer = Session.Party.Players[playerIndex]; if (newPlayer != player) { player = newPlayer; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation( new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); } } // move to the next party member else if (InputManager.IsActionTriggered(InputManager.Action.TargetDown)) { playerIndex++; if (playerIndex >= Session.Party.Players.Count) { playerIndex = 0; } Player newPlayer = Session.Party.Players[playerIndex]; if (newPlayer != player) { player = newPlayer; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation( new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); } } } }
/// <summary> /// Handle user input. /// </summary> public override void HandleInput() { // exit the screen if (InputManager.IsActionTriggered(InputManager.Action.Back)) { ExitScreen(); return; } // shows the spells for this player else if (InputManager.IsActionTriggered(InputManager.Action.Ok)) { ScreenManager.AddScreen(new SpellbookScreen(player, player.CharacterStatistics)); return; } // show the equipment for this player, allowing the user to unequip else if (InputManager.IsActionTriggered(InputManager.Action.TakeView)) { ScreenManager.AddScreen(new EquipmentScreen(player)); return; } else if (Session.Party.Players.Contains(player)) // player is in the party { // move to the previous screen if (InputManager.IsActionTriggered(InputManager.Action.PageLeft)) { ExitScreen(); ScreenManager.AddScreen(new QuestLogScreen(null)); return; } // move to the next screen else if (InputManager.IsActionTriggered(InputManager.Action.PageRight)) { ExitScreen(); ScreenManager.AddScreen(new InventoryScreen(true)); return; } // move to the previous party member else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp)) { playerIndex--; if (playerIndex < 0) { playerIndex = Session.Party.Players.Count - 1; } Player newPlayer = Session.Party.Players[playerIndex]; if (newPlayer != player) { player = newPlayer; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation( new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); } } // move to the next party member else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown)) { playerIndex++; if (playerIndex >= Session.Party.Players.Count) { playerIndex = 0; } Player newPlayer = Session.Party.Players[playerIndex]; if (newPlayer != player) { player = newPlayer; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation( new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); } } } }
/// <summary> /// Handle user input. /// </summary> public override void HandleInput() { bool equClicked = false; bool backClicked = false; bool spellClicked = false; if (InputManager.IsButtonClicked(new Rectangle( (int)(backButtonPosition.X), (int)(backButtonPosition.Y), (int)(backButton.Width * ScaledVector2.DrawFactor), (int)(backButton.Height * ScaledVector2.DrawFactor)))) { backClicked = true; } if (InputManager.IsButtonClicked(equipmentRecangle)) { equClicked = true; } if (InputManager.IsButtonClicked(spellRecangle)) { spellClicked = true; } // exit the screen if (InputManager.IsActionTriggered(InputManager.Action.Back) || backClicked) { ExitScreen(); return; } // shows the spells for this player else if (spellClicked) //InputManager.IsActionTriggered(InputManager.Action.Ok)) { ScreenManager.AddScreen(new SpellbookScreen(player, player.CharacterStatistics)); return; } // show the equipment for this player, allowing the user to unequip else if (InputManager.IsActionTriggered(InputManager.Action.TakeView) || equClicked) { ScreenManager.AddScreen(new EquipmentScreen(player)); return; } else if (Session.Party.Players.Contains(player)) // player is in the party { // move to the previous screen if (InputManager.IsActionTriggered(InputManager.Action.PageLeft)) { ExitScreen(); ScreenManager.AddScreen(new QuestLogScreen(null)); return; } // move to the next screen else if (InputManager.IsActionTriggered(InputManager.Action.PageRight)) { ExitScreen(); ScreenManager.AddScreen(new InventoryScreen(true)); return; } // move to the previous party member else if (InputManager.IsActionTriggered(InputManager.Action.TargetUp)) { playerIndex--; if (playerIndex < 0) { playerIndex = Session.Party.Players.Count - 1; } Player newPlayer = Session.Party.Players[playerIndex]; if (newPlayer != player) { player = newPlayer; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation( new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); } } // move to the next party member else if (InputManager.IsActionTriggered(InputManager.Action.TargetDown)) { playerIndex++; if (playerIndex >= Session.Party.Players.Count) { playerIndex = 0; } Player newPlayer = Session.Party.Players[playerIndex]; if (newPlayer != player) { player = newPlayer; screenAnimation = new AnimatingSprite(); screenAnimation.FrameDimensions = player.MapSprite.FrameDimensions; screenAnimation.FramesPerRow = player.MapSprite.FramesPerRow; screenAnimation.SourceOffset = player.MapSprite.SourceOffset; screenAnimation.Texture = player.MapSprite.Texture; screenAnimation.AddAnimation( new Animation("Idle", 43, 48, 150, true)); screenAnimation.PlayAnimation(0); } } } }