Browse Source

RPG Refactor to add Mouse support.

Dominique Louis 1 tháng trước cách đây
mục cha
commit
b4c9581820
27 tập tin đã thay đổi với 571 bổ sung376 xóa
  1. 6 6
      RolePlayingGame/Core/Combat/CombatEngine.cs
  2. 7 7
      RolePlayingGame/Core/GameScreens/ChestScreen.cs
  3. 4 4
      RolePlayingGame/Core/GameScreens/DialogueScreen.cs
  4. 2 2
      RolePlayingGame/Core/GameScreens/GameOverScreen.cs
  5. 3 3
      RolePlayingGame/Core/GameScreens/GameplayScreen.cs
  6. 3 3
      RolePlayingGame/Core/GameScreens/Hud.cs
  7. 4 4
      RolePlayingGame/Core/GameScreens/InnScreen.cs
  8. 4 4
      RolePlayingGame/Core/GameScreens/LevelUpScreen.cs
  9. 10 10
      RolePlayingGame/Core/GameScreens/ListScreen.cs
  10. 5 5
      RolePlayingGame/Core/GameScreens/PlayerNpcScreen.cs
  11. 4 4
      RolePlayingGame/Core/GameScreens/PlayerSelectionScreen.cs
  12. 4 4
      RolePlayingGame/Core/GameScreens/QuestDetailsScreen.cs
  13. 4 4
      RolePlayingGame/Core/GameScreens/RewardsScreen.cs
  14. 7 7
      RolePlayingGame/Core/GameScreens/StatisticsScreen.cs
  15. 4 4
      RolePlayingGame/Core/GameScreens/StoreScreen.cs
  16. 37 0
      RolePlayingGame/Core/Input/ActionMap.cs
  17. 35 0
      RolePlayingGame/Core/Input/GamePadButtons.cs
  18. 41 0
      RolePlayingGame/Core/Input/InputAction.cs
  19. 339 279
      RolePlayingGame/Core/Input/InputManager.cs
  20. 19 0
      RolePlayingGame/Core/Input/MouseButtons.cs
  21. 3 3
      RolePlayingGame/Core/MenuScreens/BackstoryScreen.cs
  22. 6 6
      RolePlayingGame/Core/MenuScreens/ControlsScreen.cs
  23. 1 1
      RolePlayingGame/Core/MenuScreens/MainMenuScreen.cs
  24. 2 2
      RolePlayingGame/Core/MenuScreens/MessageBoxScreen.cs
  25. 5 5
      RolePlayingGame/Core/MenuScreens/SaveLoadScreen.cs
  26. 5 5
      RolePlayingGame/Core/ScreenManager/MenuScreen.cs
  27. 7 4
      RolePlayingGame/Core/TileEngine/TileEngine.cs

+ 6 - 6
RolePlayingGame/Core/Combat/CombatEngine.cs

@@ -1750,7 +1750,7 @@ namespace RolePlaying
                 }
 
                 // back out of the action
-                if (InputManager.IsActionTriggered(InputManager.Action.Back))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
                 {
                     highlightedCombatant.CombatAction = null;
                     SetTargets(null, 0);
@@ -1758,14 +1758,14 @@ namespace RolePlaying
                 }
 
                 // start the action
-                if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
                 {
                     highlightedCombatant.CombatAction.Start();
                     return;
                 }
 
                 // go to the next target
-                if (InputManager.IsActionTriggered(InputManager.Action.TargetUp))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.TargetUp))
                 {
                     // cycle through monsters or party members
                     if (highlightedCombatant.CombatAction.IsOffensive)
@@ -1805,7 +1805,7 @@ namespace RolePlaying
                     return;
                 }
                 // go to the previous target
-                else if (InputManager.IsActionTriggered(InputManager.Action.TargetDown))
+                else if (InputManager.IsActionTriggered(InputManager.InputAction.TargetDown))
                 {
                     // cycle through monsters or party members
                     if (highlightedCombatant.CombatAction.IsOffensive)
@@ -1857,7 +1857,7 @@ namespace RolePlaying
             {
                 // move to the previous living character
                 if (InputManager.IsActionTriggered(
-                    InputManager.Action.ActiveCharacterLeft))
+                    InputManager.InputAction.ActiveCharacterLeft))
                 {
                     int newHighlightedPlayer = highlightedPlayer;
                     do
@@ -1879,7 +1879,7 @@ namespace RolePlaying
                 }
                 // move to the next living character
                 else if (InputManager.IsActionTriggered(
-                    InputManager.Action.ActiveCharacterRight))
+                    InputManager.InputAction.ActiveCharacterRight))
                 {
                     int newHighlightedPlayer = highlightedPlayer;
                     do

+ 7 - 7
RolePlayingGame/Core/GameScreens/ChestScreen.cs

@@ -284,29 +284,29 @@ namespace RolePlaying
                 return;
             }
 
-            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 MoveCursorUp();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 MoveCursorDown();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.IncreaseAmount))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.IncreaseAmount))
             {
                 MoveCursorRight();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.DecreaseAmount))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.DecreaseAmount))
             {
                 MoveCursorLeft();
             }
             // Close is pressed
-            else if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 BackTriggered();
             }
             // Take is pressed
-            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 if (IsGoldSelected)
                 {
@@ -319,7 +319,7 @@ namespace RolePlaying
                 }
             }
             // Take All is pressed
-            else if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.TakeView))
             {
                 ButtonYPressed(null); // take-all doesn't need an entry
             }

+ 4 - 4
RolePlayingGame/Core/GameScreens/DialogueScreen.cs

@@ -232,15 +232,15 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // Press Select or Bback
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
-                InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok) ||
+                InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
 
             // Scroll up
-            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (startIndex > 0)
                 {
@@ -249,7 +249,7 @@ namespace RolePlaying
                 }
             }
             // Scroll down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 if (startIndex < dialogueList.Count - drawMaxLines)
                 {

+ 2 - 2
RolePlayingGame/Core/GameScreens/GameOverScreen.cs

@@ -95,8 +95,8 @@ namespace RolePlaying
         /// </summary>
         public override void HandleInput()
         {
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
-                InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok) ||
+                InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 ScreenManager.AddScreen(new MainMenuScreen());

+ 3 - 3
RolePlayingGame/Core/GameScreens/GameplayScreen.cs

@@ -122,13 +122,13 @@ namespace RolePlaying
         /// </summary>
         public override void HandleInput()
         {
-            if (InputManager.IsActionTriggered(InputManager.Action.MainMenu))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.MainMenu))
             {
                 ScreenManager.AddScreen(new MainMenuScreen());
                 return;
             }
 
-            if (InputManager.IsActionTriggered(InputManager.Action.ExitGame))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.ExitGame))
             {
                 // add a confirmation message box
                 const string message = 
@@ -140,7 +140,7 @@ namespace RolePlaying
             }
 
             if (!CombatEngine.IsActive &&
-                InputManager.IsActionTriggered(InputManager.Action.CharacterManagement))
+                InputManager.IsActionTriggered(InputManager.InputAction.CharacterManagement))
             {
                 ScreenManager.AddScreen(new StatisticsScreen(Session.Party.Players[0]));
                 return;

+ 3 - 3
RolePlayingGame/Core/GameScreens/Hud.cs

@@ -529,7 +529,7 @@ namespace RolePlaying
         public void UpdateActionsMenu()
         {
             // cursor up
-            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (highlightedAction > 0)
                 {
@@ -538,7 +538,7 @@ namespace RolePlaying
                 return;
             }
             // cursor down
-            if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 if (highlightedAction < actionList.Length - 1)
                 {
@@ -547,7 +547,7 @@ namespace RolePlaying
                 return;
             }
             // select an action
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 switch (actionList[highlightedAction])
                 {

+ 4 - 4
RolePlayingGame/Core/GameScreens/InnScreen.cs

@@ -179,13 +179,13 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
             // move the cursor up
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (selectionMark == 2)
                 {
@@ -193,7 +193,7 @@ namespace RolePlaying
                 }
             }
             // move the cursor down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 if (selectionMark == 1)
                 {
@@ -201,7 +201,7 @@ namespace RolePlaying
                 }
             }
             // select an option
-            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 if (selectionMark == 1)
                 {

+ 4 - 4
RolePlayingGame/Core/GameScreens/LevelUpScreen.cs

@@ -195,12 +195,12 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit without bothering to see the rest
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
             }
             // advance to the next player to have leveled up
-            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 if (leveledUpPlayers.Count <= 0)
                 {
@@ -222,7 +222,7 @@ namespace RolePlaying
                 }
             }
             // Scroll up
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (startIndex > 0)
                 {
@@ -231,7 +231,7 @@ namespace RolePlaying
                 }
             }
             // Scroll down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 if (startIndex < spellList.Count - maxLines)
                 {

+ 10 - 10
RolePlayingGame/Core/GameScreens/ListScreen.cs

@@ -287,35 +287,35 @@ namespace RolePlaying
         /// </summary>
         public override void HandleInput()
         {
-            if (InputManager.IsActionTriggered(InputManager.Action.PageLeft))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.PageLeft))
             {
                 PageScreenLeft();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.PageRight))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.PageRight))
             {
                 PageScreenRight();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 MoveCursorUp();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 MoveCursorDown();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.IncreaseAmount))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.IncreaseAmount))
             {
                 MoveCursorRight();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.DecreaseAmount))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.DecreaseAmount))
             {
                 MoveCursorLeft();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 BackTriggered();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 ReadOnlyCollection<T> dataList = GetDataList();
                 if ((selectedIndex >= 0) && (selectedIndex < dataList.Count))
@@ -323,7 +323,7 @@ namespace RolePlaying
                     SelectTriggered(dataList[selectedIndex]);
                 }
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.DropUnEquip))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.DropUnEquip))
             {
                 ReadOnlyCollection<T> dataList = GetDataList();
                 if ((selectedIndex >= 0) && (selectedIndex < dataList.Count))
@@ -331,7 +331,7 @@ namespace RolePlaying
                     ButtonXPressed(dataList[selectedIndex]);
                 }
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.TakeView))
             {
                 ReadOnlyCollection<T> dataList = GetDataList();
                 if ((selectedIndex >= 0) && (selectedIndex < dataList.Count))

+ 5 - 5
RolePlayingGame/Core/GameScreens/PlayerNpcScreen.cs

@@ -50,7 +50,7 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // view the player's statistics
-            if (InputManager.IsActionTriggered(InputManager.Action.TakeView))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.TakeView))
             {
                 ScreenManager.AddScreen(new StatisticsScreen(character as Player));
                 return;
@@ -59,7 +59,7 @@ namespace RolePlaying
             if (isIntroduction)
             {
                 // accept the invitation
-                if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
                 {
                     isIntroduction = false;
                     Player player = character as Player;
@@ -70,7 +70,7 @@ namespace RolePlaying
                     this.SelectText = "Back";
                 }
                 // reject the invitation
-                if (InputManager.IsActionTriggered(InputManager.Action.Back))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
                 {
                     isIntroduction = false;
                     Player player = character as Player;
@@ -82,8 +82,8 @@ namespace RolePlaying
             else
             {
                 // exit the screen
-                if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
-                    InputManager.IsActionTriggered(InputManager.Action.Back))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.Ok) ||
+                    InputManager.IsActionTriggered(InputManager.InputAction.Back))
                 {
                     ExitScreen();
                     return;

+ 4 - 4
RolePlayingGame/Core/GameScreens/PlayerSelectionScreen.cs

@@ -184,14 +184,14 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
             // use the item or close the screen
             else if (isUseAllowed &&
-                InputManager.IsActionTriggered(InputManager.Action.Ok))
+                InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 if (isGearUsed)
                 {
@@ -241,7 +241,7 @@ namespace RolePlaying
             }
             // cursor up
             else if (!isGearUsed &&
-                InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+                InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (selectionMark > 0)
                 {
@@ -266,7 +266,7 @@ namespace RolePlaying
             }
             // cursor down
             else if (!isGearUsed &&
-                InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+                InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 isGearUsed = false;
                 if (selectionMark < Session.Party.Players.Count - 1)

+ 4 - 4
RolePlayingGame/Core/GameScreens/QuestDetailsScreen.cs

@@ -288,14 +288,14 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back) ||
-                InputManager.IsActionTriggered(InputManager.Action.Ok))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back) ||
+                InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 ExitScreen();
                 return;
             }
             // scroll up
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (startIndex > 0)
                 {
@@ -304,7 +304,7 @@ namespace RolePlaying
                 }
             }
             // scroll Down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 if (endIndex < currentDialogue.Count)
                 {

+ 4 - 4
RolePlayingGame/Core/GameScreens/RewardsScreen.cs

@@ -204,8 +204,8 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok) ||
-                InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok) ||
+                InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 // give the rewards to the party
@@ -217,7 +217,7 @@ namespace RolePlaying
                 Session.Party.GiveExperience(experienceReward);
             }
             // Scroll up
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 if (startIndex > 0)
                 {
@@ -226,7 +226,7 @@ namespace RolePlaying
                 }
             }
             // Scroll down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 if (startIndex < gearReward.Count - maxLines)
                 {

+ 7 - 7
RolePlayingGame/Core/GameScreens/StatisticsScreen.cs

@@ -136,19 +136,19 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
             // shows the spells for this player
-            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.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))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.TakeView))
             {
                 ScreenManager.AddScreen(new EquipmentScreen(player));
                 return;
@@ -156,21 +156,21 @@ namespace RolePlaying
             else if (Session.Party.Players.Contains(player)) // player is in the party
             {
                 // move to the previous screen
-                if (InputManager.IsActionTriggered(InputManager.Action.PageLeft))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.PageLeft))
                 {
                     ExitScreen();
                     ScreenManager.AddScreen(new QuestLogScreen(null));
                     return;
                 }
                 // move to the next screen
-                else if (InputManager.IsActionTriggered(InputManager.Action.PageRight))
+                else if (InputManager.IsActionTriggered(InputManager.InputAction.PageRight))
                 {
                     ExitScreen();
                     ScreenManager.AddScreen(new InventoryScreen(true));
                     return;
                 }
                 // move to the previous party member
-                else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+                else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
                 {
                     playerIndex--;
                     if (playerIndex < 0)
@@ -191,7 +191,7 @@ namespace RolePlaying
                     }
                 }
                 // move to the next party member
-                else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+                else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
                 {
                     playerIndex++;
                     if (playerIndex >= Session.Party.Players.Count)

+ 4 - 4
RolePlayingGame/Core/GameScreens/StoreScreen.cs

@@ -117,13 +117,13 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exits the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
             // select one of the buttons
-            else if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 if (currentCursor == 0)
                 {
@@ -141,7 +141,7 @@ namespace RolePlaying
             }
             // move the cursor up
             else if (InputManager.IsActionTriggered(
-                InputManager.Action.MoveCharacterUp))
+                InputManager.InputAction.MoveCharacterUp))
             {
                 currentCursor--;
                 if (currentCursor < 0)
@@ -151,7 +151,7 @@ namespace RolePlaying
             }
             // move the cursor down
             else if (InputManager.IsActionTriggered(
-                InputManager.Action.MoveCharacterDown))
+                InputManager.InputAction.MoveCharacterDown))
             {
                 currentCursor++;
                 if (currentCursor > 2)

+ 37 - 0
RolePlayingGame/Core/Input/ActionMap.cs

@@ -0,0 +1,37 @@
+//-----------------------------------------------------------------------------
+// ActionMap.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+using System.Collections.Generic;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Input.Touch;
+
+namespace RolePlaying
+{
+    public static partial class InputManager
+    {
+        /// <summary>
+        /// A combination of gamepad and keyboard keys mapped to a particular action.
+        /// </summary>
+        public class ActionMap
+        {
+            /// <summary>
+            /// List of GamePad controls to be mapped to a given action.
+            /// </summary>
+            public List<GamePadButtons> gamePadButtons = new List<GamePadButtons>();
+
+
+            /// <summary>
+            /// List of Keyboard controls to be mapped to a given action.
+            /// </summary>
+            public List<Keys> keyboardKeys = new List<Keys>();
+
+            public List<MouseButtons> mouseButtons = new List<MouseButtons>();
+
+            public List<GestureType> touchGestures = new List<GestureType>();
+        }
+    }
+}

+ 35 - 0
RolePlayingGame/Core/Input/GamePadButtons.cs

@@ -0,0 +1,35 @@
+//-----------------------------------------------------------------------------
+// GamePadButtons.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+namespace RolePlaying
+{
+public static partial class InputManager
+    {
+        /// <summary>
+        /// GamePad controls expressed as one type, unified with button semantics.
+        /// </summary>
+        public enum GamePadButtons
+        {
+            Start,
+            Back,
+            A,
+            B,
+            X,
+            Y,
+            Up,
+            Down,
+            Left,
+            Right,
+            LeftShoulder,
+            RightShoulder,
+            LeftTrigger,
+            RightTrigger,
+        }
+
+
+    }
+}

+ 41 - 0
RolePlayingGame/Core/Input/InputAction.cs

@@ -0,0 +1,41 @@
+//-----------------------------------------------------------------------------
+// InputAction.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+namespace RolePlaying
+{
+    public static partial class InputManager
+    {
+        /// <summary>
+        /// The actions that are possible within the game.
+        /// </summary>
+        public enum InputAction
+        {
+            MainMenu,
+            Ok,
+            Back,
+            CharacterManagement,
+            ExitGame,
+            TakeView,
+            DropUnEquip,
+            MoveCharacterUp,
+            MoveCharacterDown,
+            MoveCharacterLeft,
+            MoveCharacterRight,
+            CursorUp,
+            CursorDown,
+            DecreaseAmount,
+            IncreaseAmount,
+            PageLeft,
+            PageRight,
+            TargetUp,
+            TargetDown,
+            ActiveCharacterLeft,
+            ActiveCharacterRight,
+            TotalActionCount,
+        }
+    }
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 339 - 279
RolePlayingGame/Core/Input/InputManager.cs


+ 19 - 0
RolePlayingGame/Core/Input/MouseButtons.cs

@@ -0,0 +1,19 @@
+//-----------------------------------------------------------------------------
+// MouseButtons.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+namespace RolePlaying
+{
+public static partial class InputManager
+    {
+        public enum MouseButtons
+        {
+            LeftButton,
+            RightButton,
+            MiddleButton
+        }
+    }
+}

+ 3 - 3
RolePlayingGame/Core/MenuScreens/BackstoryScreen.cs

@@ -100,13 +100,13 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exits the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
             // scroll down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 // Traverse down the help text
                 if (startIndex + maxLineDisplay < textLines.Count)
@@ -115,7 +115,7 @@ namespace RolePlaying
                 }
             }
             // scroll up
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 // Traverse up the help text
                 if (startIndex > 0)

+ 6 - 6
RolePlayingGame/Core/MenuScreens/ControlsScreen.cs

@@ -226,21 +226,21 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // exit the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
             }
 #if !XBOX
             // toggle between keyboard and gamepad controls
-            else if (InputManager.IsActionTriggered(InputManager.Action.PageLeft) ||
-                InputManager.IsActionTriggered(InputManager.Action.PageRight))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.PageLeft) ||
+                InputManager.IsActionTriggered(InputManager.InputAction.PageRight))
             {
                 isShowControlPad = !isShowControlPad;
             }
             // scroll through the keyboard controls
             if (isShowControlPad == false)
             {
-                if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
                 {
                     if (startIndex < keyboardInfo.totalActionList.Length -
                         maxActionDisplay)
@@ -249,7 +249,7 @@ namespace RolePlaying
                         keyboardInfo.selectedIndex++;
                     }
                 }
-                if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+                if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
                 {
                     if (startIndex > 0)
                     {
@@ -345,7 +345,7 @@ namespace RolePlaying
                 for (int j = 0, i = startIndex; i < startIndex + maxActionDisplay;
                     i++, j++)
                 {
-                    keyboardString = InputManager.GetActionName((InputManager.Action)i);
+                    keyboardString = InputManager.GetActionName((InputManager.InputAction)i);
                     textPosition.X = chartLine1Position +
                         ((chartLine2Position - chartLine1Position) -
                         Fonts.DescriptionFont.MeasureString(keyboardString).X) / 2;

+ 1 - 1
RolePlayingGame/Core/MenuScreens/MainMenuScreen.cs

@@ -180,7 +180,7 @@ namespace RolePlaying
         /// </summary>
         public override void HandleInput()
         {
-            if (InputManager.IsActionTriggered(InputManager.Action.Back) &&
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back) &&
                 Session.IsActive)
             {
                 AudioManager.PopMusic();

+ 2 - 2
RolePlayingGame/Core/MenuScreens/MessageBoxScreen.cs

@@ -112,7 +112,7 @@ namespace RolePlaying
         /// </summary>
         public override void HandleInput()
         {
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 // Raise the accepted event, then exit the message box.
                 if (Accepted != null)
@@ -120,7 +120,7 @@ namespace RolePlaying
 
                 ExitScreen();
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 // Raise the cancelled event, then exit the message box.
                 if (Cancelled != null)

+ 5 - 5
RolePlayingGame/Core/MenuScreens/SaveLoadScreen.cs

@@ -146,14 +146,14 @@ namespace RolePlaying
         public override void HandleInput()
         {
             // handle exiting the screen
-            if (InputManager.IsActionTriggered(InputManager.Action.Back))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Back))
             {
                 ExitScreen();
                 return;
             }
             
             // handle selecting a save game
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok) &&
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok) &&
                 (Session.SaveGameDescriptions != null))
             {
                 switch (mode)
@@ -200,7 +200,7 @@ namespace RolePlaying
 
             }
             // handle deletion
-            else if (InputManager.IsActionTriggered(InputManager.Action.DropUnEquip) &&
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.DropUnEquip) &&
                 (Session.SaveGameDescriptions != null))
             {
                 if ((currentSlot >= 0) &&
@@ -214,7 +214,7 @@ namespace RolePlaying
                 }
             }
             // handle cursor-down
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorDown) &&
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown) &&
                 (Session.SaveGameDescriptions != null))
             {
                 int maximumSlot = Session.SaveGameDescriptions.Count;
@@ -229,7 +229,7 @@ namespace RolePlaying
                 }
             }
             // handle cursor-up
-            else if (InputManager.IsActionTriggered(InputManager.Action.CursorUp) &&
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp) &&
                 (Session.SaveGameDescriptions != null))
             {
                 if (currentSlot >= 1)

+ 5 - 5
RolePlayingGame/Core/ScreenManager/MenuScreen.cs

@@ -80,7 +80,7 @@ namespace RolePlaying
             int oldSelectedEntry = selectedEntry;
 
             // Move to the previous menu entry?
-            if (InputManager.IsActionTriggered(InputManager.Action.CursorUp))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.CursorUp))
             {
                 selectedEntry--;
                 if (selectedEntry < 0)
@@ -88,7 +88,7 @@ namespace RolePlaying
             }
 
             // Move to the next menu entry?
-            if (InputManager.IsActionTriggered(InputManager.Action.CursorDown))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.CursorDown))
             {
                 selectedEntry++;
                 if (selectedEntry >= menuEntries.Count)
@@ -96,13 +96,13 @@ namespace RolePlaying
             }
 
             // Accept or cancel the menu?
-            if (InputManager.IsActionTriggered(InputManager.Action.Ok))
+            if (InputManager.IsActionTriggered(InputManager.InputAction.Ok))
             {
                 AudioManager.PlayCue("Continue");
                 OnSelectEntry(selectedEntry);
             }
-            else if (InputManager.IsActionTriggered(InputManager.Action.Back) ||
-                InputManager.IsActionTriggered(InputManager.Action.ExitGame))
+            else if (InputManager.IsActionTriggered(InputManager.InputAction.Back) ||
+                InputManager.IsActionTriggered(InputManager.InputAction.ExitGame))
             {
                 OnCancel();
             }

+ 7 - 4
RolePlayingGame/Core/TileEngine/TileEngine.cs

@@ -198,31 +198,34 @@ namespace RolePlaying
         /// <returns>The controlled movement for this update.</returns>
         private static Vector2 UpdateUserMovement(GameTime gameTime)
         {
+            // Process mouse input for actions
+            InputManager.HandleMouseDown(PartyLeaderPosition.ScreenPosition.ToPoint());
+
             Vector2 desiredMovement = Vector2.Zero;
 
             // accumulate the desired direction from user input
-            if (InputManager.IsActionPressed(InputManager.Action.MoveCharacterUp))
+            if (InputManager.IsActionPressed(InputManager.InputAction.MoveCharacterUp))
             {
                 if (CanPartyLeaderMoveUp())
                 {
                     desiredMovement.Y -= partyLeaderMovementSpeed;
                 }
             }
-            if (InputManager.IsActionPressed(InputManager.Action.MoveCharacterDown))
+            if (InputManager.IsActionPressed(InputManager.InputAction.MoveCharacterDown))
             {
                 if (CanPartyLeaderMoveDown())
                 {
                     desiredMovement.Y += partyLeaderMovementSpeed;
                 }
             }
-            if (InputManager.IsActionPressed(InputManager.Action.MoveCharacterLeft))
+            if (InputManager.IsActionPressed(InputManager.InputAction.MoveCharacterLeft))
             {
                 if (CanPartyLeaderMoveLeft())
                 {
                     desiredMovement.X -= partyLeaderMovementSpeed;
                 }
             }
-            if (InputManager.IsActionPressed(InputManager.Action.MoveCharacterRight))
+            if (InputManager.IsActionPressed(InputManager.InputAction.MoveCharacterRight))
             {
                 if (CanPartyLeaderMoveRight())
                 {

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác