diff --git a/README.md b/README.md
index 11ec7fdc..ef8a3af8 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,34 @@
# Sol Standard
-Sol Standard is a tactical strategy game that pits two players against each other in the pursuit of victory! There are several classes of units available, as well as computer-controlled monsters. Plenty of items and interactable tiles allow for vastly different gameplay experiences on different battle maps.
+
+Check out the project website for media, Discord and credits! https://talberon.github.io/solstandard/
+
+Sol Standard is a competitive tactics game that focuses on allowing players to outmaneuver and outsmart their opponents! There are various units with unique abilities that you can command to achieve victory, each with their own playstyle and synergies with other units. There are lots of multiplayer maps to play with your friends, or you can check out one of the solo maps for some practice.
+
+Each map has various items, AI-controlled monsters and interactable objects that you can leverage to gain the advantage over your foes. Draft your army and form a composition that fits your own playstyle, whether it's super fast and deadly, or strong and stable, and anywhere inbetween.
+
+Keyboard and Gamepads are both supported and the interface will dynamically update based on whichever one you are using. Xbox controllers work best, and you can use a different controller for each player. The keyboard can control both players as well if you want to trade off or play against yourself. Netplay is also available; be sure to port forward if hosting a match over the internet.
## Project Info
-Sol Standard started as a continuation of [@Talberon](https://github.com/Talberon)'s Ars Tactica project before dropping the project entirely to rebuild it in a cleaner project structure. The project is written in C# using the Monogame framework; an open-source continuation of Microsoft's XNA Framework. The project currently runs on .NET Framework 4.7.1, but may be updated to .NET Core in the future.
+Sol Standard started as a rewrite of [@Talberon](https://github.com/Talberon)'s Ars Tactica project before dropping the original project to rebuild it in a cleaner structure and with newer tools. This project is written in C# using Monogame; an open-source continuation of Microsoft's XNA Framework. The project currently runs on .NET Framework 4.7.1, but may be updated to .NET Core in the future.
## Gallery
-### Gameplay Samples
+### Combat
+
+
+
+### Unit Drafting
+
+
+
+### AI Units
-#### Combat
-
+
-#### Unit Action
-
+### Interactive Tiles
-#### Turn Resolution
-
+
## A Note About Art Assets
-Art assets are amalgamated from a variety of self-made, public domain and paid resources, so none of the art/sound assets are included in this repository for redistribution. Check out `CREDITS.md` for info on licensing and credit for asset work.
\ No newline at end of file
+Art assets are amalgamated from a variety of self-made, public domain and paid resources, so none of the art/sound assets are included in this repository for redistribution. **Check out `CREDITS.md` for info on licensing and credit for asset work.**
\ No newline at end of file
diff --git a/SolStandard/Containers/Contexts/BattleContext.cs b/SolStandard/Containers/Contexts/BattleContext.cs
index f363263c..d7b02530 100644
--- a/SolStandard/Containers/Contexts/BattleContext.cs
+++ b/SolStandard/Containers/Contexts/BattleContext.cs
@@ -6,7 +6,9 @@
using Microsoft.Xna.Framework.Graphics;
using SolStandard.Containers.Contexts.Combat;
using SolStandard.Containers.View;
+using SolStandard.Entity;
using SolStandard.Entity.General;
+using SolStandard.Entity.General.Item;
using SolStandard.Entity.Unit;
using SolStandard.Entity.Unit.Actions;
using SolStandard.Entity.Unit.Statuses;
@@ -32,6 +34,8 @@ public enum BattleState
ResolveCombat
}
+ private const int BountyPerTriumph = 10;
+
private readonly BattleView battleView;
private CombatDamage attackerDamage;
@@ -47,6 +51,8 @@ public enum BattleState
private GameUnit attacker;
private GameUnit defender;
+ private Vector2 attackerCoordinates;
+ private Vector2 defenderCoordinates;
private UnitStatistics attackerStats;
private UnitStatistics defenderStats;
@@ -94,10 +100,8 @@ public void StartNewCombat(GameUnit newAttacker, GameUnit newDefender, UnitStati
defender.SetUnitAnimation(UnitAnimationState.Active);
//Treat the unit as off-screen if null
- Vector2 attackerCoordinates =
- attacker.UnitEntity?.MapCoordinates ?? new Vector2(-1);
- Vector2 defenderCoordinates =
- defender.UnitEntity?.MapCoordinates ?? new Vector2(-1);
+ attackerCoordinates = attacker.UnitEntity?.MapCoordinates ?? new Vector2(-1);
+ defenderCoordinates = defender.UnitEntity?.MapCoordinates ?? new Vector2(-1);
attackerInRange = true;
defenderInRange =
@@ -177,6 +181,15 @@ public void ContinueCombat()
GlobalEventQueue.QueueSingleEvent(new EndTurnEvent());
}
+ if (!attacker.IsAlive)
+ {
+ TakeAttackerSpoilsAndIncreaseBounty();
+ }
+ else if (!defender.IsAlive)
+ {
+ TakeDefenderSpoilsAndIncreaseBounty();
+ }
+
GameContext.MapCamera.RevertToPreviousZoomLevel();
}
@@ -186,15 +199,67 @@ public void ContinueCombat()
}
}
+ private void TakeDefenderSpoilsAndIncreaseBounty()
+ {
+ MapSlice defenderSlice = MapContainer.GetMapSliceAtCoordinates(defenderCoordinates);
+ if (!(defenderSlice.ItemEntity is Spoils defenderSpoils)) return;
+
+ GlobalEventQueue.QueueSingleEvent(new TakeSpoilsEvent(defenderSpoils));
+
+ string toastMessage = string.Empty;
+ toastMessage += $"Obtained {defenderSpoils.Gold} {Currency.CurrencyAbbreviation}!";
+
+ foreach (IItem item in defenderSpoils.Items)
+ {
+ toastMessage += Environment.NewLine;
+ toastMessage += $"Obtained {item.Name}!";
+ }
+
+ attacker.CurrentBounty += BountyPerTriumph;
+ toastMessage += Environment.NewLine + Environment.NewLine +
+ $"{attacker.Id} bounty increased by {BountyPerTriumph}!";
+
+ GlobalEventQueue.QueueSingleEvent(
+ new ToastAtCoordinatesEvent(attackerCoordinates, toastMessage, AssetManager.CoinSFX, 80)
+ );
+
+ GlobalEventQueue.QueueSingleEvent(new WaitFramesEvent(10));
+ }
+
+ private void TakeAttackerSpoilsAndIncreaseBounty()
+ {
+ MapSlice attackerSlice = MapContainer.GetMapSliceAtCoordinates(attackerCoordinates);
+ if (!(attackerSlice.ItemEntity is Spoils attackerSpoils)) return;
+ GlobalEventQueue.QueueSingleEvent(new TakeSpoilsEvent(attackerSpoils));
+
+ string toastMessage = string.Empty;
+ toastMessage += $"Obtained {attackerSpoils.Gold} {Currency.CurrencyAbbreviation}!";
+
+ foreach (IItem item in attackerSpoils.Items)
+ {
+ toastMessage += Environment.NewLine;
+ toastMessage += $"Obtained {item.Name}!";
+ }
+
+ defender.CurrentBounty += BountyPerTriumph;
+ toastMessage += Environment.NewLine + Environment.NewLine +
+ $"{defender.Id} bounty increased by {BountyPerTriumph}!";
+
+ GlobalEventQueue.QueueSingleEvent(
+ new ToastAtCoordinatesEvent(defenderCoordinates, toastMessage, AssetManager.CoinSFX, 80)
+ );
+ GlobalEventQueue.QueueSingleEvent(new WaitFramesEvent(10));
+ }
+
private void SetPromptWindowText(string promptText)
{
IRenderable[,] promptTextContent =
{
{
new RenderText(AssetManager.PromptFont, promptText),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(AssetManager.PromptFont, "["),
@@ -223,11 +288,11 @@ private void SetupHelpWindow()
{
{
new RenderText(AssetManager.WindowFont, helpText, Color.White),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(AssetManager.WindowFont, "Dice Legend: ", Color.White),
diff --git a/SolStandard/Containers/Contexts/ControlContext.cs b/SolStandard/Containers/Contexts/ControlContext.cs
index 3da49db3..26b151c1 100644
--- a/SolStandard/Containers/Contexts/ControlContext.cs
+++ b/SolStandard/Containers/Contexts/ControlContext.cs
@@ -300,7 +300,7 @@ private static void MapControls(ControlMapper controlMapper)
case GameMapContext.TurnState.AdHocDraft:
AdHocDraftControl(controlMapper);
break;
- case GameMapContext.TurnState.StealItem:
+ case GameMapContext.TurnState.TakeItem:
StealItemControl(controlMapper);
break;
case GameMapContext.TurnState.SelectUnit:
@@ -538,16 +538,6 @@ private static void DecideActionControl(ControlMapper controlMapper)
GlobalEventQueue.QueueSingleEvent(new MoveActionMenuEvent(MenuCursorDirection.Right));
}
- if (controlMapper.Press(Input.PreviewUnit, PressType.Single))
- {
- GlobalEventQueue.QueueSingleEvent(new ToggleCombatMenuEvent());
- }
-
- if (controlMapper.Press(Input.PreviewItem, PressType.Single))
- {
- GlobalEventQueue.QueueSingleEvent(new ToggleCombatMenuEvent());
- }
-
if (controlMapper.Press(Input.Confirm, PressType.Single))
{
GlobalEventQueue.QueueSingleEvent(new SelectActionMenuOptionEvent());
@@ -651,7 +641,7 @@ private static void UnitTargetingControl(ControlMapper controlMapper)
if (controlMapper.Press(Input.Cancel, PressType.Single))
{
- GlobalEventQueue.QueueSingleEvent(new CancelActionEvent());
+ GlobalEventQueue.QueueSingleEvent(new CancelActionTargetingEvent());
}
}
diff --git a/SolStandard/Containers/Contexts/DeploymentContext.cs b/SolStandard/Containers/Contexts/DeploymentContext.cs
index d7c258c4..6a873cb0 100644
--- a/SolStandard/Containers/Contexts/DeploymentContext.cs
+++ b/SolStandard/Containers/Contexts/DeploymentContext.cs
@@ -141,7 +141,7 @@ private void UpdateItemPreview(MapSlice hoverSlice)
public void MoveToNextDeploymentTile()
{
- List mapEntities = MapContainer.GetMapEntities();
+ IEnumerable mapEntities = MapContainer.GetMapEntities();
List deployTiles = mapEntities.Where(tile => tile is DeployTile).ToList();
if (deployTiles.Count == 0) return;
diff --git a/SolStandard/Containers/Contexts/DraftContext.cs b/SolStandard/Containers/Contexts/DraftContext.cs
index 29e12d3e..600ecba9 100644
--- a/SolStandard/Containers/Contexts/DraftContext.cs
+++ b/SolStandard/Containers/Contexts/DraftContext.cs
@@ -76,8 +76,8 @@ public void StartNewDraft(int blueTeamUnitMax, int redTeamUnitMax, int maxUnitDu
redUnitCount = new Dictionary();
DraftView.UpdateCommanderPortrait(Role.Silhouette, Team.Creep);
- DraftView.UpdateTeamUnitsWindow(new List {new RenderBlank()}, Team.Blue);
- DraftView.UpdateTeamUnitsWindow(new List {new RenderBlank()}, Team.Red);
+ DraftView.UpdateTeamUnitsWindow(new List {RenderBlank.Blank}, Team.Blue);
+ DraftView.UpdateTeamUnitsWindow(new List {RenderBlank.Blank}, Team.Red);
DraftView.UpdateUnitSelectMenu(firstTurn, GetRolesEnabled(blueUnitCount, maxDuplicateUnitType));
DraftView.UpdateHelpWindow(
diff --git a/SolStandard/Containers/Contexts/GameContext.cs b/SolStandard/Containers/Contexts/GameContext.cs
index 4eb10b8d..746b00be 100644
--- a/SolStandard/Containers/Contexts/GameContext.cs
+++ b/SolStandard/Containers/Contexts/GameContext.cs
@@ -39,7 +39,8 @@ public enum GameState
public static readonly Color PositiveColor = new Color(30, 200, 30);
public static readonly Color NegativeColor = new Color(250, 10, 10);
- public static readonly Color NeutralColor = new Color(255, 250, 250);
+ public static readonly Color NeutralColor = new Color(255, 255, 255);
+ public static readonly Color DimColor = new Color(100, 100, 100);
private const string MapDirectory = "Content/TmxMaps/";
private const string MapSelectFile = "Map_Select_06.tmx";
@@ -57,8 +58,8 @@ public enum GameState
public static DeploymentContext DeploymentContext { get; private set; }
public static CodexContext CodexContext { get; private set; }
public static CreditsContext CreditsContext { get; private set; }
- public static Team P1Team { get; private set; }
+ public static Team P1Team { get; private set; }
public static Team P2Team => (P1Team == Team.Blue) ? Team.Red : Team.Blue;
public static GameState CurrentGameState;
@@ -80,9 +81,9 @@ public static PlayerIndex ActivePlayer
case GameState.Deployment:
return GetPlayerForTeam(DeploymentContext.CurrentTurn);
case GameState.PauseScreen:
- return GetPlayerForTeam(InitiativeContext.CurrentActiveTeam);
+ return GetPlayerForTeam(ActiveTeam);
case GameState.InGame:
- return GetPlayerForTeam(InitiativeContext.CurrentActiveTeam);
+ return GetPlayerForTeam(ActiveTeam);
case GameState.Codex:
return GetPlayerForTeam(CodexContext.CurrentTeam);
case GameState.Results:
@@ -90,7 +91,7 @@ public static PlayerIndex ActivePlayer
case GameState.Credits:
return PlayerIndex.One;
case GameState.ItemPreview:
- return GetPlayerForTeam(InitiativeContext.CurrentActiveTeam);
+ return GetPlayerForTeam(ActiveTeam);
default:
throw new ArgumentOutOfRangeException();
}
@@ -185,6 +186,7 @@ public static MapCamera MapCamera
public static List Units => InitiativeContext.InitiativeList;
public static GameUnit ActiveUnit => InitiativeContext.CurrentActiveUnit;
+ public static Team ActiveTeam => InitiativeContext.CurrentActiveTeam;
public static void CenterCursorAndCamera()
{
@@ -291,7 +293,8 @@ private static void InjectCreepsIntoSpawnTiles(List mapLoot)
}
}
- private static void InjectCreepIntoTile(List mapLoot, CreepEntity randomSummon, MapElement creepDeployTile)
+ private static void InjectCreepIntoTile(List mapLoot, CreepEntity randomSummon,
+ MapElement creepDeployTile)
{
Trace.WriteLine($"Injecting {randomSummon.Name} at {creepDeployTile.MapCoordinates}");
diff --git a/SolStandard/Containers/Contexts/GameMapContext.cs b/SolStandard/Containers/Contexts/GameMapContext.cs
index 7dc325a6..75efd7f0 100644
--- a/SolStandard/Containers/Contexts/GameMapContext.cs
+++ b/SolStandard/Containers/Contexts/GameMapContext.cs
@@ -34,7 +34,7 @@ public enum TurnState
UnitActing,
ResolvingTurn,
AdHocDraft,
- StealItem
+ TakeItem
}
public TurnState CurrentTurnState { get; set; }
@@ -75,7 +75,7 @@ public bool CanPressConfirm
get
{
if (CurrentTurnState != TurnState.SelectUnit) return true;
- return HoverUnit != null && HoverUnit.Team == GameContext.ActiveUnit.Team;
+ return HoverUnit != null && HoverUnit.Team == GameContext.ActiveTeam;
}
}
@@ -99,7 +99,7 @@ public bool CanPressCancel
return false;
case TurnState.AdHocDraft:
return false;
- case TurnState.StealItem:
+ case TurnState.TakeItem:
return true;
default:
return false;
@@ -144,10 +144,7 @@ public void PlayAnimationAtCoordinates(TriggeredAnimation animation, Vector2 coo
public static void UpdateWindowsEachTurn()
{
- //Initiative Window
GameMapView.GenerateInitiativeWindow();
-
- //Help Window
GameMapView.GenerateObjectiveWindow();
}
@@ -328,11 +325,16 @@ public void CancelActionMenu()
{
if (CurrentTurnState != TurnState.UnitDecidingAction) return;
- MapContainer.ClearDynamicAndPreviewGrids();
- GameMapView.CloseCombatMenu();
-
- RevertToPreviousState();
- CancelMove();
+ if (GameMapView.ActionMenuContext.IsAtRootMenu)
+ {
+ CancelActionMenuAndReturnToOrigin();
+ }
+ else
+ {
+ GameMapView.ActionMenuContext.GoToPreviousMenu();
+ GameMapView.GenerateCurrentMenuDescription();
+ AssetManager.MapUnitCancelSFX.Play();
+ }
}
else
{
@@ -340,14 +342,19 @@ public void CancelActionMenu()
}
}
- public void CancelTargetAction()
+ private void CancelActionMenuAndReturnToOrigin()
+ {
+ MapContainer.ClearDynamicAndPreviewGrids();
+ GameMapView.CloseCombatMenu();
+ RevertToPreviousState();
+ CancelMove();
+ }
+
+ public void CancelUnitTargeting()
{
if (CanCancelAction)
{
- GameContext.ActiveUnit.CancelArmedSkill();
- ResetCursorToActiveUnit();
- GameMapView.GenerateActionMenus();
- RevertToPreviousState();
+ CancelTargetAndOpenLastActionMenu();
}
else
{
@@ -359,18 +366,32 @@ private void CancelExtraAction()
{
if (CurrentTurnState == TurnState.UnitTargeting)
{
- GameContext.ActiveUnit.CancelArmedSkill();
- ResetCursorToActiveUnit();
- ResetToActionMenu();
- AssetManager.MapUnitCancelSFX.Play();
+ CancelTargetAndOpenLastActionMenu();
}
else
{
- MapContainer.AddNewToastAtMapCursor("Can't cancel action!", 50);
- AssetManager.WarningSFX.Play();
+ if (GameMapView.ActionMenuContext.IsAtRootMenu)
+ {
+ MapContainer.AddNewToastAtMapCursor("Can't cancel action!", 50);
+ AssetManager.WarningSFX.Play();
+ }
+ else
+ {
+ GameMapView.ActionMenuContext.GoToPreviousMenu();
+ AssetManager.MapUnitCancelSFX.Play();
+ }
}
}
+ private void CancelTargetAndOpenLastActionMenu()
+ {
+ GameContext.ActiveUnit.CancelArmedSkill();
+ ResetCursorToActiveUnit();
+ GameMapView.ActionMenuContext.Unhide();
+ RevertToPreviousState();
+ AssetManager.MapUnitCancelSFX.Play();
+ }
+
private void StartMoving()
{
if (SelectedUnit != null)
@@ -522,24 +543,30 @@ public void UpdateHoverContextWindows()
private void UpdateThreatRangePreview(GameUnit hoverMapUnit, MapSlice hoverSlice)
{
- if (hoverMapUnit != null && GameContext.ActiveUnit.Team != Team.Creep)
+ MapContainer.ClearDynamicAndPreviewGrids();
+ if (hoverMapUnit != null && GameContext.ActiveTeam != Team.Creep)
{
if (MapContainer.GetMapElementsFromLayer(Layer.Dynamic).Count != 0 && HoverUnit == hoverMapUnit) return;
- MapContainer.ClearDynamicAndPreviewGrids();
new UnitTargetingContext(MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Attack))
.GenerateThreatGrid(hoverSlice.MapCoordinates, hoverMapUnit, hoverMapUnit.Team);
}
else if (hoverSlice.TerrainEntity is IThreatRange entityThreat)
{
if (LastHoverEntity == hoverSlice.TerrainEntity && LastHoverItem == hoverSlice.ItemEntity) return;
- MapContainer.ClearDynamicAndPreviewGrids();
+
new UnitTargetingContext(MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Attack))
.GenerateThreatGrid(hoverSlice.MapCoordinates, entityThreat);
}
- else
+ else if (hoverSlice.TerrainEntity is IActionTile actionTile)
{
- MapContainer.ClearDynamicAndPreviewGrids();
+ new UnitTargetingContext(MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Action))
+ .GenerateTargetingGrid(hoverSlice.MapCoordinates, actionTile.InteractRange, Layer.Preview);
+ }
+ else if (hoverSlice.ItemEntity is IActionTile itemActionTile)
+ {
+ new UnitTargetingContext(MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Action))
+ .GenerateTargetingGrid(hoverSlice.MapCoordinates, itemActionTile.InteractRange, Layer.Preview);
}
}
@@ -579,13 +606,23 @@ public void MoveActionMenuCursor(MenuCursorDirection direction)
public void SelectActionMenuOption()
{
+ AssetManager.MapUnitSelectSFX.Play();
MapContainer.ClearDynamicAndPreviewGrids();
- GameMapView.CurrentMenu.CurrentOption.Execute();
- GameMapView.CloseCombatMenu();
- CurrentTurnState = TurnState.UnitTargeting;
- SelectedUnit.SetUnitAnimation(UnitAnimationState.Active);
- AssetManager.MapUnitSelectSFX.Play();
+ //FIXME This part of the code shouldn't know so much about the menu?
+ if (GameMapView?.CurrentMenu?.CurrentOption is ActionOption)
+ {
+ GameMapView.CurrentMenu.CurrentOption.Execute();
+ GameMapView.ActionMenuContext.Hide();
+ CurrentTurnState = TurnState.UnitTargeting;
+ SelectedUnit.SetUnitAnimation(UnitAnimationState.Active);
+ }
+ else
+ {
+ GameMapView?.CurrentMenu?.CurrentOption.Execute();
+ GameMapView?.GenerateCurrentMenuDescription();
+ GenerateActionPreviewGrid();
+ }
}
public void RefreshCurrentActionMenuOption()
@@ -624,7 +661,7 @@ public static bool TriggerEffectTiles(EffectTriggerTime effectTriggerTime, bool
if (triggerTiles.Count <= 0)
{
- effectTiles.ForEach(tile => tile.HasTriggered = false);
+ effectTiles.ForEach(tile => tile.HasTriggered = false);
return false;
}
@@ -686,10 +723,10 @@ public static void RemoveExpiredEffectTiles(IEnumerable effectTiles
}
}
- public void OpenStealMenu(GameUnit targetToStealFrom)
+ public void OpenTakeItemMenu(GameUnit targetToTakeFrom, bool freeAction)
{
- CurrentTurnState = TurnState.StealItem;
- GameMapView.GenerateStealItemMenu(targetToStealFrom);
+ CurrentTurnState = TurnState.TakeItem;
+ GameMapView.GenerateTakeItemMenu(targetToTakeFrom, freeAction);
AssetManager.MenuConfirmSFX.Play();
}
@@ -721,7 +758,7 @@ public void CancelStealItemMenu()
public void OpenDraftMenu()
{
CurrentTurnState = TurnState.AdHocDraft;
- GameMapView.GenerateDraftMenu(GameContext.ActiveUnit.Team);
+ GameMapView.GenerateDraftMenu(GameContext.ActiveTeam);
AssetManager.MenuConfirmSFX.Play();
}
@@ -731,15 +768,6 @@ public void ClearDraftMenu()
MapContainer.ClearDynamicAndPreviewGrids();
}
- public void ToggleActionInventoryMenu()
- {
- MapContainer.ClearDynamicAndPreviewGrids();
- GameMapView.ToggleCombatMenu();
- GameMapView.GenerateCurrentMenuDescription();
- GenerateActionPreviewGrid();
- AssetManager.MenuMoveSFX.Play();
- }
-
private static void GenerateActionPreviewGrid()
{
MapContainer.ClearDynamicAndPreviewGrids();
diff --git a/SolStandard/Containers/Contexts/InitiativeContext.cs b/SolStandard/Containers/Contexts/InitiativeContext.cs
index 725fc91d..82e97df5 100644
--- a/SolStandard/Containers/Contexts/InitiativeContext.cs
+++ b/SolStandard/Containers/Contexts/InitiativeContext.cs
@@ -18,13 +18,17 @@ public class InitiativeContext
public List InitiativeList { get; }
public GameUnit CurrentActiveUnit { get; private set; }
public Team CurrentActiveTeam { get; private set; }
- private Team FirstPlayer { get; }
+ public Team FirstPlayer { get; }
+ private int redTeamGold;
+ private int blueTeamGold;
public InitiativeContext(List unitList, Team firstTurn,
TurnOrder turnOrder = TurnOrder.AlternateExhaustingUnits)
{
CurrentActiveTeam = firstTurn;
FirstPlayer = firstTurn;
+ redTeamGold = 0;
+ blueTeamGold = 0;
switch (turnOrder)
{
@@ -36,16 +40,67 @@ public InitiativeContext(List unitList, Team firstTurn,
}
}
+ private int RedTeamGold
+ {
+ get => redTeamGold;
+ set => redTeamGold = value < 0 ? 0 : value;
+ }
+
+ private int BlueTeamGold
+ {
+ get => blueTeamGold;
+ set => blueTeamGold = value < 0 ? 0 : value;
+ }
+
+ public int GetGoldForTeam(Team team)
+ {
+ switch (team)
+ {
+ case Team.Blue:
+ return blueTeamGold;
+ case Team.Red:
+ return redTeamGold;
+ default:
+ return 0;
+ }
+ }
+
+ public void AddGoldToTeam(int goldToAdd, Team team)
+ {
+ switch (team)
+ {
+ case Team.Blue:
+ BlueTeamGold += goldToAdd;
+ break;
+ case Team.Red:
+ RedTeamGold += goldToAdd;
+ break;
+ }
+ }
+
+ public void DeductGoldFromTeam(int goldToDeduct, Team team)
+ {
+ switch (team)
+ {
+ case Team.Blue:
+ BlueTeamGold -= goldToDeduct;
+ break;
+ case Team.Red:
+ RedTeamGold -= goldToDeduct;
+ break;
+ }
+ }
+
public void StartFirstTurn()
{
CurrentActiveTeam = TeamWithFewerRemainingUnits();
CurrentActiveUnit = InitiativeList.FirstOrDefault(unit => unit.Team == CurrentActiveTeam && unit.IsAlive);
-
- foreach (CreepUnit creepUnit in GameContext.Units.Where(unit=>unit is CreepUnit).Cast())
+
+ foreach (CreepUnit creepUnit in GameContext.Units.Where(unit => unit is CreepUnit).Cast())
{
creepUnit.ReadyNextRoutine();
}
-
+
StartNewRound();
}
@@ -122,7 +177,7 @@ private void StartNewRound()
GlobalEventQueue.QueueSingleEvent(new EffectTilesStartOfRoundEvent());
GlobalEventQueue.QueueSingleEvent(new UpdateTurnOrderEvent(this));
-
+
GameContext.StatusScreenView.UpdateWindows();
}
@@ -132,7 +187,7 @@ public void UpdateTurnOrder()
UpdateUnitActivation();
}
- private Team TeamWithFewerRemainingUnits()
+ public Team TeamWithFewerRemainingUnits()
{
int redTeamUnits = InitiativeList.Count(unit => unit.Team == Team.Red && unit.IsAlive);
int blueTeamUnits = InitiativeList.Count(unit => unit.Team == Team.Blue && unit.IsAlive);
@@ -195,7 +250,7 @@ private void ExecuteCreepRoutine()
{
if (CurrentActiveTeam != Team.Creep) return;
if (GameContext.ActiveUnit.UnitEntity == null) return;
-
+
GlobalEventQueue.QueueSingleEvent(new WaitFramesEvent(30));
if (GameContext.ActiveUnit is CreepUnit activeCreep)
diff --git a/SolStandard/Containers/Contexts/UnitContextualActionMenuContext.cs b/SolStandard/Containers/Contexts/UnitContextualActionMenuContext.cs
index eb710aaa..88a2ae0f 100644
--- a/SolStandard/Containers/Contexts/UnitContextualActionMenuContext.cs
+++ b/SolStandard/Containers/Contexts/UnitContextualActionMenuContext.cs
@@ -1,119 +1,104 @@
using System.Collections.Generic;
+using System.Linq;
using Microsoft.Xna.Framework;
using SolStandard.Entity;
+using SolStandard.Entity.Unit;
using SolStandard.Entity.Unit.Actions;
+using SolStandard.Entity.Unit.Actions.Item;
using SolStandard.HUD.Menu;
using SolStandard.HUD.Menu.Options;
using SolStandard.HUD.Menu.Options.ActionMenu;
-using SolStandard.Map;
-using SolStandard.Map.Elements;
-using SolStandard.Map.Elements.Cursor;
+using SolStandard.HUD.Window.Content;
using SolStandard.Utility;
-using SolStandard.Utility.Exceptions;
namespace SolStandard.Containers.Contexts
{
public static class UnitContextualActionMenuContext
{
- private static readonly int[] InteractionRangeLimit = {0, 1, 2};
- private static List _contextualActions;
-
- public static MenuOption[] GenerateActionMenuOptions(Color windowColour)
+ public static List ActiveUnitContextOptions(Color windowColor)
{
- _contextualActions = FetchContextualActionsInRange();
- foreach (UnitAction activeUnitSkill in GameContext.ActiveUnit.Actions)
- {
- _contextualActions.Add(activeUnitSkill);
- }
+ return FetchContextualActionsInRange()
+ .Select(contextAction => new ActionOption(windowColor, contextAction))
+ .ToList();
+ }
- MenuOption[] options = new MenuOption[_contextualActions.Count];
- for (int i = 0; i < _contextualActions.Count; i++)
+ public static List ActiveUnitSkillOptions(Color windowColor)
+ {
+ List options = new List();
+ foreach (UnitAction skillAction in GameContext.ActiveUnit.Actions)
{
- options[i] = new ActionOption(windowColour, _contextualActions[i]);
+ options.Add(new ActionOption(windowColor, skillAction));
}
return options;
}
- public static IRenderable GetActionDescriptionAtIndex(IMenu actionMenu)
+ public static IRenderable GetActionDescriptionForCurrentMenuOption(IMenu actionMenu)
{
- if (actionMenu.CurrentOption is ActionOption action)
+ if (actionMenu.CurrentOption is IOptionDescription descriptiveOption)
{
- return action.Action.Description;
+ return descriptiveOption.Description;
}
- throw new SkillDescriptionNotFoundException();
+ return RenderBlank.Blank;
}
- public static MenuOption[,] GenerateInventoryMenuOptions(Color windowColour)
+ public static MenuOption[,] GenerateInventoryMenuOptions(Color windowColor)
{
const int columns = 2;
- MenuOption[,] options = new MenuOption[GameContext.ActiveUnit.Inventory.Count + 1, columns];
+ List activeUnitInventory = GameContext.ActiveUnit.Inventory;
+ MenuOption[,] options = new MenuOption[activeUnitInventory.Count, columns];
- options[0, 0] = new ActionOption(windowColour, new DropGiveGoldAction());
- options[0, 1] = new ActionOption(windowColour, new Wait());
-
- for (int i = 0; i < GameContext.ActiveUnit.Inventory.Count; i++)
+ for (int i = 0; i < activeUnitInventory.Count; i++)
{
- options[i + 1, 0] = new ActionOption(windowColour, GameContext.ActiveUnit.Inventory[i].UseAction());
- options[i + 1, 1] = new ActionOption(windowColour, GameContext.ActiveUnit.Inventory[i].DropAction());
+ IItem currentItem = activeUnitInventory[i];
+ options[i, 0] = new ItemActionOption(currentItem, windowColor);
+ options[i, 1] = new ActionOption(windowColor, currentItem.DropAction());
}
return options;
}
- private static List FetchContextualActionsInRange()
+ private static IEnumerable FetchContextualActionsInRange()
{
- new UnitTargetingContext(MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Action))
- .GenerateTargetingGrid(GameContext.ActiveUnit.UnitEntity.MapCoordinates, InteractionRangeLimit);
-
- List mapSlicesInRange = new List();
- List distanceTiles = new List();
-
- foreach (MapElement mapElement in MapContainer.GameGrid[(int) Layer.Dynamic])
- {
- if (mapElement == null) continue;
-
- distanceTiles.Add(mapElement as MapDistanceTile);
- mapSlicesInRange.Add(MapContainer.GetMapSliceAtCoordinates(mapElement.MapCoordinates));
- }
-
- List contextualSkills = new List();
-
- foreach (MapSlice slice in mapSlicesInRange)
+ List mapActionTiles = MapContainer.GetMapEntities()
+ .Where(entity => entity is IActionTile)
+ .Cast()
+ .ToList();
+
+ List contextActions = new List();
+
+ foreach (IActionTile actionTile in mapActionTiles.Where(actionTile =>
+ RangeComparison.TargetIsWithinRangeOfOrigin(
+ actionTile.MapCoordinates,
+ actionTile.InteractRange,
+ GameContext.ActiveUnit.UnitEntity.MapCoordinates
+ ))
+ )
{
- IActionTile entityActionTile = slice.TerrainEntity as IActionTile;
- AddEntityAction(entityActionTile, distanceTiles, contextualSkills);
-
- IActionTile itemActionTile = slice.ItemEntity as IActionTile;
- AddEntityAction(itemActionTile, distanceTiles, contextualSkills);
-
- IActionTile unitActionTile = slice.UnitEntity;
- AddEntityAction(unitActionTile, distanceTiles, contextualSkills);
+ contextActions.AddRange(actionTile.TileActions());
}
- MapContainer.ClearDynamicAndPreviewGrids();
+ UnitAction takeAction = TakeActionIfAllyInRange();
+ if (takeAction != null) contextActions.Add(takeAction);
- return contextualSkills;
+ return contextActions;
}
- private static void AddEntityAction(IActionTile entityActionTile, List distanceTiles,
- List contextualSkills)
+ private static UnitAction TakeActionIfAllyInRange()
{
- if (entityActionTile == null) return;
-
- foreach (MapDistanceTile distanceTile in distanceTiles)
- {
- foreach (int range in entityActionTile.InteractRange)
- {
- //If the tile's range aligns with the current range of the unit, add the action to the action list
- if (distanceTile.MapCoordinates != entityActionTile.MapCoordinates) continue;
- if (distanceTile.Distance == range)
- {
- contextualSkills.AddRange(entityActionTile.TileActions());
- }
- }
- }
+ int[] meleeRange = {1};
+
+ List alliesInRange = GameContext.Units
+ .Where(unit => unit.Team == GameContext.ActiveTeam && unit.IsAlive)
+ .Where(ally => RangeComparison.TargetIsWithinRangeOfOrigin(
+ GameContext.ActiveUnit.UnitEntity.MapCoordinates,
+ meleeRange,
+ ally.UnitEntity.MapCoordinates
+ ))
+ .ToList();
+
+ return alliesInRange.Any(ally => ally.Inventory.Count > 0) ? new TakeItemAction() : null;
}
}
}
\ No newline at end of file
diff --git a/SolStandard/Containers/Contexts/WinConditions/Objective.cs b/SolStandard/Containers/Contexts/WinConditions/Objective.cs
index 4ce24457..9a5a85ba 100644
--- a/SolStandard/Containers/Contexts/WinConditions/Objective.cs
+++ b/SolStandard/Containers/Contexts/WinConditions/Objective.cs
@@ -29,7 +29,7 @@ public abstract class Objective
protected bool CoOpVictory;
protected bool AllPlayersLose;
- public virtual IRenderable ObjectiveInfo => new RenderBlank();
+ public virtual IRenderable ObjectiveInfo => RenderBlank.Blank;
public abstract bool ConditionsMet();
diff --git a/SolStandard/Containers/Contexts/WinConditions/Taxes.cs b/SolStandard/Containers/Contexts/WinConditions/Taxes.cs
index 9926ebed..1b8b347f 100644
--- a/SolStandard/Containers/Contexts/WinConditions/Taxes.cs
+++ b/SolStandard/Containers/Contexts/WinConditions/Taxes.cs
@@ -1,6 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
+using Microsoft.Xna.Framework;
using SolStandard.Entity.General;
using SolStandard.Entity.Unit;
using SolStandard.HUD.Window;
@@ -21,18 +20,16 @@ public Taxes(int targetGold)
}
protected override IRenderable VictoryLabelContent => BuildObjectiveWindow(AssetManager.ResultsFont);
-
-
public override IRenderable ObjectiveInfo => BuildObjectiveWindow(AssetManager.WindowFont);
private Window BuildObjectiveWindow(ISpriteFont font)
{
Window blueGoldWindow = new Window(
- new RenderText(font, "Blue: " + CollectedGold(Team.Blue) + "/" + targetGold + "G"),
+ new RenderText(font, "Blue: " + BankedGoldForTeam(Team.Blue) + "/" + targetGold + "G"),
TeamUtility.DetermineTeamColor(Team.Blue));
Window redGoldWindow = new Window(
- new RenderText(font, "Red: " + CollectedGold(Team.Red) + "/" + targetGold + "G"),
+ new RenderText(font, "Red: " + BankedGoldForTeam(Team.Red) + "/" + targetGold + "G"),
TeamUtility.DetermineTeamColor(Team.Red));
WindowContentGrid teamGoldWindowContentGrid = new WindowContentGrid(
@@ -42,8 +39,9 @@ private Window BuildObjectiveWindow(ISpriteFont font)
blueGoldWindow,
ObjectiveIconProvider.GetObjectiveIcon(
VictoryConditions.Taxes,
- GameDriver.CellSizeVector
+ new Vector2(font.MeasureString("A").Y)
),
+ new RenderText(font, "Deposit"),
redGoldWindow
}
},
@@ -55,19 +53,19 @@ private Window BuildObjectiveWindow(ISpriteFont font)
public override bool ConditionsMet()
{
- if (TeamHasCollectedTargetGold(Team.Blue) && TeamHasCollectedTargetGold(Team.Red))
+ if (TeamHasBankedTargetGold(Team.Blue) && TeamHasBankedTargetGold(Team.Red))
{
GameIsADraw = true;
return GameIsADraw;
}
- if (TeamHasCollectedTargetGold(Team.Blue))
+ if (TeamHasBankedTargetGold(Team.Blue))
{
BlueTeamWins = true;
return BlueTeamWins;
}
- if (TeamHasCollectedTargetGold(Team.Red))
+ if (TeamHasBankedTargetGold(Team.Red))
{
RedTeamWins = true;
return RedTeamWins;
@@ -76,34 +74,24 @@ public override bool ConditionsMet()
return false;
}
- private static int CollectedGold(Team team)
+ private static int BankedGoldForTeam(Team team)
{
- List teamUnitList = GameContext.Units.FindAll(unit => unit.Team == team);
-
- int heldGold = teamUnitList.Sum(unit => unit.CurrentGold);
-
- int bankedGold = 0;
-
switch (team)
{
case Team.Blue:
- bankedGold = Bank.BlueMoney;
- break;
+ return Bank.BlueMoney;
case Team.Red:
- bankedGold = Bank.RedMoney;
- break;
+ return Bank.RedMoney;
case Team.Creep:
- break;
+ return 0;
default:
throw new ArgumentOutOfRangeException(nameof(team), team, null);
}
-
- return heldGold + bankedGold;
}
- private bool TeamHasCollectedTargetGold(Team team)
+ private bool TeamHasBankedTargetGold(Team team)
{
- return CollectedGold(team) >= targetGold;
+ return BankedGoldForTeam(team) >= targetGold;
}
}
}
\ No newline at end of file
diff --git a/SolStandard/Containers/MapContainer.cs b/SolStandard/Containers/MapContainer.cs
index 88cba137..b52cc93a 100644
--- a/SolStandard/Containers/MapContainer.cs
+++ b/SolStandard/Containers/MapContainer.cs
@@ -131,7 +131,7 @@ public MapSlice GetMapSliceAtCursor()
return GetMapSliceAtCoordinates(MapCursor.MapCoordinates);
}
- public static List GetMapEntities()
+ public static IEnumerable GetMapEntities()
{
List entities = new List();
@@ -142,7 +142,10 @@ public static List GetMapEntities()
{
for (int column = 0; column < mapWidth; column++)
{
- if (GameGrid[(int) Layer.Entities][column, row] is MapEntity currentTile) entities.Add(currentTile);
+ if (GameGrid[(int) Layer.Entities][column, row] is MapEntity currentEntity)
+ entities.Add(currentEntity);
+
+ if (GameGrid[(int) Layer.Items][column, row] is MapEntity currentItem) entities.Add(currentItem);
}
}
diff --git a/SolStandard/Containers/View/BattleView.cs b/SolStandard/Containers/View/BattleView.cs
index ee339f53..16da665c 100644
--- a/SolStandard/Containers/View/BattleView.cs
+++ b/SolStandard/Containers/View/BattleView.cs
@@ -27,25 +27,25 @@ public class BattleView : IUserInterface
private const int WindowSpacing = 5;
private static readonly Vector2 HpBarSize = new Vector2(350, 80);
- public AnimatedWindow AttackerPortraitWindow { get; private set; }
- private AnimatedWindow AttackerDetailWindow { get; set; }
- private AnimatedWindow AttackerHpWindow { get; set; }
- private AnimatedWindow AttackerAtkWindow { get; set; }
- public AnimatedWindow AttackerBonusWindow { get; private set; }
- private AnimatedWindow AttackerRangeWindow { get; set; }
- private AnimatedWindow AttackerDiceWindow { get; set; }
- private AnimatedWindow AttackerSpriteWindow { get; set; }
-
- public AnimatedWindow DefenderPortraitWindow { get; private set; }
- private AnimatedWindow DefenderDetailWindow { get; set; }
- private AnimatedWindow DefenderHpWindow { get; set; }
- private AnimatedWindow DefenderAtkWindow { get; set; }
- private AnimatedWindow DefenderBonusWindow { get; set; }
- private AnimatedWindow DefenderRangeWindow { get; set; }
- private AnimatedWindow DefenderDiceWindow { get; set; }
- private AnimatedWindow DefenderSpriteWindow { get; set; }
-
- private AnimatedWindow HelpTextWindow { get; set; }
+ private AnimatedRenderable AttackerPortraitWindow { get; set; }
+ private AnimatedRenderable AttackerDetailWindow { get; set; }
+ private AnimatedRenderable AttackerHpWindow { get; set; }
+ private AnimatedRenderable AttackerAtkWindow { get; set; }
+ public AnimatedRenderable AttackerBonusWindow { get; private set; }
+ private AnimatedRenderable AttackerRangeWindow { get; set; }
+ private AnimatedRenderable AttackerDiceWindow { get; set; }
+ private AnimatedRenderable AttackerSpriteWindow { get; set; }
+
+ private AnimatedRenderable DefenderPortraitWindow { get; set; }
+ private AnimatedRenderable DefenderDetailWindow { get; set; }
+ private AnimatedRenderable DefenderHpWindow { get; set; }
+ private AnimatedRenderable DefenderAtkWindow { get; set; }
+ private AnimatedRenderable DefenderBonusWindow { get; set; }
+ private AnimatedRenderable DefenderRangeWindow { get; set; }
+ private AnimatedRenderable DefenderDiceWindow { get; set; }
+ private AnimatedRenderable DefenderSpriteWindow { get; set; }
+
+ private AnimatedRenderable HelpTextWindow { get; set; }
private Window UserPromptWindow { get; set; }
private bool visible;
@@ -55,23 +55,23 @@ public BattleView()
visible = true;
}
- private static IWindowAnimation RightBattlerAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Left, UnitSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation RightBattlerAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Left, UnitSlideDistance, WindowSlideSpeed);
- private static IWindowAnimation LeftBattlerAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Right, UnitSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation LeftBattlerAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Right, UnitSlideDistance, WindowSlideSpeed);
- private static IWindowAnimation RightSideWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Left, WindowHorizontalSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation RightSideRenderableAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Left, WindowHorizontalSlideDistance, WindowSlideSpeed);
- private static IWindowAnimation LeftSideWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Right, WindowHorizontalSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation LeftSideRenderableAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Right, WindowHorizontalSlideDistance, WindowSlideSpeed);
- private static IWindowAnimation BottomWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Up, WindowVerticalSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation BottomRenderableAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Up, WindowVerticalSlideDistance, WindowSlideSpeed);
- private static IWindowAnimation TopWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Down, WindowVerticalSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation TopRenderableAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Down, WindowVerticalSlideDistance, WindowSlideSpeed);
#region View Management
@@ -87,7 +87,7 @@ public void HidePromptWindow()
public void GenerateHelpTextWindow(WindowContentGrid helpTextContent)
{
Color helpTextWindowColor = new Color(20, 20, 20, 200);
- HelpTextWindow = new AnimatedWindow(new Window(helpTextContent, helpTextWindowColor), TopWindowAnimation);
+ HelpTextWindow = new AnimatedRenderable(new Window(helpTextContent, helpTextWindowColor), TopRenderableAnimation);
}
public void GenerateUserPromptWindow(WindowContentGrid promptTextContent, Vector2 sizeOverride)
@@ -116,37 +116,37 @@ public void GenerateAttackerSpriteWindow(GameUnit attacker, Color spriteColor, U
}
AttackerSpriteWindow =
- new AnimatedWindow(BattlerWindow(attacker, spriteColor, state, frameDelay, false),
+ new AnimatedRenderable(BattlerWindow(attacker, spriteColor, state, frameDelay, false),
LeftBattlerAnimation);
}
public void GenerateAttackerDamageWindow(Color attackerWindowColor, CombatDamage attackerDamage)
{
AttackerDiceWindow =
- new AnimatedWindow(new Window(attackerDamage, attackerWindowColor), LeftSideWindowAnimation);
+ new AnimatedRenderable(new Window(attackerDamage, attackerWindowColor), LeftSideRenderableAnimation);
}
public void GenerateAttackerInRangeWindow(Color attackerWindowColor, bool inRange)
{
AttackerRangeWindow =
- new AnimatedWindow(RangeWindow(attackerWindowColor, inRange), LeftSideWindowAnimation);
+ new AnimatedRenderable(RangeWindow(attackerWindowColor, inRange), LeftSideRenderableAnimation);
}
public void GenerateAttackerBonusWindow(BonusStatistics bonusStatistics, Color attackerWindowColor)
{
AttackerBonusWindow =
- new AnimatedWindow(BonusWindow(bonusStatistics, attackerWindowColor), LeftSideWindowAnimation);
+ new AnimatedRenderable(BonusWindow(bonusStatistics, attackerWindowColor), LeftSideRenderableAnimation);
}
public void GenerateAttackerAtkWindow(Color windowColor, UnitStatistics attackerStats, Stats combatStat)
{
- AttackerAtkWindow = new AnimatedWindow(CombatStatWindow(windowColor, attackerStats, combatStat),
- LeftSideWindowAnimation);
+ AttackerAtkWindow = new AnimatedRenderable(CombatStatWindow(windowColor, attackerStats, combatStat),
+ LeftSideRenderableAnimation);
}
public void GenerateAttackerHpWindow(Color windowColor, GameUnit attacker)
{
- AttackerHpWindow = new AnimatedWindow(GenerateHpWindow(attacker, windowColor), LeftSideWindowAnimation);
+ AttackerHpWindow = new AnimatedRenderable(GenerateHpWindow(attacker, windowColor), LeftSideRenderableAnimation);
}
public void GenerateAttackerUnitCard(Color attackerWindowColor, GameUnit attacker, bool animated = true)
@@ -159,16 +159,16 @@ private void GenerateAttackerDetailWindow(Color attackerWindowColor,
IRenderable attackerDetail, bool animated)
{
AttackerDetailWindow =
- new AnimatedWindow(new Window(attackerDetail, attackerWindowColor),
- animated ? BottomWindowAnimation : new WindowStatic(AttackerDetailWindowPosition()));
+ new AnimatedRenderable(new Window(attackerDetail, attackerWindowColor),
+ animated ? BottomRenderableAnimation : new RenderableStatic(AttackerDetailWindowPosition()));
}
private void GenerateAttackerPortraitWindow(Color attackerWindowColor, IRenderable attackerPortrait,
bool animated)
{
AttackerPortraitWindow =
- new AnimatedWindow(new Window(attackerPortrait, attackerWindowColor),
- animated ? BottomWindowAnimation : new WindowStatic(AttackerPortraitWindowPosition()));
+ new AnimatedRenderable(new Window(attackerPortrait, attackerWindowColor),
+ animated ? BottomRenderableAnimation : new RenderableStatic(AttackerPortraitWindowPosition()));
}
#endregion Attacker Windows
@@ -193,7 +193,7 @@ public void GenerateDefenderSpriteWindow(GameUnit defender, Color spriteColor, U
}
DefenderSpriteWindow =
- new AnimatedWindow(BattlerWindow(defender, spriteColor, state, frameDelay, true),
+ new AnimatedRenderable(BattlerWindow(defender, spriteColor, state, frameDelay, true),
RightBattlerAnimation);
}
@@ -201,33 +201,33 @@ public void GenerateDefenderSpriteWindow(GameUnit defender, Color spriteColor, U
public void GenerateDefenderDamageWindow(Color defenderWindowColor, CombatDamage defenderDamage)
{
DefenderDiceWindow =
- new AnimatedWindow(new Window(defenderDamage, defenderWindowColor), RightSideWindowAnimation);
+ new AnimatedRenderable(new Window(defenderDamage, defenderWindowColor), RightSideRenderableAnimation);
}
public void GenerateDefenderRangeWindow(Color defenderWindowColor, bool inRange)
{
DefenderRangeWindow =
- new AnimatedWindow(RangeWindow(defenderWindowColor, inRange), RightSideWindowAnimation);
+ new AnimatedRenderable(RangeWindow(defenderWindowColor, inRange), RightSideRenderableAnimation);
}
public void GenerateDefenderBonusWindow(BonusStatistics bonusStatistics, Color defenderWindowColor)
{
DefenderBonusWindow =
- new AnimatedWindow(BonusWindow(bonusStatistics, defenderWindowColor), RightSideWindowAnimation);
+ new AnimatedRenderable(BonusWindow(bonusStatistics, defenderWindowColor), RightSideRenderableAnimation);
}
public void GenerateDefenderRetWindow(Color windowColor, UnitStatistics defenderStats, Stats combatStat)
{
- DefenderAtkWindow = new AnimatedWindow(CombatStatWindow(windowColor, defenderStats, combatStat),
- RightSideWindowAnimation);
+ DefenderAtkWindow = new AnimatedRenderable(CombatStatWindow(windowColor, defenderStats, combatStat),
+ RightSideRenderableAnimation);
}
public void GenerateDefenderHpWindow(Color windowColor, GameUnit defender)
{
- DefenderHpWindow = new AnimatedWindow(GenerateHpWindow(defender, windowColor), RightSideWindowAnimation);
+ DefenderHpWindow = new AnimatedRenderable(GenerateHpWindow(defender, windowColor), RightSideRenderableAnimation);
}
public void GenerateDefenderUnitCard(Color defenderWindowColor, GameUnit defender, bool animated = true)
@@ -240,16 +240,16 @@ private void GenerateDefenderDetailWindow(Color defenderWindowColor,
IRenderable defenderDetail, bool animated)
{
DefenderDetailWindow =
- new AnimatedWindow(new Window(defenderDetail, defenderWindowColor),
- animated ? BottomWindowAnimation : new WindowStatic(DefenderDetailWindowPosition()));
+ new AnimatedRenderable(new Window(defenderDetail, defenderWindowColor),
+ animated ? BottomRenderableAnimation : new RenderableStatic(DefenderDetailWindowPosition()));
}
private void GenerateDefenderPortraitWindow(Color defenderWindowColor, IRenderable defenderPortrait,
bool animated)
{
DefenderPortraitWindow =
- new AnimatedWindow(new Window(defenderPortrait, defenderWindowColor),
- animated ? BottomWindowAnimation : new WindowStatic(DefenderPortraitWindowPosition()));
+ new AnimatedRenderable(new Window(defenderPortrait, defenderWindowColor),
+ animated ? BottomRenderableAnimation : new RenderableStatic(DefenderPortraitWindowPosition()));
}
#endregion Defender Windows
@@ -273,7 +273,7 @@ private static Window RangeWindow(Color windowColor, bool inRange)
}
};
- WindowContentGrid defenderRangeContentGrid = new WindowContentGrid(defenderRangeContent, 1);
+ WindowContentGrid defenderRangeContentGrid = new WindowContentGrid(defenderRangeContent);
return new Window(defenderRangeContentGrid, windowColor);
}
@@ -306,8 +306,7 @@ private static Window BattlerWindow(GameUnit attacker, Color spriteColor, UnitAn
{
attacker.GetMapSprite(new Vector2(spriteSize), spriteColor, state, frameDelay, isFlipped)
}
- },
- 1
+ }
),
Color.Transparent
);
@@ -346,8 +345,7 @@ private static Window CombatStatWindow(Color windowColor, UnitStatistics stats,
UnitStatistics.DetermineStatColor(statValue, baseStatValue)
)
}
- },
- 1
+ }
);
return new Window(atkContentGrid, windowColor);
}
diff --git a/SolStandard/Containers/View/CodexView.cs b/SolStandard/Containers/View/CodexView.cs
index 72c2a899..795a91b4 100644
--- a/SolStandard/Containers/View/CodexView.cs
+++ b/SolStandard/Containers/View/CodexView.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SolStandard.Containers.Contexts;
@@ -47,9 +48,13 @@ public void ShowUnitDetails(GameUnit unit)
unitDetailWindow = GenerateUnitDetailWindow(unit);
}
- private static Window GenerateActionWindow(IReadOnlyList actions, Color windowColor)
+ private static Window GenerateActionWindow(IEnumerable unitActions, Color windowColor)
{
- IRenderable[,] actionElements = new IRenderable[actions.Count, 4];
+ List codexActions = new List(unitActions)
+ .Where(action => !(action is BasicAttack) && !(action is Wait))
+ .ToList();
+
+ IRenderable[,] actionElements = new IRenderable[codexActions.Count, 4];
const int iconIndex = 0;
const int nameIndex = 1;
@@ -60,27 +65,27 @@ private static Window GenerateActionWindow(IReadOnlyList actions, Co
int largestRangeWidth = 0;
int largestDescriptionWidth = 0;
- for (int i = 0; i < actions.Count; i++)
+ for (int i = 0; i < codexActions.Count; i++)
{
- actionElements[i, iconIndex] = actions[i].Icon;
+ actionElements[i, iconIndex] = codexActions[i].Icon;
actionElements[i, nameIndex] =
new Window(
- new RenderText(AssetManager.WindowFont, actions[i].Name,
- (actions[i].FreeAction) ? GameContext.PositiveColor : Color.White), Color.Transparent);
+ new RenderText(AssetManager.WindowFont, codexActions[i].Name,
+ (codexActions[i].FreeAction) ? GameContext.PositiveColor : Color.White), Color.Transparent);
actionElements[i, rangeIndex] = new Window(
new RenderText(
AssetManager.WindowFont,
- actions[i].Range == null
+ codexActions[i].Range == null
? "Range: N/A"
- : $"Range: [{string.Join(",", actions[i].Range)}]"
+ : $"Range: [{string.Join(",", codexActions[i].Range)}]"
),
Color.Transparent
);
actionElements[i, descriptionIndex] =
- new Window(actions[i].Description, windowColor);
+ new Window(codexActions[i].Description, windowColor);
//Remember the largest width for aligning later
if (actionElements[i, nameIndex].Width > largestNameWidth)
@@ -100,7 +105,7 @@ private static Window GenerateActionWindow(IReadOnlyList actions, Co
}
- for (int i = 0; i < actions.Count; i++)
+ for (int i = 0; i < codexActions.Count; i++)
{
//Fill space so that all the elements have the same width like a grid
((Window) actionElements[i, nameIndex]).Width = largestNameWidth;
diff --git a/SolStandard/Containers/View/DeploymentView.cs b/SolStandard/Containers/View/DeploymentView.cs
index f11fa535..f3c6b04f 100644
--- a/SolStandard/Containers/View/DeploymentView.cs
+++ b/SolStandard/Containers/View/DeploymentView.cs
@@ -76,31 +76,31 @@ private static Window GenerateHelpTextWindow()
{
{
new RenderText(AssetManager.HeaderFont, "Deployment Phase"),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "Press "),
InputIconProvider.GetInputIcon(Input.Confirm, new Vector2(windowFont.MeasureString("A").Y)),
new RenderText(windowFont, " on a deployment tile to deploy a unit."),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "Press "),
InputIconProvider.GetInputIcon(Input.Cancel, new Vector2(windowFont.MeasureString("A").Y)),
new RenderText(windowFont, " to snap to the first deploy tile."),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "Press "),
InputIconProvider.GetInputIcon(Input.PreviewUnit, new Vector2(windowFont.MeasureString("A").Y)),
new RenderText(windowFont, " to preview selected unit in the codex."),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "Press "),
diff --git a/SolStandard/Containers/View/DraftView.cs b/SolStandard/Containers/View/DraftView.cs
index 74c4522a..1dc88d36 100644
--- a/SolStandard/Containers/View/DraftView.cs
+++ b/SolStandard/Containers/View/DraftView.cs
@@ -61,10 +61,10 @@ public void UpdateControlsTextWindow()
{
{
new RenderText(AssetManager.HeaderFont, "~Draft Phase~"),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "Move Draft Cursor: "),
@@ -76,16 +76,16 @@ public void UpdateControlsTextWindow()
{
new RenderText(windowFont, "Draft a unit: "),
InputIconProvider.GetInputIcon(Input.Confirm, new Vector2(windowFont.MeasureString("A").Y)),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "View Unit Codex: "),
InputIconProvider.GetInputIcon(Input.PreviewUnit, new Vector2(windowFont.MeasureString("A").Y)),
- new RenderBlank(),
- new RenderBlank(),
- new RenderBlank()
+ RenderBlank.Blank,
+ RenderBlank.Blank,
+ RenderBlank.Blank
},
{
new RenderText(windowFont, "Move Map Camera: "),
@@ -155,7 +155,7 @@ public void UpdateCommanderSelect(List units, Team team)
}
else
{
- commanderOptions[row, column] = new UnselectableOption(new RenderBlank(), DarkBackgroundColor);
+ commanderOptions[row, column] = new UnselectableOption(RenderBlank.Blank, DarkBackgroundColor);
}
unitIndex++;
@@ -310,7 +310,7 @@ private static Window BuildUnitListWindow(IReadOnlyList unitSprites
{
if (unitIndex >= unitSprites.Count)
{
- unitCells[row, column] = new RenderBlank();
+ unitCells[row, column] = RenderBlank.Blank;
}
else
{
diff --git a/SolStandard/Containers/View/GameMapView.cs b/SolStandard/Containers/View/GameMapView.cs
index c56d0974..f1e4e7a1 100644
--- a/SolStandard/Containers/View/GameMapView.cs
+++ b/SolStandard/Containers/View/GameMapView.cs
@@ -1,14 +1,20 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using SolStandard.Containers.Contexts;
+using SolStandard.Containers.Contexts.WinConditions;
using SolStandard.Entity;
using SolStandard.Entity.General;
using SolStandard.Entity.Unit;
+using SolStandard.Entity.Unit.Actions;
+using SolStandard.Entity.Unit.Actions.Champion;
+using SolStandard.Entity.Unit.Actions.Duelist;
using SolStandard.Entity.Unit.Statuses;
using SolStandard.HUD.Menu;
using SolStandard.HUD.Menu.Options;
+using SolStandard.HUD.Menu.Options.ActionMenu;
using SolStandard.HUD.Menu.Options.StealMenu;
using SolStandard.HUD.Window;
using SolStandard.HUD.Window.Animation;
@@ -16,7 +22,7 @@
using SolStandard.Map.Elements.Cursor;
using SolStandard.Utility;
using SolStandard.Utility.Assets;
-using SolStandard.Utility.Buttons;
+using SolStandard.Utility.Monogame;
namespace SolStandard.Containers.View
{
@@ -29,8 +35,7 @@ public class GameMapView : IUserInterface
private enum MenuType
{
ActionMenu,
- InventoryMenu,
- StealItemMenu,
+ TakeItemMenu,
DraftMenu
}
@@ -45,38 +50,35 @@ private enum MenuType
public static readonly Color UserPromptWindowColor = new Color(40, 30, 40, 200);
private int LeftHoverUnit { get; set; }
- private AnimatedWindow LeftUnitPortraitWindow { get; set; }
- private AnimatedWindow LeftUnitDetailWindow { get; set; }
- private AnimatedWindow LeftUnitStatusWindow { get; set; }
- private AnimatedWindow LeftUnitInventoryWindow { get; set; }
+ private AnimatedRenderable LeftUnitPortraitWindow { get; set; }
+ private AnimatedRenderable LeftUnitDetailWindow { get; set; }
+ private AnimatedRenderable LeftUnitStatusWindow { get; set; }
+ private AnimatedRenderable LeftUnitInventoryWindow { get; set; }
private int RightHoverUnit { get; set; }
- private AnimatedWindow RightUnitPortraitWindow { get; set; }
- private AnimatedWindow RightUnitDetailWindow { get; set; }
- private AnimatedWindow RightUnitStatusWindow { get; set; }
- private AnimatedWindow RightUnitInventoryWindow { get; set; }
+ private AnimatedRenderable RightUnitPortraitWindow { get; set; }
+ private AnimatedRenderable RightUnitDetailWindow { get; set; }
+ private AnimatedRenderable RightUnitStatusWindow { get; set; }
+ private AnimatedRenderable RightUnitInventoryWindow { get; set; }
private int EntityWindowHash { get; set; }
- private AnimatedWindow EntityWindow { get; set; }
+ private AnimatedRenderable EntityWindow { get; set; }
private Window InitiativeWindow { get; set; }
private Window BlueTeamWindow { get; set; }
private Window RedTeamWindow { get; set; }
private Window ObjectiveWindow { get; set; }
+ private static Window TeamInfoWindow => GenerateTeamInfoWindow();
public Window ItemDetailWindow { get; private set; }
private Window UserPromptWindow { get; set; }
- private VerticalMenu ActionMenu { get; set; }
+ private Window MenuHeaderWindow { get; set; }
+ public MenuContext ActionMenuContext { get; private set; }
private Window ActionMenuDescriptionWindow { get; set; }
- private TwoDimensionalMenu InventoryMenu { get; set; }
- private Window InventoryMenuDescriptionWindow { get; set; }
-
- private Window MenuDescriptionWindow { get; set; }
-
private TwoDimensionalMenu AdHocDraftMenu { get; set; }
- private TwoDimensionalMenu StealItemMenu { get; set; }
+ private TwoDimensionalMenu TakeItemMenu { get; set; }
private readonly IRenderable cursorSprite;
private MenuType visibleMenu;
@@ -98,27 +100,18 @@ private MenuType VisibleMenu
switch (value)
{
case MenuType.ActionMenu:
- ActionMenu.IsVisible = true;
- InventoryMenu.IsVisible = false;
- if (StealItemMenu != null) StealItemMenu.IsVisible = false;
- if (AdHocDraftMenu != null) AdHocDraftMenu.IsVisible = false;
- break;
- case MenuType.InventoryMenu:
- ActionMenu.IsVisible = false;
- InventoryMenu.IsVisible = true;
- if (StealItemMenu != null) StealItemMenu.IsVisible = false;
+ ActionMenuContext.CurrentMenu.IsVisible = true;
+ if (TakeItemMenu != null) TakeItemMenu.IsVisible = false;
if (AdHocDraftMenu != null) AdHocDraftMenu.IsVisible = false;
break;
- case MenuType.StealItemMenu:
- ActionMenu.IsVisible = false;
- InventoryMenu.IsVisible = false;
- StealItemMenu.IsVisible = true;
+ case MenuType.TakeItemMenu:
+ ActionMenuContext.CurrentMenu.IsVisible = false;
+ TakeItemMenu.IsVisible = true;
if (AdHocDraftMenu != null) AdHocDraftMenu.IsVisible = false;
break;
case MenuType.DraftMenu:
- ActionMenu.IsVisible = false;
- InventoryMenu.IsVisible = false;
- if (StealItemMenu != null) StealItemMenu.IsVisible = false;
+ ActionMenuContext.CurrentMenu.IsVisible = false;
+ if (TakeItemMenu != null) TakeItemMenu.IsVisible = false;
AdHocDraftMenu.IsVisible = true;
break;
default:
@@ -134,11 +127,9 @@ public IMenu CurrentMenu
switch (VisibleMenu)
{
case MenuType.ActionMenu:
- return ActionMenu;
- case MenuType.InventoryMenu:
- return InventoryMenu;
- case MenuType.StealItemMenu:
- return StealItemMenu;
+ return ActionMenuContext.CurrentMenu;
+ case MenuType.TakeItemMenu:
+ return TakeItemMenu;
case MenuType.DraftMenu:
return AdHocDraftMenu;
default:
@@ -147,27 +138,11 @@ public IMenu CurrentMenu
}
}
- private static IWindowAnimation RightSideWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Left, WindowSlideDistance, WindowSlideSpeed);
-
- private static IWindowAnimation LeftSideWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Right, WindowSlideDistance, WindowSlideSpeed);
-
- public void ToggleCombatMenu()
- {
- switch (VisibleMenu)
- {
- case MenuType.ActionMenu:
- VisibleMenu = MenuType.InventoryMenu;
- break;
- case MenuType.InventoryMenu:
- VisibleMenu = MenuType.ActionMenu;
- break;
- }
+ private static IRenderableAnimation RightSideWindowAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Left, WindowSlideDistance, WindowSlideSpeed);
- Color windowColour = TeamUtility.DetermineTeamColor(GameContext.ActiveUnit.Team);
- GenerateMenuDescriptionWindow(VisibleMenu, windowColour);
- }
+ private static IRenderableAnimation LeftSideWindowAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Right, WindowSlideDistance, WindowSlideSpeed);
#region Close Windows
@@ -183,8 +158,7 @@ public void CloseItemDetailWindow()
public void CloseCombatMenu()
{
- ActionMenu.IsVisible = false;
- InventoryMenu.IsVisible = false;
+ ActionMenuContext.ClearMenuStack();
}
public void CloseAdHocDraftMenu()
@@ -194,32 +168,32 @@ public void CloseAdHocDraftMenu()
public void CloseStealItemMenu()
{
- StealItemMenu = null;
+ TakeItemMenu = null;
}
#endregion Close Windows
#region Generation
- public void GenerateStealItemMenu(GameUnit targetToStealFrom)
+ public void GenerateTakeItemMenu(GameUnit targetToTakeFrom, bool freeAction)
{
- StealItemMenu = new TwoDimensionalMenu(
- GenerateStealOptions(targetToStealFrom),
+ TakeItemMenu = new TwoDimensionalMenu(
+ GenerateTakeOptions(targetToTakeFrom, freeAction),
cursorSprite,
ItemTerrainWindowColor,
TwoDimensionalMenu.CursorType.Pointer
);
- VisibleMenu = MenuType.StealItemMenu;
+ VisibleMenu = MenuType.TakeItemMenu;
}
- private static MenuOption[,] GenerateStealOptions(GameUnit targetToStealFrom)
+ private static MenuOption[,] GenerateTakeOptions(GameUnit targetToTakeFrom, bool freeAction)
{
- List unitInventory = targetToStealFrom.Inventory;
+ List unitInventory = targetToTakeFrom.Inventory;
MenuOption[,] menu = new MenuOption[unitInventory.Count, 1];
for (int i = 0; i < unitInventory.Count; i++)
{
- menu[i, 0] = new StealItemOption(targetToStealFrom, unitInventory[i], ItemTerrainWindowColor);
+ menu[i, 0] = new TakeItemOption(targetToTakeFrom, unitInventory[i], ItemTerrainWindowColor, freeAction);
}
return menu;
@@ -299,41 +273,145 @@ public static Window GenerateItemsWindow(IReadOnlyList items, Color windo
), windowColor);
}
+ private static Window GenerateTeamInfoWindow()
+ {
+ ISpriteFont font = AssetManager.WindowFont;
+
+ Window blueGoldWindow = new Window(
+ new RenderText(font, $"Blue: {GameContext.InitiativeContext.GetGoldForTeam(Team.Blue)}G"),
+ TeamUtility.DetermineTeamColor(Team.Blue));
+
+ Window redGoldWindow = new Window(
+ new RenderText(font, $"Red: {GameContext.InitiativeContext.GetGoldForTeam(Team.Red)}G"),
+ TeamUtility.DetermineTeamColor(Team.Red));
+
+
+ bool blueIsFirst = GameContext.InitiativeContext.TeamWithFewerRemainingUnits() == Team.Blue;
+ IRenderable firstIcon = MiscIconProvider.GetMiscIcon(MiscIcon.First, GameDriver.CellSizeVector);
+ IRenderable secondIcon = MiscIconProvider.GetMiscIcon(MiscIcon.Second, GameDriver.CellSizeVector);
+
+ WindowContentGrid teamGoldWindowContentGrid = new WindowContentGrid(
+ new[,]
+ {
+ {
+ blueIsFirst ? firstIcon : secondIcon,
+ blueGoldWindow,
+ ObjectiveIconProvider.GetObjectiveIcon(
+ VictoryConditions.Taxes,
+ GameDriver.CellSizeVector
+ ),
+ redGoldWindow,
+ blueIsFirst ? secondIcon : firstIcon
+ }
+ },
+ 2,
+ HorizontalAlignment.Centered
+ );
+
+ return new Window(teamGoldWindowContentGrid, BlankTerrainWindowColor);
+ }
+
public void GenerateActionMenus()
{
- Color windowColour = TeamUtility.DetermineTeamColor(GameContext.ActiveUnit.Team);
- GenerateActionMenu(windowColour);
- GenerateInventoryMenu(windowColour);
+ Color windowColor = TeamUtility.DetermineTeamColor(GameContext.ActiveTeam);
+
+ IMenu contextMenu = BuildContextMenu(windowColor);
+
+ List skillOptions = UnitContextualActionMenuContext.ActiveUnitSkillOptions(windowColor);
+ ActionOption basicAttackOption = skillOptions.FirstOrDefault(option => option.Action is BasicAttack);
+ ActionOption waitOption =
+ skillOptions.FirstOrDefault(option => option.Action is Wait || option.Action is Focus);
+ ActionOption roleOption =
+ skillOptions.FirstOrDefault(option => option.Action is Shove || option.Action is Sprint);
+ ActionOption guardOption = skillOptions.FirstOrDefault(option => option.Action is Guard);
+ skillOptions.Remove(basicAttackOption);
+ skillOptions.Remove(waitOption);
+ skillOptions.Remove(roleOption);
+ skillOptions.Remove(guardOption);
+ IMenu skillMenu = BuildSkillMenu(skillOptions, windowColor);
+
+ IMenu inventoryMenu = BuildInventoryMenu(windowColor);
+
+ IMenu actionMenu = BuildActionMenu(contextMenu, windowColor, basicAttackOption, skillMenu, inventoryMenu,
+ roleOption, guardOption, waitOption);
+ ActionMenuContext = new MenuContext(actionMenu);
+
VisibleMenu = MenuType.ActionMenu;
- GenerateMenuDescriptionWindow(VisibleMenu, windowColour);
+ GenerateMenuDescriptionWindow(VisibleMenu, windowColor);
+ }
+
+ private IMenu BuildActionMenu(IMenu contextMenu, Color windowColor, MenuOption basicAttackOption,
+ IMenu skillMenu, IMenu inventoryMenu, MenuOption roleOption, MenuOption guardOption, MenuOption waitOption)
+ {
+ List topLevelOptions = new List();
+
+ if (contextMenu != null)
+ {
+ IRenderable contextMenuIcon = MiscIconProvider.GetMiscIcon(MiscIcon.Context, GameDriver.CellSizeVector);
+ topLevelOptions.Add(new SubmenuOption(contextMenu, contextMenuIcon, "Context",
+ "View extra actions that can be performed based on the environment.", windowColor));
+ }
+
+ if (basicAttackOption != null) topLevelOptions.Add(basicAttackOption);
+
+ if (skillMenu != null)
+ {
+ IRenderable skillMenuIcon = MiscIconProvider.GetMiscIcon(MiscIcon.SkillBook, GameDriver.CellSizeVector);
+ topLevelOptions.Add(new SubmenuOption(skillMenu, skillMenuIcon, "Skills",
+ "View unique actions for this unit.", windowColor));
+ }
+
+ if (inventoryMenu != null)
+ {
+ IRenderable spoilsMenuIcon = MiscIconProvider.GetMiscIcon(MiscIcon.Spoils, GameDriver.CellSizeVector);
+ topLevelOptions.Add(new SubmenuOption(inventoryMenu, spoilsMenuIcon, "Inventory",
+ "Use and manage items in this unit's inventory.", windowColor));
+ }
+
+ if (roleOption != null) topLevelOptions.Add(roleOption);
+ if (guardOption != null) topLevelOptions.Add(guardOption);
+ if (waitOption != null) topLevelOptions.Add(waitOption);
+
+
+ IMenu actionMenu = new VerticalMenu(topLevelOptions.ToArray(), cursorSprite, windowColor);
+ return actionMenu;
+ }
+
+ private IMenu BuildInventoryMenu(Color windowColor)
+ {
+ MenuOption[,] inventoryOptions = UnitContextualActionMenuContext.GenerateInventoryMenuOptions(windowColor);
+ return (inventoryOptions.Length > 0)
+ ? new TwoDimensionalMenu(inventoryOptions, cursorSprite, windowColor,
+ TwoDimensionalMenu.CursorType.Pointer)
+ : null;
}
- private void GenerateActionMenu(Color windowColor)
+ private IMenu BuildSkillMenu(List skillOptions, Color windowColor)
{
- MenuOption[] options = UnitContextualActionMenuContext.GenerateActionMenuOptions(windowColor);
- ActionMenu = new VerticalMenu(options, cursorSprite, windowColor);
+ IMenu skillMenu = null;
+ // ReSharper disable once CoVariantArrayConversion
+ if (skillOptions.Count > 0) skillMenu = new VerticalMenu(skillOptions.ToArray(), cursorSprite, windowColor);
+ return skillMenu;
}
- private void GenerateInventoryMenu(Color windowColor)
+ private IMenu BuildContextMenu(Color windowColor)
{
- MenuOption[,] options = UnitContextualActionMenuContext.GenerateInventoryMenuOptions(windowColor);
- InventoryMenu =
- new TwoDimensionalMenu(options, cursorSprite, windowColor, TwoDimensionalMenu.CursorType.Pointer);
+ // ReSharper disable once CoVariantArrayConversion
+ MenuOption[] contextOptions =
+ UnitContextualActionMenuContext.ActiveUnitContextOptions(windowColor).ToArray();
+ IMenu contextMenu = null;
+ if (contextOptions.Length > 0) contextMenu = new VerticalMenu(contextOptions, cursorSprite, windowColor);
+ return contextMenu;
}
private void GenerateMenuDescriptionWindow(MenuType menuType, Color windowColor)
{
- string menuName;
RenderText windowText;
switch (menuType)
{
case MenuType.ActionMenu:
- menuName = "Unit Actions";
- windowText = new RenderText(AssetManager.HeaderFont, menuName);
- break;
- case MenuType.InventoryMenu:
- menuName = "Inventory";
+ const string menuName = "Unit Actions";
windowText = new RenderText(AssetManager.HeaderFont, menuName);
break;
default:
@@ -341,14 +419,12 @@ private void GenerateMenuDescriptionWindow(MenuType menuType, Color windowColor)
}
- MenuDescriptionWindow = new Window(
+ MenuHeaderWindow = new Window(
new WindowContentGrid(
- new[,]
+ new IRenderable[,]
{
{
- InputIconProvider.GetInputIcon(Input.PreviewUnit, new Vector2(windowText.Height)),
- windowText,
- InputIconProvider.GetInputIcon(Input.PreviewItem, new Vector2(windowText.Height))
+ windowText
}
},
3,
@@ -361,18 +437,11 @@ private void GenerateMenuDescriptionWindow(MenuType menuType, Color windowColor)
public void GenerateCurrentMenuDescription()
{
- Color windowColour = TeamUtility.DetermineTeamColor(GameContext.ActiveUnit.Team);
+ Color windowColor = TeamUtility.DetermineTeamColor(GameContext.ActiveTeam);
- switch (VisibleMenu)
+ if (VisibleMenu == MenuType.ActionMenu)
{
- case MenuType.ActionMenu:
- GenerateActionMenuDescription(windowColour);
- break;
- case MenuType.InventoryMenu:
- GenerateInventoryMenuDescription(windowColour);
- break;
- default:
- throw new ArgumentOutOfRangeException();
+ GenerateActionMenuDescription(windowColor);
}
}
@@ -380,15 +449,7 @@ public void GenerateCurrentMenuDescription()
private void GenerateActionMenuDescription(Color windowColor)
{
ActionMenuDescriptionWindow = new Window(
- UnitContextualActionMenuContext.GetActionDescriptionAtIndex(ActionMenu),
- windowColor
- );
- }
-
- private void GenerateInventoryMenuDescription(Color windowColor)
- {
- InventoryMenuDescriptionWindow = new Window(
- UnitContextualActionMenuContext.GetActionDescriptionAtIndex(InventoryMenu),
+ UnitContextualActionMenuContext.GetActionDescriptionForCurrentMenuOption(ActionMenuContext.CurrentMenu),
windowColor
);
}
@@ -406,7 +467,7 @@ public void SetEntityWindow(MapSlice hoverSlice)
{
if (EntityWindowHash == hoverSlice.GetHashCode()) return;
EntityWindowHash = hoverSlice.GetHashCode();
- EntityWindow = new AnimatedWindow(GenerateEntityWindow(hoverSlice), RightSideWindowAnimation);
+ EntityWindow = new AnimatedRenderable(GenerateEntityWindow(hoverSlice), RightSideWindowAnimation);
}
public static Window GenerateEntityWindow(MapSlice hoverSlice)
@@ -424,7 +485,7 @@ public static Window GenerateEntityWindow(MapSlice hoverSlice)
hoverSlice.TerrainEntity.TerrainInfo,
EntityTerrainWindowColor
) as IRenderable
- : new RenderBlank()
+ : RenderBlank.Blank
},
{
(hoverSlice.ItemEntity != null)
@@ -432,26 +493,25 @@ public static Window GenerateEntityWindow(MapSlice hoverSlice)
hoverSlice.ItemEntity.TerrainInfo,
ItemTerrainWindowColor
) as IRenderable
- : new RenderBlank()
+ : RenderBlank.Blank
}
- },
- 1);
+ });
}
else
{
bool canMove = UnitMovingContext.CanEndMoveAtCoordinates(hoverSlice.MapCoordinates);
WindowContentGrid noEntityContent = new WindowContentGrid(
- new IRenderable[,]
+ new[,]
{
{
new RenderText(AssetManager.WindowFont,
$"[ X: {GameContext.MapCursor.MapCoordinates.X}, Y: {GameContext.MapCursor.MapCoordinates.Y} ]"),
- new RenderBlank()
+ RenderBlank.Blank
},
{
new RenderText(AssetManager.WindowFont, "None"),
- new RenderBlank()
+ RenderBlank.Blank
},
{
UnitStatistics.GetSpriteAtlas(Stats.Mv),
@@ -472,8 +532,7 @@ public static Window GenerateEntityWindow(MapSlice hoverSlice)
BlankTerrainWindowColor
)
}
- },
- 1);
+ });
}
return new Window(terrainContentGrid, new Color(50, 50, 50, 150));
@@ -490,7 +549,7 @@ public void GenerateInitiativeWindow()
GenerateTeamInitiativeWindow(Team.Red);
InitiativeWindow = new Window(
- new WindowContentGrid(new IRenderable[,] {{BlueTeamWindow, RedTeamWindow}}, 1),
+ new WindowContentGrid(new IRenderable[,] {{BlueTeamWindow, RedTeamWindow}}),
Color.Transparent,
HorizontalAlignment.Centered
);
@@ -498,11 +557,9 @@ public void GenerateInitiativeWindow()
private void GenerateTeamInitiativeWindow(Team team)
{
- //TODO figure out if we really want this to be hard-coded or determined based on screen size or something
const int unitsPerRow = 10;
const int initiativeHealthBarHeight = 10;
-
List unitList = GameContext.Units.FindAll(unit => unit.Team == team);
int rows = Convert.ToInt32(Math.Ceiling((float) unitList.Count / unitsPerRow));
@@ -522,7 +579,7 @@ private void GenerateTeamInitiativeWindow(Team team)
}
else
{
- unitListGrid[row, column] = new RenderBlank();
+ unitListGrid[row, column] = RenderBlank.Blank;
}
unitIndex++;
@@ -556,23 +613,23 @@ public static IRenderable SingleUnitContent(GameUnit unit, int initiativeHealthB
{
{
unit.IsCommander
- ? GameUnit.GetCommanderCrown(new Vector2(crownIconSize))
- : new RenderBlank() as IRenderable,
+ ? MiscIconProvider.GetMiscIcon(MiscIcon.Crown, new Vector2(crownIconSize))
+ : RenderBlank.Blank,
new RenderText(AssetManager.MapFont, unit.Id)
},
{
- new RenderBlank(),
+ RenderBlank.Blank,
unit.SmallPortrait
},
{
- new RenderBlank(),
+ RenderBlank.Blank,
unit.IsCommander
? unit.GetInitiativeCommandPointBar(new Vector2(unit.SmallPortrait.Width,
(float) initiativeHealthBarHeight / 2))
- : new RenderBlank() as IRenderable
+ : RenderBlank.Blank
},
{
- new RenderBlank(),
+ RenderBlank.Blank,
unit.GetInitiativeHealthBar(new Vector2(unit.SmallPortrait.Width, initiativeHealthBarHeight))
}
};
@@ -604,14 +661,14 @@ public void UpdateLeftPortraitAndDetailWindows(GameUnit hoverMapUnit)
Window leftUnitStatusWindow = GenerateUnitStatusWindow(hoverMapUnit.StatusEffects, windowColor);
Window leftUnitInventoryWindow = GenerateUnitInventoryWindow(hoverMapUnit.InventoryPane, windowColor);
- LeftUnitPortraitWindow = new AnimatedWindow(leftUnitPortraitWindow, LeftSideWindowAnimation);
- LeftUnitDetailWindow = new AnimatedWindow(leftUnitDetailWindow, LeftSideWindowAnimation);
+ LeftUnitPortraitWindow = new AnimatedRenderable(leftUnitPortraitWindow, LeftSideWindowAnimation);
+ LeftUnitDetailWindow = new AnimatedRenderable(leftUnitDetailWindow, LeftSideWindowAnimation);
LeftUnitStatusWindow = leftUnitStatusWindow != null
- ? new AnimatedWindow(leftUnitStatusWindow, LeftSideWindowAnimation)
+ ? new AnimatedRenderable(leftUnitStatusWindow, LeftSideWindowAnimation)
: null;
LeftUnitInventoryWindow = leftUnitInventoryWindow != null
- ? new AnimatedWindow(leftUnitInventoryWindow, LeftSideWindowAnimation)
+ ? new AnimatedRenderable(leftUnitInventoryWindow, LeftSideWindowAnimation)
: null;
}
}
@@ -637,13 +694,13 @@ public void UpdateRightPortraitAndDetailWindows(GameUnit hoverMapUnit)
Window rightUnitInventoryWindow = GenerateUnitInventoryWindow(hoverMapUnit.InventoryPane, windowColor);
- RightUnitPortraitWindow = new AnimatedWindow(rightUnitPortraitWindow, RightSideWindowAnimation);
- RightUnitDetailWindow = new AnimatedWindow(rightUnitDetailWindow, RightSideWindowAnimation);
+ RightUnitPortraitWindow = new AnimatedRenderable(rightUnitPortraitWindow, RightSideWindowAnimation);
+ RightUnitDetailWindow = new AnimatedRenderable(rightUnitDetailWindow, RightSideWindowAnimation);
RightUnitStatusWindow = rightUnitStatusWindow != null
- ? new AnimatedWindow(rightUnitStatusWindow, RightSideWindowAnimation)
+ ? new AnimatedRenderable(rightUnitStatusWindow, RightSideWindowAnimation)
: null;
RightUnitInventoryWindow = rightUnitInventoryWindow != null
- ? new AnimatedWindow(rightUnitInventoryWindow, RightSideWindowAnimation)
+ ? new AnimatedRenderable(rightUnitInventoryWindow, RightSideWindowAnimation)
: null;
}
}
@@ -687,7 +744,7 @@ private static Window GenerateUnitStatusWindow(IReadOnlyList statu
);
}
- return new Window(new WindowContentGrid(selectedUnitStatuses, 1), windowColor);
+ return new Window(new WindowContentGrid(selectedUnitStatuses), windowColor);
}
private static Window GenerateUnitInventoryWindow(IRenderable inventoryPane, Color windowColor)
@@ -704,17 +761,8 @@ private Vector2 ActionMenuPosition()
{
//Center of screen
return new Vector2(
- GameDriver.ScreenSize.X / 3 - (float) ActionMenu.Width / 2,
- (GameDriver.ScreenSize.Y / 2) - ((float) ActionMenu.Height / 2)
- );
- }
-
- private Vector2 InventoryMenuPosition()
- {
- //Center of screen
- return new Vector2(
- GameDriver.ScreenSize.X / 3 - (float) InventoryMenu.Width / 2,
- (GameDriver.ScreenSize.Y / 2) - ((float) InventoryMenu.Height / 2)
+ GameDriver.ScreenSize.X / 3 - (float) ActionMenuContext.CurrentMenu.Width / 2,
+ (GameDriver.ScreenSize.Y / 2) - ((float) ActionMenuContext.CurrentMenu.Height / 2)
);
}
@@ -722,20 +770,11 @@ private Vector2 ActionMenuDescriptionPosition()
{
//Right of Action Menu
return new Vector2(
- WindowEdgeBuffer + ActionMenuPosition().X + ActionMenu.Width,
+ WindowEdgeBuffer + ActionMenuPosition().X + ActionMenuContext.CurrentMenu.Width,
ActionMenuPosition().Y
);
}
- private Vector2 InventoryMenuDescriptionPosition()
- {
- //Right of Action Menu
- return new Vector2(
- WindowEdgeBuffer + InventoryMenuPosition().X + InventoryMenu.Width,
- InventoryMenuPosition().Y
- );
- }
-
private Vector2 LeftUnitPortraitWindowPosition()
{
//Bottom-left, above initiative window
@@ -756,20 +795,24 @@ private Vector2 LeftUnitDetailWindowPosition()
private Vector2 LeftUnitStatusWindowPosition()
{
- //Bottom-left, above portrait
+ float verticalAnchor = (LeftUnitInventoryWindow == null)
+ ? LeftUnitPortraitWindowPosition().Y
+ : LeftUnitInventoryWindowPosition().Y;
+
+ //Bottom-left, above portrait/inventory
return new Vector2(
LeftUnitPortraitWindowPosition().X,
- LeftUnitPortraitWindowPosition().Y - LeftUnitStatusWindow.Height - WindowEdgeBuffer
+ verticalAnchor - LeftUnitStatusWindow.Height - WindowEdgeBuffer
);
}
private Vector2 LeftUnitInventoryWindowPosition()
{
- //Bottom-left, right of stats
+ //Bottom-left, above stats
return new Vector2(
- LeftUnitDetailWindowPosition().X + LeftUnitDetailWindow.Width + WindowEdgeBuffer,
- LeftUnitDetailWindowPosition().Y
+ LeftUnitDetailWindowPosition().X,
+ LeftUnitDetailWindowPosition().Y - LeftUnitInventoryWindow.Height
);
}
@@ -797,20 +840,24 @@ private Vector2 RightUnitDetailWindowPosition()
private Vector2 RightUnitStatusWindowPosition()
{
- //Bottom-right, above portrait
+ float verticalAnchor = (RightUnitInventoryWindow == null)
+ ? RightUnitPortraitWindowPosition().Y
+ : RightUnitInventoryWindowPosition().Y;
+
+ //Bottom-right, above portrait/inventory
return new Vector2(
RightUnitPortraitWindowPosition().X + RightUnitPortraitWindow.Width - RightUnitStatusWindow.Width,
- RightUnitPortraitWindowPosition().Y - RightUnitStatusWindow.Height - WindowEdgeBuffer
+ verticalAnchor - RightUnitStatusWindow.Height - WindowEdgeBuffer
);
}
private Vector2 RightUnitInventoryWindowPosition()
{
- //Bottom-left, right of stats
+ //Bottom-left, above stats
return new Vector2(
- RightUnitDetailWindowPosition().X - RightUnitInventoryWindow.Width - WindowEdgeBuffer,
- RightUnitDetailWindowPosition().Y
+ RightUnitDetailWindowPosition().X + RightUnitDetailWindow.Width - RightUnitInventoryWindow.Width,
+ RightUnitDetailWindowPosition().Y - RightUnitInventoryWindow.Height
);
}
@@ -833,6 +880,15 @@ private Vector2 EntityWindowPosition()
);
}
+ private Vector2 GoldWindowPosition()
+ {
+ //Center, above initiative list
+ return new Vector2(
+ GameDriver.ScreenSize.X / 2 - (float) TeamInfoWindow.Width / 2,
+ InitiativeWindowPosition().Y - TeamInfoWindow.Height
+ );
+ }
+
private Vector2 ObjectiveWindowPosition()
{
//Top-left
@@ -856,7 +912,7 @@ private Vector2 AdHocDraftMenuPosition()
private Vector2 SteamItemMenuPosition()
{
- return CenterItemOnScreen(StealItemMenu);
+ return CenterItemOnScreen(TakeItemMenu);
}
private static Vector2 CenterItemOnScreen(IRenderable item)
@@ -869,7 +925,7 @@ private static Vector2 CenterItemOnScreen(IRenderable item)
private Vector2 MenuDescriptionWindowPosition(Vector2 menuPosition)
{
- return menuPosition - new Vector2(0, MenuDescriptionWindow.Height);
+ return menuPosition - new Vector2(0, MenuHeaderWindow.Height);
}
#endregion Window Positions
@@ -886,6 +942,7 @@ public void Draw(SpriteBatch spriteBatch)
if (InitiativeWindow != null)
{
InitiativeWindow.Draw(spriteBatch, InitiativeWindowPosition());
+ TeamInfoWindow?.Draw(spriteBatch, GoldWindowPosition());
if (LeftUnitPortraitWindow != null)
{
@@ -907,30 +964,20 @@ public void Draw(SpriteBatch spriteBatch)
UserPromptWindow?.Draw(spriteBatch, UserPromptWindowPosition());
}
- if (ActionMenu != null)
+ if (ActionMenuContext?.CurrentMenu != null)
{
- ActionMenu.Draw(spriteBatch, ActionMenuPosition());
+ ActionMenuContext.CurrentMenu.Draw(spriteBatch, ActionMenuPosition());
- if (ActionMenu.IsVisible)
+ if (ActionMenuContext.CurrentMenu.IsVisible)
{
ActionMenuDescriptionWindow?.Draw(spriteBatch, ActionMenuDescriptionPosition());
- MenuDescriptionWindow?.Draw(spriteBatch, MenuDescriptionWindowPosition(ActionMenuPosition()));
- }
- }
-
- if (InventoryMenu != null)
- {
- InventoryMenu.Draw(spriteBatch, InventoryMenuPosition());
- if (InventoryMenu.IsVisible)
- {
- InventoryMenuDescriptionWindow?.Draw(spriteBatch, InventoryMenuDescriptionPosition());
- MenuDescriptionWindow?.Draw(spriteBatch, MenuDescriptionWindowPosition(InventoryMenuPosition()));
+ MenuHeaderWindow?.Draw(spriteBatch, MenuDescriptionWindowPosition(ActionMenuPosition()));
}
}
ObjectiveWindow?.Draw(spriteBatch, ObjectiveWindowPosition());
AdHocDraftMenu?.Draw(spriteBatch, AdHocDraftMenuPosition());
- StealItemMenu?.Draw(spriteBatch, SteamItemMenuPosition());
+ TakeItemMenu?.Draw(spriteBatch, SteamItemMenuPosition());
}
}
}
\ No newline at end of file
diff --git a/SolStandard/Containers/View/MapSelectScreenView.cs b/SolStandard/Containers/View/MapSelectScreenView.cs
index eb6090b0..b49785c8 100644
--- a/SolStandard/Containers/View/MapSelectScreenView.cs
+++ b/SolStandard/Containers/View/MapSelectScreenView.cs
@@ -14,7 +14,7 @@ namespace SolStandard.Containers.View
public class MapSelectScreenView : IUserInterface
{
private Window instructionWindow;
- private AnimatedWindow mapInfoWindow;
+ private AnimatedRenderable mapInfoWindow;
private Window teamSelectWindow;
private const int WindowSlideSpeed = 40;
@@ -32,8 +32,8 @@ public MapSelectScreenView()
SetUpWindows();
}
- private static IWindowAnimation LeftSideWindowAnimation =>
- new WindowSlide(WindowSlide.SlideDirection.Right, WindowSlideDistance, WindowSlideSpeed);
+ private static IRenderableAnimation LeftSideWindowAnimation =>
+ new RenderableSlide(RenderableSlide.SlideDirection.Right, WindowSlideDistance, WindowSlideSpeed);
private void SetUpWindows()
{
@@ -46,8 +46,8 @@ private void SetUpWindows()
new RenderText(AssetManager.WindowFont,
"Select a map! Move the cursor to the crossed swords and press "),
InputIconProvider.GetInputIcon(Input.Confirm, iconSize),
- new RenderBlank(),
- new RenderBlank(),
+ RenderBlank.Blank,
+ RenderBlank.Blank,
},
{
new RenderText(AssetManager.WindowFont, "Toggle between maps with"),
@@ -55,15 +55,14 @@ private void SetUpWindows()
new RenderText(AssetManager.WindowFont, "and"),
InputIconProvider.GetInputIcon(Input.TabRight, iconSize),
}
- },
- 1
+ }
);
instructionWindow = new Window(instructionContentGrid, InstructionWindowColor);
mapInfoWindow =
- new AnimatedWindow(new Window(new RenderBlank(), MapInfoWindowColor), LeftSideWindowAnimation);
+ new AnimatedRenderable(new Window(RenderBlank.Blank, MapInfoWindowColor), LeftSideWindowAnimation);
}
public void UpdateTeamSelectWindow()
@@ -132,7 +131,7 @@ public void UpdateMapInfoWindow(IRenderable terrainInfo)
{
mapInfoWindow = terrainInfo == null
? null
- : new AnimatedWindow(new Window(terrainInfo, MapInfoWindowColor, HorizontalAlignment.Right),
+ : new AnimatedRenderable(new Window(terrainInfo, MapInfoWindowColor, HorizontalAlignment.Right),
LeftSideWindowAnimation);
}
diff --git a/SolStandard/Containers/View/StatusScreenView.cs b/SolStandard/Containers/View/StatusScreenView.cs
index c031ddfb..9fffadb2 100644
--- a/SolStandard/Containers/View/StatusScreenView.cs
+++ b/SolStandard/Containers/View/StatusScreenView.cs
@@ -73,7 +73,7 @@ private void GenerateBlueTeamLeaderPortraitWindow()
IRenderable[,] blueLeaderContent = LeaderContent(FindTeamLeader(Team.Blue));
BlueTeamLeaderPortrait = new Window(
- new WindowContentGrid(blueLeaderContent, 1),
+ new WindowContentGrid(blueLeaderContent),
TeamUtility.DetermineTeamColor(Team.Blue)
);
}
@@ -95,8 +95,7 @@ private void GenerateBlueTeamResultWindow(string windowText)
{
new RenderText(AssetManager.ResultsFont, windowText)
}
- },
- 1
+ }
),
TeamUtility.DetermineTeamColor(Team.Blue)
);
@@ -107,7 +106,7 @@ private void GenerateRedTeamLeaderPortraitWindow()
IRenderable[,] redLeaderContent = LeaderContent(FindTeamLeader(Team.Red));
RedTeamLeaderPortrait = new Window(
- new WindowContentGrid(redLeaderContent, 1),
+ new WindowContentGrid(redLeaderContent),
TeamUtility.DetermineTeamColor(Team.Red)
);
}
@@ -129,8 +128,7 @@ private void GenerateRedTeamResultWindow(string windowText)
{
new RenderText(AssetManager.ResultsFont, windowText)
}
- },
- 1
+ }
),
TeamUtility.DetermineTeamColor(Team.Red)
);
@@ -174,30 +172,29 @@ private static GameUnit FindTeamLeader(Team team)
{
{
unit.IsCommander
- ? GameUnit.GetCommanderCrown(new Vector2(crownIconSize))
- : new RenderBlank() as IRenderable,
+ ? MiscIconProvider.GetMiscIcon(MiscIcon.Crown, new Vector2(crownIconSize))
+ : RenderBlank.Blank,
new RenderText(AssetManager.WindowFont, unit.Id)
},
{
- new RenderBlank(),
+ RenderBlank.Blank,
portraitToUse
},
{
- new RenderBlank(),
+ RenderBlank.Blank,
unit.GetResultsHealthBar(new Vector2(portraitToUse.Width, unitListHealthBarHeight))
},
{
- new RenderBlank(),
+ RenderBlank.Blank,
new Window(
new WindowContentGrid(
new IRenderable[,]
{
{
- new SpriteAtlas(AssetManager.GoldIcon, GameDriver.CellSizeVector),
- new RenderText(AssetManager.WindowFont, unit.CurrentGold + "G")
+ MiscIconProvider.GetMiscIcon(MiscIcon.Gold, GameDriver.CellSizeVector),
+ new RenderText(AssetManager.WindowFont, unit.CurrentBounty + "G")
}
- },
- 1
+ }
),
TeamUtility.DetermineTeamColor(unit.Team)
)
diff --git a/SolStandard/Content/Content.mgcb b/SolStandard/Content/Content.mgcb
index 2122f03f..7ec066ee 100644
--- a/SolStandard/Content/Content.mgcb
+++ b/SolStandard/Content/Content.mgcb
@@ -1732,6 +1732,30 @@
/processorParam:TextureFormat=Color
/build:Graphics/Images/Dice/AttackDiceAtlas.png
+#begin Graphics/Images/Icons/Misc/1st.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Graphics/Images/Icons/Misc/1st.png
+
+#begin Graphics/Images/Icons/Misc/2nd.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Graphics/Images/Icons/Misc/2nd.png
+
#begin Graphics/Images/Icons/Misc/AuraAttack.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -1816,6 +1840,18 @@
/processorParam:TextureFormat=Color
/build:Graphics/Images/Icons/Misc/CommanderCrown.png
+#begin Graphics/Images/Icons/Misc/Context.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Graphics/Images/Icons/Misc/Context.png
+
#begin Graphics/Images/Icons/Misc/Damage.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -1900,6 +1936,18 @@
/processorParam:TextureFormat=Color
/build:Graphics/Images/Icons/Misc/IceTrap.png
+#begin Graphics/Images/Icons/Misc/Independent.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Graphics/Images/Icons/Misc/Independent.png
+
#begin Graphics/Images/Icons/Misc/Interact.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -1996,6 +2044,18 @@
/processorParam:TextureFormat=Color
/build:Graphics/Images/Icons/Misc/RecoverHealth.png
+#begin Graphics/Images/Icons/Misc/SkillBook.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Graphics/Images/Icons/Misc/SkillBook.png
+
#begin Graphics/Images/Icons/Misc/SongAura.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -3772,6 +3832,18 @@
/processorParam:TextureFormat=Color
/build:Graphics/Map/MapPreviews/Draft_Grassland_01.png
+#begin Graphics/Map/MapPreviews/Draft_Grassland_02.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Graphics/Map/MapPreviews/Draft_Grassland_02.png
+
#begin Graphics/Map/MapPreviews/Draft_Hiatok_Fortress.png
/importer:TextureImporter
/processor:TextureProcessor
diff --git a/SolStandard/Content/TmxMaps/00_DRAFT_TEMPLATE.tmx b/SolStandard/Content/TmxMaps/00_DRAFT_TEMPLATE.tmx
index b4bd8184..aef1101e 100644
--- a/SolStandard/Content/TmxMaps/00_DRAFT_TEMPLATE.tmx
+++ b/SolStandard/Content/TmxMaps/00_DRAFT_TEMPLATE.tmx
@@ -1,5 +1,5 @@
-