├── SolStandard ├── solstandard.ico ├── .gitignore ├── Entity │ ├── Unit │ │ ├── Actions │ │ │ ├── ICommandAction.cs │ │ │ ├── ITurnProc.cs │ │ │ ├── IIncrementableAction.cs │ │ │ ├── ICombatProc.cs │ │ │ ├── IRoutine.cs │ │ │ ├── Rogue │ │ │ │ ├── Rend.cs │ │ │ │ └── ThrowingKnife.cs │ │ │ ├── Duelist │ │ │ │ └── CorpsACorps.cs │ │ │ ├── Archer │ │ │ │ ├── PoisonArrow.cs │ │ │ │ └── HuntingTrap.cs │ │ │ ├── Bard │ │ │ │ └── SongAction.cs │ │ │ ├── Wait.cs │ │ │ └── Pugilist │ │ │ │ └── Meditate.cs │ │ └── Statuses │ │ │ ├── Creep │ │ │ ├── NextRoutineStatus.cs │ │ │ └── IndependentStatus.cs │ │ │ ├── ImmovableStatus.cs │ │ │ ├── RetributionStatUp.cs │ │ │ ├── RetributionStatDown.cs │ │ │ ├── AtkStatDown.cs │ │ │ ├── AtkStatUp.cs │ │ │ ├── BlkStatUp.cs │ │ │ ├── LuckStatUp.cs │ │ │ └── StatusEffect.cs │ ├── IRemotelyTriggerable.cs │ ├── ILockable.cs │ ├── IThreatRange.cs │ ├── General │ │ ├── Item │ │ │ ├── IConsumable.cs │ │ │ ├── Barricade.cs │ │ │ ├── LadderBridge.cs │ │ │ └── Relic.cs │ │ ├── Decoration.cs │ │ ├── Movable.cs │ │ ├── DeployTile.cs │ │ ├── CreepDeployTile.cs │ │ ├── RecallPoint.cs │ │ ├── PushBlock.cs │ │ ├── EscapeEntity.cs │ │ ├── Portal.cs │ │ ├── Railgun.cs │ │ └── Artillery.cs │ ├── IOpenable.cs │ ├── ITriggerable.cs │ ├── IActionTile.cs │ ├── GameEntity.cs │ ├── IItem.cs │ └── IEffectTile.cs ├── HUD │ ├── Window │ │ ├── IWindow.cs │ │ ├── Content │ │ │ ├── Combat │ │ │ │ └── ICombatPoint.cs │ │ │ ├── Health │ │ │ │ ├── IResourcePoint.cs │ │ │ │ └── IHealthBar.cs │ │ │ ├── RenderBlank.cs │ │ │ └── RenderText.cs │ │ ├── Animation │ │ │ ├── IRenderableAnimation.cs │ │ │ └── RenderableStatic.cs │ │ ├── HudNotification.cs │ │ └── AnimatedRenderable.cs │ └── Menu │ │ ├── IOptionDescription.cs │ │ ├── Options │ │ ├── ActionMenu │ │ │ └── ItemActionOption.cs │ │ ├── MainMenu │ │ │ ├── CreditsOption.cs │ │ │ ├── QuitGameOption.cs │ │ │ ├── HostGameOption.cs │ │ │ ├── HowToPlayOption.cs │ │ │ ├── JoinGameOption.cs │ │ │ ├── NewGameOption.cs │ │ │ ├── OpenCodexOption.cs │ │ │ └── MainMenuConfigOption.cs │ │ ├── PauseMenu │ │ │ ├── ContinueOption.cs │ │ │ ├── ConfigMenu │ │ │ │ ├── MusicVolumeUpOption.cs │ │ │ │ ├── MusicVolumeDownOption.cs │ │ │ │ ├── ToggleFullscreenOption.cs │ │ │ │ ├── MusicMuteOption.cs │ │ │ │ ├── CreepDisableOption.cs │ │ │ │ ├── SoundEffectMuteOption.cs │ │ │ │ └── ReturnToPauseMenuOption.cs │ │ │ ├── ControlsMenu │ │ │ │ ├── OpenControlsMenuOption.cs │ │ │ │ ├── SaveControllerOption.cs │ │ │ │ ├── DeviceSelectOption.cs │ │ │ │ └── ResetControllerConfigOption.cs │ │ │ ├── ConfigOption.cs │ │ │ └── ConcedeOption.cs │ │ ├── UnselectableOption.cs │ │ ├── DialMenu │ │ │ ├── CopyIPAddressOption.cs │ │ │ ├── PasteIPAddressOption.cs │ │ │ ├── ConnectOption.cs │ │ │ ├── BackspaceOption.cs │ │ │ ├── CharacterOption.cs │ │ │ └── MainMenuOption.cs │ │ └── SubmenuOption.cs │ │ ├── IMenu.cs │ │ └── MenuContext.cs ├── Utility │ ├── IRotatable.cs │ ├── Events │ │ ├── IEvent.cs │ │ ├── WaitActionEvent.cs │ │ ├── Network │ │ │ ├── CancelMoveEvent.cs │ │ │ ├── SelectMapEvent.cs │ │ │ ├── AdhocDraftEvent.cs │ │ │ ├── FinishMovingEvent.cs │ │ │ ├── NextMapEvent.cs │ │ │ ├── ContinueCombatEvent.cs │ │ │ ├── DeployUnitEvent.cs │ │ │ ├── ExecuteActionEvent.cs │ │ │ ├── SelectUnitEvent.cs │ │ │ ├── CancelActionMenuEvent.cs │ │ │ ├── CloseAdHocDraftMenuEvent.cs │ │ │ ├── PreviousMapEvent.cs │ │ │ ├── CancelActionTargetingEvent.cs │ │ │ ├── DeploySelectNextUnitEvent.cs │ │ │ ├── DraftConfirmSelectionEvent.cs │ │ │ ├── SelectActionMenuOptionEvent.cs │ │ │ ├── DeploySelectPreviousUnitEvent.cs │ │ │ ├── DeployResetToNextDeploymentTileEvent.cs │ │ │ ├── NetworkEvent.cs │ │ │ ├── ResolveNetworkTurnEvent.cs │ │ │ ├── ResetCursorToActiveUnitEvent.cs │ │ │ ├── ResetCursorToNextUnitEvent.cs │ │ │ ├── ResetCursorToPreviousUnitEvent.cs │ │ │ ├── AdHocEvent.cs │ │ │ ├── ChangePlayerTeamsEvent.cs │ │ │ ├── DraftMenuMoveEvent.cs │ │ │ ├── DecrementCurrentAdjustableActionEvent.cs │ │ │ ├── IncrementCurrentAdjustableActionEvent.cs │ │ │ ├── MoveActionMenuEvent.cs │ │ │ ├── InitializeRandomizerNet.cs │ │ │ ├── ResetGameEvent.cs │ │ │ ├── MapPingEvent.cs │ │ │ ├── SpawnUnitEvent.cs │ │ │ ├── MoveMapCursorAndUnitEvent.cs │ │ │ ├── MoveMapCursorEvent.cs │ │ │ ├── ConcedeEvent.cs │ │ │ └── CombatNotifyStateCompleteEvent.cs │ │ ├── PreviewUnitSkillsEvent.cs │ │ ├── HideUnitEvent.cs │ │ ├── UnhideUnitEvent.cs │ │ ├── ReadyAIRoutineEvent.cs │ │ ├── PlaySoundEffectEvent.cs │ │ ├── TriggerEntityEvent.cs │ │ ├── AI │ │ │ ├── CreepTriggerTileEvent.cs │ │ │ ├── SpawnCreepEvent.cs │ │ │ ├── CreepMoveEvent.cs │ │ │ └── CreepEndTurnEvent.cs │ │ ├── EscapeObjectiveEvent.cs │ │ ├── PlayEntityAnimationOnceEvent.cs │ │ ├── FirstTurnOfNewRoundEvent.cs │ │ ├── WaitFramesEvent.cs │ │ ├── DeleteItemEvent.cs │ │ ├── BankDepositEvent.cs │ │ ├── RemoveExpiredEffectTilesEvent.cs │ │ ├── BankWithdrawEvent.cs │ │ ├── UpdateStatusEffectEvent.cs │ │ ├── RegenerateArmorEvent.cs │ │ ├── BlinkCoordinatesEvent.cs │ │ ├── MoveEntityToCoordinatesEvent.cs │ │ ├── ToggleOpenEvent.cs │ │ ├── EffectTilesStartOfRoundEvent.cs │ │ ├── PlayAnimationAtCoordinatesEvent.cs │ │ ├── AdditionalActionEvent.cs │ │ ├── RemoveEntityFromMapEvent.cs │ │ ├── IncreaseTeamGoldEvent.cs │ │ ├── DecreaseTeamGoldEvent.cs │ │ ├── PullEvent.cs │ │ ├── ShoveEvent.cs │ │ ├── RegenerateHealthEvent.cs │ │ ├── CameraCursorPositionEvent.cs │ │ ├── ToastAtCursorEvent.cs │ │ ├── CastStatusEffectEvent.cs │ │ ├── CenterScreenRenderableEvent.cs │ │ ├── EndTurnEvent.cs │ │ ├── TriggerSingleEffectTileEvent.cs │ │ ├── SkippableWaitFramesEvent.cs │ │ ├── ToastAtCoordinatesEvent.cs │ │ ├── StartCombatEvent.cs │ │ └── PlaceEntityOnMapEvent.cs │ ├── Exceptions │ │ ├── TileNotFoundException.cs │ │ ├── InvalidTeamException.cs │ │ ├── TeamNotFoundException.cs │ │ ├── InvalidCellIndexException.cs │ │ ├── ScenarioNotFoundException.cs │ │ ├── CellNotFoundException.cs │ │ ├── DuplicateInputException.cs │ │ ├── UnitClassNotFoundException.cs │ │ ├── OutOfRangeException.cs │ │ ├── ItemNotFoundException.cs │ │ ├── InvalidTimeEstimateException.cs │ │ ├── InvalidShapeException.cs │ │ ├── ZeroOneRangeException.cs │ │ └── VendorMisconfiguredException.cs │ ├── IResizable.cs │ ├── HUD │ │ ├── Directions │ │ │ ├── CardinalDirection.cs │ │ │ └── IntercardinalDirection.cs │ │ ├── Juice │ │ │ ├── JuiceBoxUtils.cs │ │ │ ├── ScaleSmoother.cs │ │ │ ├── SizeSmoother.cs │ │ │ ├── CameraSmoother.cs │ │ │ ├── MoveSmoother.cs │ │ │ └── ColorShifter.cs │ │ └── Neo │ │ │ └── WindowContentExtensions.cs │ ├── System │ │ ├── IFileIO.cs │ │ └── TemporaryFilesIO.cs │ ├── Monogame │ │ ├── ISoundEffect.cs │ │ ├── ISpriteFont.cs │ │ ├── IPlayableAudio.cs │ │ ├── ITexture2D.cs │ │ ├── SpriteFontWrapper.cs │ │ ├── Texture2DWrapper.cs │ │ └── SongWrapper.cs │ ├── Collections │ │ ├── MutableKeyValuePair.cs │ │ └── CollectionExtensions.cs │ ├── Inputs │ │ ├── VoidInput.cs │ │ ├── GameControl.cs │ │ ├── MultiControlParser.cs │ │ └── IController.cs │ ├── AdHocThreatRange.cs │ ├── ArrayDeepCopier.cs │ ├── SpriteResizer.cs │ ├── IRenderable.cs │ ├── Assets │ │ ├── TeamIconProvider.cs │ │ ├── ObjectiveIconProvider.cs │ │ └── InputIconProvider.cs │ ├── MathUtils.cs │ ├── Randomizer.cs │ ├── ArrayToList.cs │ ├── TeamUtility.cs │ ├── UnitSelector.cs │ ├── RangeComparison.cs │ └── GlobalAsyncActions.cs ├── Map │ ├── Elements │ │ ├── Direction.cs │ │ ├── MapTile.cs │ │ └── MapEntity.cs │ ├── MapInfo.cs │ └── Camera │ │ ├── IMapCamera.cs │ │ └── MoveSmoother.cs ├── Containers │ ├── IUserInterface.cs │ ├── Components │ │ ├── SplashScreen │ │ │ └── SplashScreenContext.cs │ │ ├── Global │ │ │ ├── BonusStatistics.cs │ │ │ ├── CreepPreferences.cs │ │ │ └── StaticBackgroundView.cs │ │ └── EULA │ │ │ └── EULAContext.cs │ └── Scenario │ │ └── Objectives │ │ └── Surrender.cs ├── README.txt └── SolStandardCore.sln ├── .gitignore ├── SolStandardTest ├── Utility │ └── Monogame │ │ └── FakeTexture2D.cs ├── SolStandardTest.csproj └── HUD │ └── Window │ └── Content │ └── Health │ └── FakeResourceBar.cs └── SolStandard.sln.DotSettings /SolStandard/solstandard.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Talberon/solstandard/HEAD/SolStandard/solstandard.ico -------------------------------------------------------------------------------- /SolStandard/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | .vs/ 3 | obj/ 4 | app.manifest/ 5 | packages/ 6 | Content/ 7 | libSDL2-2.dylib 8 | deploy.sh -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | obj/ 3 | app.manifest/ 4 | packages/ 5 | .idea/ 6 | TestResults/ 7 | sol-standard-web/ 8 | RELEASE/ 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/ICommandAction.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity.Unit.Actions 2 | { 3 | public interface ICommandAction 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /SolStandard/Entity/IRemotelyTriggerable.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity 2 | { 3 | public interface IRemotelyTriggerable 4 | { 5 | void RemoteTrigger(); 6 | } 7 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/IWindow.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility; 2 | 3 | namespace SolStandard.HUD.Window 4 | { 5 | public interface IWindow : IRenderable 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /SolStandard/Utility/IRotatable.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility 2 | { 3 | public interface IRotatable 4 | { 5 | float RotationInDegrees { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /SolStandard/Entity/ILockable.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity 2 | { 3 | public interface ILockable 4 | { 5 | bool IsLocked { get; } 6 | 7 | void ToggleLock(); 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Entity/IThreatRange.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity 2 | { 3 | public interface IThreatRange 4 | { 5 | int[] AtkRange { get; } 6 | int MvRange { get; } 7 | } 8 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/IEvent.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.Events 2 | { 3 | public interface IEvent 4 | { 5 | bool Complete { get; } 6 | void Continue(); 7 | } 8 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/TileNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | public class TileNotFoundException : Exception 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/ITurnProc.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity.Unit.Actions 2 | { 3 | public interface ITurnProc 4 | { 5 | void OnTurnStart(); 6 | void OnTurnEnd(); 7 | } 8 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/InvalidTeamException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | public class InvalidTeamException : Exception 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/TeamNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | public class TeamNotFoundException : Exception 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Utility/IResizable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility 4 | { 5 | public interface IResizable 6 | { 7 | IRenderable Resize(Vector2 newSize); 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/IOptionDescription.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility; 2 | 3 | namespace SolStandard.HUD.Menu 4 | { 5 | public interface IOptionDescription 6 | { 7 | IRenderable Description { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Map/Elements/Direction.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Map.Elements 2 | { 3 | public enum Direction 4 | { 5 | None, 6 | Up, 7 | Right, 8 | Down, 9 | Left 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/InvalidCellIndexException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | [Serializable] 6 | public class InvalidCellIndexException : Exception 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/ScenarioNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | [Serializable] 6 | public class ScenarioNotFoundException : Exception 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Containers/IUserInterface.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace SolStandard.Containers 4 | { 5 | public interface IUserInterface 6 | { 7 | void Draw(SpriteBatch spriteBatch); 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/CellNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | 6 | [Serializable] 7 | internal class CellNotFoundException : Exception 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Item/IConsumable.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | 3 | namespace SolStandard.Entity.General.Item 4 | { 5 | public interface IConsumable : IItem 6 | { 7 | void Consume(GameUnit targetUnit); 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/DuplicateInputException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | [Serializable] 6 | public class DuplicateInputException : Exception 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Entity/IOpenable.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity 2 | { 3 | public interface IOpenable 4 | { 5 | bool IsOpen { get; } 6 | bool IsObstructed { get; } 7 | void Open(); 8 | void Close(); 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/UnitClassNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | [Serializable] 6 | public class UnitClassNotFoundException : Exception 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Directions/CardinalDirection.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.HUD.Directions 2 | { 3 | //4-Directional 4 | public enum CardinalDirection 5 | { 6 | North, 7 | South, 8 | West, 9 | East 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/Utility/System/IFileIO.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.System 2 | { 3 | public interface IFileIO 4 | { 5 | void Save(string fileName, object content); 6 | T Load(string fileName); 7 | bool FileExists(string fileName); 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Content/Combat/ICombatPoint.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.HUD.Window.Content.Combat 4 | { 5 | public interface ICombatPoint 6 | { 7 | bool Enabled { get; } 8 | void Disable(Color disabledColor); 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/ISoundEffect.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Audio; 2 | 3 | namespace SolStandard.Utility.Monogame 4 | { 5 | public interface ISoundEffect : IPlayableAudio 6 | { 7 | void Play(); 8 | SoundEffect MonoGameSoundEffect { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/IIncrementableAction.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity.Unit.Actions 2 | { 3 | public interface IIncrementableAction 4 | { 5 | int Value { get; } 6 | void Increment(int amountToIncrement); 7 | void Decrement(int amountToDecrement); 8 | } 9 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/OutOfRangeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | public class OutOfRangeException : Exception 6 | { 7 | public OutOfRangeException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Animation/IRenderableAnimation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.HUD.Window.Animation 4 | { 5 | public interface IRenderableAnimation 6 | { 7 | void Update(Vector2 destination); 8 | Vector2 CurrentPosition { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/ItemNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | public class ItemNotFoundException : Exception 6 | { 7 | public ItemNotFoundException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Content/Health/IResourcePoint.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.HUD.Window.Content.Health 5 | { 6 | public interface IResourcePoint : IRenderable 7 | { 8 | bool Active { get; set; } 9 | Vector2 Size { set; } 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/ISpriteFont.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace SolStandard.Utility.Monogame 5 | { 6 | public interface ISpriteFont 7 | { 8 | Vector2 MeasureString(string text); 9 | SpriteFont MonoGameSpriteFont { get; } 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Content/Health/IHealthBar.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.HUD.Window.Content.Health 5 | { 6 | public interface IHealthBar : IRenderable 7 | { 8 | Vector2 BarSize { set; } 9 | void SetArmorAndHp(int armor, int hp); 10 | } 11 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/IPlayableAudio.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.Monogame 2 | { 3 | public interface IPlayableAudio 4 | { 5 | string Name { get; } 6 | float Volume { get; set; } 7 | void PlayOnce(); 8 | void PlayLoop(); 9 | void Pause(); 10 | void Stop(); 11 | } 12 | } -------------------------------------------------------------------------------- /SolStandard/Entity/ITriggerable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Entity 4 | { 5 | public interface ITriggerable 6 | { 7 | string Name { get; } 8 | Vector2 MapCoordinates { get; } 9 | bool CanTrigger { get; } 10 | int[] InteractRange { get; } 11 | void Trigger(); 12 | } 13 | } -------------------------------------------------------------------------------- /SolStandard/Map/MapInfo.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Map 2 | { 3 | public class MapInfo 4 | { 5 | public string Title { get; } 6 | public string FileName { get; } 7 | 8 | 9 | public MapInfo(string title, string fileName) 10 | { 11 | Title = title; 12 | FileName = fileName; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Directions/IntercardinalDirection.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.HUD.Directions 2 | { 3 | //8-Directional 4 | public enum IntercardinalDirection 5 | { 6 | North, 7 | NorthEast, 8 | East, 9 | SouthEast, 10 | South, 11 | SouthWest, 12 | West, 13 | NorthWest 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Entity/IActionTile.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit.Actions; 4 | 5 | namespace SolStandard.Entity 6 | { 7 | public interface IActionTile 8 | { 9 | int[] InteractRange { get; } 10 | Vector2 MapCoordinates { get; } 11 | List TileActions(); 12 | } 13 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/ITexture2D.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Graphics; 2 | 3 | namespace SolStandard.Utility.Monogame 4 | { 5 | /** 6 | * ITexture2D 7 | * 8 | */ 9 | public interface ITexture2D 10 | { 11 | int Width { get; } 12 | int Height { get; } 13 | string Name { get; } 14 | Texture2D MonoGameTexture { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Decoration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Entity.General 5 | { 6 | public class Decoration : TerrainEntity 7 | { 8 | public Decoration(string name, string type, IRenderable sprite, Vector2 mapCoordinates) : base(name, type, 9 | sprite, mapCoordinates) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/WaitActionEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility.Assets; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class WaitActionEvent : IEvent 6 | { 7 | public bool Complete { get; private set; } 8 | 9 | public void Continue() 10 | { 11 | AssetManager.MapUnitSelectSFX.Play(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Collections/MutableKeyValuePair.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.Collections 2 | { 3 | public class MutableKeyValuePair 4 | { 5 | public TKey Key { get; } 6 | public TValue Value { get; set; } 7 | 8 | public MutableKeyValuePair(TKey key, TValue value) 9 | { 10 | Key = key; 11 | Value = value; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/ICombatProc.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Entity.Unit.Actions 2 | { 3 | public interface ICombatProc 4 | { 5 | void OnCombatStart(GameUnit attacker, GameUnit defender); 6 | void OnBlock(GameUnit damageDealer, GameUnit target); 7 | void OnDamage(GameUnit damageDealer, GameUnit target); 8 | void OnCombatEnd(GameUnit attacker, GameUnit defender); 9 | } 10 | } -------------------------------------------------------------------------------- /SolStandard/Entity/GameEntity.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Map.Elements; 2 | 3 | namespace SolStandard.Entity 4 | { 5 | public abstract class GameEntity 6 | { 7 | protected MapEntity MapEntity; 8 | 9 | protected GameEntity(string id, MapEntity mapEntity) 10 | { 11 | Id = id; 12 | MapEntity = mapEntity; 13 | } 14 | 15 | public string Id { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Inputs/VoidInput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.HUD.Window.Content; 3 | 4 | namespace SolStandard.Utility.Inputs 5 | { 6 | [Serializable] 7 | public class VoidInput : GameControl 8 | { 9 | public override bool Pressed => false; 10 | 11 | public override IRenderable GetInputIcon(int iconSize) 12 | { 13 | return RenderBlank.Blank; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SolStandard/Utility/AdHocThreatRange.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity; 2 | 3 | namespace SolStandard.Utility 4 | { 5 | public class AdHocThreatRange : IThreatRange 6 | { 7 | public int[] AtkRange { get; } 8 | public int MvRange { get; } 9 | 10 | public AdHocThreatRange(int[] atkRange, int mvRange) 11 | { 12 | AtkRange = atkRange; 13 | MvRange = mvRange; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/CancelMoveEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class CancelMoveEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.CancelMove(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/SelectMapEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class SelectMapEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.MapSelectContext.SelectMap(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Entity/IItem.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit.Actions; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Entity 5 | { 6 | public interface IItem 7 | { 8 | bool IsBroken { get; } 9 | IRenderable Icon { get; } 10 | string Name { get; } 11 | string ItemPool { get; } 12 | UnitAction UseAction(); 13 | UnitAction DropAction(); 14 | IItem Duplicate(); 15 | } 16 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/AdhocDraftEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class AdhocDraftEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.OpenDraftMenu(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/FinishMovingEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class FinishMovingEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.FinishMoving(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/NextMapEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class NextMapEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.MapSelectContext.MoveCursorToNextMap(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Movable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Entity.General 5 | { 6 | public class Movable : TerrainEntity 7 | { 8 | public Movable(string name, string type, IRenderable sprite, Vector2 mapCoordinates, bool canMove) : 9 | base(name, type, sprite, mapCoordinates) 10 | { 11 | CanMove = canMove; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ContinueCombatEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class ContinueCombatEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.CombatPhase.ContinueCombat(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DeployUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class DeployUnitEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.DeploymentContext.TryDeployUnit(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ExecuteActionEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class ExecuteActionEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.ExecuteAction(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/PreviewUnitSkillsEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class PreviewUnitSkillsEvent : IEvent 6 | { 7 | public bool Complete { get; private set; } 8 | 9 | public void Continue() 10 | { 11 | GlobalContext.WorldContext.ShowUnitCodexEntry(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/SelectUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class SelectUnitEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.SelectUnitAndStartMoving(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/ArrayDeepCopier.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility 2 | { 3 | public static class ArrayDeepCopier 4 | { 5 | public static T[] DeepCopyArray(T[] array) 6 | { 7 | var newArray = new T[array.Length]; 8 | 9 | for (int i = 0; i < array.Length; i++) 10 | { 11 | newArray[i] = array[i]; 12 | } 13 | 14 | return newArray; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/CancelActionMenuEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class CancelActionMenuEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.CancelActionMenu(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/CloseAdHocDraftMenuEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class CloseAdHocDraftMenuEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.ClearDraftMenu(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/PreviousMapEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class PreviousMapEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.MapSelectContext.MoveCursorToPreviousMap(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/InvalidTimeEstimateException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | [Serializable] 6 | internal class InvalidTimeEstimateException : Exception 7 | { 8 | public InvalidTimeEstimateException(int estimate) : base( 9 | $"Estimate out of range. Got {estimate} when it should be between 0 and 5 inclusively." 10 | ) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/CancelActionTargetingEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class CancelActionTargetingEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.CancelUnitTargeting(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DeploySelectNextUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class DeploySelectNextUnitEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.DeploymentContext.SelectNextUnit(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DraftConfirmSelectionEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class DraftConfirmSelectionEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.DraftContext.ConfirmSelection(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/IRoutine.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Map.Elements.Cursor; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Entity.Unit.Actions 5 | { 6 | public interface IRoutine 7 | { 8 | string Name { get; } 9 | IRenderable Icon { get; } 10 | IRenderable MapIcon { get; } 11 | bool CanBeReadied(CreepUnit creep); 12 | bool CanExecute { get; } 13 | void ExecuteAction(MapSlice mapSlice); 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/SelectActionMenuOptionEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class SelectActionMenuOptionEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.WorldContext.SelectActionMenuOption(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DeploySelectPreviousUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class DeploySelectPreviousUnitEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.DeploymentContext.SelectPreviousUnit(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/SpriteResizer.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility 4 | { 5 | public static class SpriteResizer 6 | { 7 | public static IRenderable TryResizeRenderable(IRenderable renderable, Vector2 newSize) 8 | { 9 | IRenderable resizedRenderable = (renderable is IResizable resizable) ? resizable.Resize(newSize) : renderable; 10 | 11 | return resizedRenderable; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/ActionMenu/ItemActionOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Entity; 3 | 4 | namespace SolStandard.HUD.Menu.Options.ActionMenu 5 | { 6 | public class ItemActionOption : ActionOption 7 | { 8 | public ItemActionOption(IItem item, Color windowColor) : base( 9 | $"{item.Name} | {item.UseAction().Name}", 10 | windowColor, 11 | item.UseAction() 12 | ) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DeployResetToNextDeploymentTileEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class DeployResetToNextDeploymentTileEvent : NetworkEvent 8 | { 9 | public override void Continue() 10 | { 11 | GlobalContext.DeploymentContext.MoveToNextDeploymentTile(); 12 | Complete = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/InvalidShapeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoGame.Extended; 3 | 4 | namespace SolStandard.Utility.Exceptions 5 | { 6 | [Serializable] 7 | public class InvalidShapeException : Exception 8 | { 9 | public InvalidShapeException(IShapeF shape) : base($"Invalid shape: {shape.GetType().FullName}") 10 | { 11 | } 12 | 13 | public InvalidShapeException(string message) : base(message) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/NetworkEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Events.Network 4 | { 5 | [Serializable] 6 | public abstract class NetworkEvent : IEvent 7 | { 8 | public bool FromServer { get; } 9 | public bool Complete { get; protected set; } 10 | public abstract void Continue(); 11 | 12 | protected NetworkEvent() 13 | { 14 | FromServer = GameDriver.ConnectedAsServer; 15 | } 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /SolStandard/README.txt: -------------------------------------------------------------------------------- 1 | =BEFORE YOU PLAY THE GAME= 2 | 3 | If you try to launch the game and it does not open, it is likely because you may be missing the .NET Core 3.0 runtime. 4 | 5 | Install the runtime for your operating system at the following URL: 6 | https://dotnet.microsoft.com/download/dotnet-core/3.0 7 | 8 | After installing, try to launch the game again. 9 | 10 | If you are still stuck, send an email to bugs.solstandard@gmail.com or ask a question on the Discord server @ https://discord.gg/B94vWYR -------------------------------------------------------------------------------- /SolStandard/Utility/IRenderable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace SolStandard.Utility 5 | { 6 | public interface IRenderable 7 | { 8 | int Height { get; } 9 | int Width { get; } 10 | void Draw(SpriteBatch spriteBatch, Vector2 position); 11 | void Draw(SpriteBatch spriteBatch, Vector2 position, Color colorOverride); 12 | Color DefaultColor { get; set; } 13 | IRenderable Clone(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SolStandard/Entity/IEffectTile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Entity 4 | { 5 | public enum EffectTriggerTime 6 | { 7 | StartOfRound, 8 | EndOfTurn 9 | } 10 | 11 | public interface IEffectTile 12 | { 13 | bool Trigger(EffectTriggerTime triggerTime); 14 | bool WillTrigger(EffectTriggerTime triggerTime); 15 | bool HasTriggered { get; set; } 16 | bool IsExpired { get; } 17 | Vector2 MapCoordinates { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/IMenu.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.HUD.Menu.Options; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.HUD.Menu 5 | { 6 | public enum MenuCursorDirection 7 | { 8 | Up, 9 | Down, 10 | Left, 11 | Right 12 | } 13 | 14 | public interface IMenu : IRenderable 15 | { 16 | void MoveMenuCursor(MenuCursorDirection direction); 17 | void SelectOption(); 18 | MenuOption CurrentOption { get; } 19 | bool IsVisible { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Rogue/Rend.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility.Assets; 2 | 3 | namespace SolStandard.Entity.Unit.Actions.Rogue 4 | { 5 | public class Rend : DamageOverTimeAction 6 | { 7 | public Rend(int duration, int damagePerTurn) : base( 8 | icon: SkillIcon.Rend, 9 | name: "Rend", 10 | duration: duration, 11 | damagePerTurn: damagePerTurn, 12 | range: new[] {1}, 13 | toastMessage: "Bleeding!" 14 | ) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ResolveNetworkTurnEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class ResolveNetworkTurnEvent : NetworkEvent 9 | { 10 | public override void Continue() 11 | { 12 | GlobalContext.WorldContext.ResolveTurn(); 13 | AssetManager.MapUnitSelectSFX.Play(); 14 | Complete = true; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Animation/RenderableStatic.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.HUD.Window.Animation 4 | { 5 | public class RenderableStatic : IRenderableAnimation 6 | { 7 | public Vector2 CurrentPosition { get; private set; } 8 | 9 | public RenderableStatic(Vector2 position) 10 | { 11 | CurrentPosition = position; 12 | } 13 | 14 | public void Update(Vector2 destination) 15 | { 16 | CurrentPosition = destination; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Duelist/CorpsACorps.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit.Actions.Lancer; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Actions.Duelist 5 | { 6 | public class CorpsACorps : Charge 7 | { 8 | public CorpsACorps(int chargeDistance) : base( 9 | icon: SkillIconProvider.GetSkillIcon(SkillIcon.CorpsACorps, GameDriver.CellSizeVector), 10 | skillName: "Corps-a-corps", 11 | chargeDistance: chargeDistance 12 | ) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/HideUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class HideUnitEvent : IEvent 6 | { 7 | private readonly UnitEntity unit; 8 | 9 | public HideUnitEvent(UnitEntity unit) 10 | { 11 | this.unit = unit; 12 | } 13 | 14 | public bool Complete { get; private set; } 15 | 16 | public void Continue() 17 | { 18 | unit.Visible = false; 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/UnhideUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class UnhideUnitEvent : IEvent 6 | { 7 | private readonly UnitEntity unit; 8 | 9 | public UnhideUnitEvent(UnitEntity unit) 10 | { 11 | this.unit = unit; 12 | } 13 | 14 | public bool Complete { get; private set; } 15 | 16 | public void Continue() 17 | { 18 | unit.Visible = true; 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ResetCursorToActiveUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class ResetCursorToActiveUnitEvent : NetworkEvent 9 | { 10 | public override void Continue() 11 | { 12 | GlobalContext.WorldContext.ResetCursorToActiveUnit(); 13 | AssetManager.MapUnitCancelSFX.Play(); 14 | Complete = true; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ResetCursorToNextUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class ResetCursorToNextUnitEvent : NetworkEvent 9 | { 10 | public override void Continue() 11 | { 12 | GlobalContext.WorldContext.ResetCursorToNextUnitOnTeam(); 13 | AssetManager.MapUnitCancelSFX.Play(); 14 | Complete = true; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Assets/TeamIconProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Entity.Unit; 3 | 4 | namespace SolStandard.Utility.Assets 5 | { 6 | public static class TeamIconProvider 7 | { 8 | public static SpriteAtlas GetTeamIcon(Team team, Vector2 iconSize) 9 | { 10 | return new SpriteAtlas( 11 | AssetManager.TeamIcons, 12 | new Vector2(16), 13 | iconSize, 14 | (int) team, 15 | Color.White 16 | ); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Archer/PoisonArrow.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility.Assets; 2 | 3 | namespace SolStandard.Entity.Unit.Actions.Archer 4 | { 5 | public class PoisonArrow : DamageOverTimeAction 6 | { 7 | public PoisonArrow(int duration, int damagePerTurn) : base( 8 | icon: SkillIcon.PoisonTip, 9 | name: "Poison Arrow", 10 | duration: duration, 11 | damagePerTurn: damagePerTurn, 12 | range: new[] {2}, 13 | toastMessage: "Poisoned!" 14 | ) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ResetCursorToPreviousUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class ResetCursorToPreviousUnitEvent : NetworkEvent 9 | { 10 | public override void Continue() 11 | { 12 | GlobalContext.WorldContext.ResetCursorToPreviousUnitOnTeam(); 13 | AssetManager.MapUnitCancelSFX.Play(); 14 | Complete = true; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandard/Map/Elements/MapTile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Map.Elements 5 | { 6 | public class MapTile : MapElement 7 | { 8 | /** 9 | * GameTile 10 | * Holds a texture to be rendered on the map. 11 | */ 12 | 13 | public MapTile(IRenderable sprite, Vector2 mapCoordinates) : base(sprite, mapCoordinates) 14 | { 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return "MapTile: {" + Sprite + "}"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/ReadyAIRoutineEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class ReadyAIRoutineEvent : IEvent 6 | { 7 | private readonly CreepUnit creepUnit; 8 | public bool Complete { get; private set; } 9 | 10 | public ReadyAIRoutineEvent(CreepUnit creepUnit) 11 | { 12 | this.creepUnit = creepUnit; 13 | } 14 | 15 | public void Continue() 16 | { 17 | creepUnit.ReadyNextRoutine(); 18 | Complete = true; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/SpriteFontWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace SolStandard.Utility.Monogame 5 | { 6 | public class SpriteFontWrapper : ISpriteFont 7 | { 8 | public SpriteFontWrapper(SpriteFont font) 9 | { 10 | MonoGameSpriteFont = font; 11 | } 12 | 13 | public Vector2 MeasureString(string text) 14 | { 15 | return MonoGameSpriteFont.MeasureString(text); 16 | } 17 | 18 | public SpriteFont MonoGameSpriteFont { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/AdHocEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Events.Network 4 | { 5 | [Serializable] 6 | public class AdHocEvent : NetworkEvent 7 | { 8 | public delegate void EventAction(); 9 | 10 | private readonly EventAction eventAction; 11 | 12 | public AdHocEvent(EventAction eventAction) 13 | { 14 | this.eventAction = eventAction; 15 | } 16 | 17 | public override void Continue() 18 | { 19 | eventAction.Invoke(); 20 | Complete = true; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/PlaySoundEffectEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility.Monogame; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class PlaySoundEffectEvent : IEvent 6 | { 7 | public bool Complete { get; private set; } 8 | private readonly ISoundEffect soundEffect; 9 | 10 | public PlaySoundEffectEvent(ISoundEffect soundEffect) 11 | { 12 | this.soundEffect = soundEffect; 13 | } 14 | 15 | public void Continue() 16 | { 17 | soundEffect.Play(); 18 | Complete = true; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/DeployTile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Entity.Unit; 3 | using SolStandard.Utility; 4 | 5 | namespace SolStandard.Entity.General 6 | { 7 | public class DeployTile : TerrainEntity 8 | { 9 | public Team DeployTeam { get; } 10 | public bool Occupied { get; } 11 | 12 | public DeployTile(string name, string type, IRenderable sprite, Vector2 mapCoordinates, Team deployTeam) 13 | : base(name, type, sprite, mapCoordinates) 14 | { 15 | DeployTeam = deployTeam; 16 | Occupied = false; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/Utility/MathUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility 4 | { 5 | public static class MathUtils 6 | { 7 | public static int Ceiling(float value) 8 | { 9 | return (int) Math.Ceiling(value); 10 | } 11 | 12 | public static float AsymptoticAverage(float origin, float target, float speed = 1f, float tolerance = 0.000001f) 13 | { 14 | float asymptoticAverage = origin + (target - origin) * .1f * speed; 15 | 16 | return (Math.Abs(target - asymptoticAverage) > tolerance) ? asymptoticAverage : target; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Assets/ObjectiveIconProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Scenario; 3 | 4 | namespace SolStandard.Utility.Assets 5 | { 6 | public static class ObjectiveIconProvider 7 | { 8 | public static SpriteAtlas GetObjectiveIcon(VictoryConditions victoryConditions, Vector2 iconSize) 9 | { 10 | return new SpriteAtlas( 11 | AssetManager.ObjectiveIcons, 12 | new Vector2(16), 13 | iconSize, 14 | (int) victoryConditions, 15 | Color.White 16 | ); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/CreepDeployTile.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Entity.General 5 | { 6 | public class CreepDeployTile : TerrainEntity 7 | { 8 | public string CreepPool { get; } 9 | public bool CopyCreep { get; } 10 | 11 | public CreepDeployTile(string name, string type, IRenderable sprite, Vector2 mapCoordinates, string creepPool, 12 | bool copyCreep) 13 | : base(name, type, sprite, mapCoordinates) 14 | { 15 | CreepPool = creepPool; 16 | CopyCreep = copyCreep; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/ZeroOneRangeException.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.Exceptions 2 | { 3 | public class ZeroOneRangeException : OutOfRangeException 4 | { 5 | public ZeroOneRangeException(float value) : base($"Value {value} must be between zero and one inclusive!") 6 | { 7 | } 8 | 9 | public static void Assert(float valueMustBeBetweenZeroAndOne) 10 | { 11 | if (valueMustBeBetweenZeroAndOne < 0f || valueMustBeBetweenZeroAndOne > 1f) 12 | { 13 | throw new ZeroOneRangeException(valueMustBeBetweenZeroAndOne); 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SolStandardTest/Utility/Monogame/FakeTexture2D.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using SolStandard.Utility.Monogame; 4 | 5 | namespace SolStandardTest.Utility.Monogame 6 | { 7 | public class FakeTexture2D : ITexture2D 8 | { 9 | public FakeTexture2D(string name) 10 | { 11 | Name = name; 12 | } 13 | 14 | public Rectangle Bounds => new Rectangle(0, 0, 0, 0); 15 | 16 | public int Height => 1; 17 | 18 | public int Width => 1; 19 | 20 | public string Name { get; } 21 | 22 | public Texture2D MonoGameTexture => null; 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ChangePlayerTeamsEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Entity.Unit; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class ChangePlayerTeamsEvent : NetworkEvent 9 | { 10 | private readonly Team p1Team; 11 | 12 | public ChangePlayerTeamsEvent(Team p1Team) 13 | { 14 | this.p1Team = p1Team; 15 | } 16 | 17 | public override void Continue() 18 | { 19 | GlobalContext.SetP1Team(p1Team); 20 | Complete = true; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/TriggerEntityEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class TriggerEntityEvent : IEvent 6 | { 7 | private readonly IRemotelyTriggerable remotelyTriggerable; 8 | 9 | public TriggerEntityEvent(IRemotelyTriggerable remotelyTriggerable) 10 | { 11 | this.remotelyTriggerable = remotelyTriggerable; 12 | } 13 | 14 | public bool Complete { get; private set; } 15 | public void Continue() 16 | { 17 | remotelyTriggerable.RemoteTrigger(); 18 | Complete = true; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/AI/CreepTriggerTileEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity; 2 | 3 | namespace SolStandard.Utility.Events.AI 4 | { 5 | public class CreepTriggerTileEvent : IEvent 6 | { 7 | private readonly ITriggerable targetToTrigger; 8 | 9 | public CreepTriggerTileEvent(ITriggerable targetToTrigger) 10 | { 11 | this.targetToTrigger = targetToTrigger; 12 | } 13 | 14 | public bool Complete { get; private set; } 15 | 16 | public void Continue() 17 | { 18 | if (targetToTrigger.CanTrigger) targetToTrigger.Trigger(); 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Randomizer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SolStandard.Utility 4 | { 5 | public static class Randomizer 6 | { 7 | public static void Shuffle(this IList list) 8 | { 9 | int listPosition = list.Count; 10 | while (listPosition > 1) 11 | { 12 | listPosition--; 13 | int randomPosition = GameDriver.Random.Next(listPosition + 1); 14 | T value = list[randomPosition]; 15 | list[randomPosition] = list[listPosition]; 16 | list[listPosition] = value; 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/EscapeObjectiveEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | using SolStandard.Entity.Unit.Actions.Terrain; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class EscapeObjectiveEvent : IEvent 7 | { 8 | public bool Complete { get; private set; } 9 | private readonly GameUnit escapingUnit; 10 | 11 | public EscapeObjectiveEvent(GameUnit escapingUnit) 12 | { 13 | this.escapingUnit = escapingUnit; 14 | } 15 | 16 | public void Continue() 17 | { 18 | EscapeAction.EscapeWithUnit(escapingUnit); 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DraftMenuMoveEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Map.Elements; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class DraftMenuMoveEvent : NetworkEvent 9 | { 10 | private readonly Direction direction; 11 | 12 | public DraftMenuMoveEvent(Direction direction) 13 | { 14 | this.direction = direction; 15 | } 16 | public override void Continue() 17 | { 18 | GlobalContext.DraftContext.MoveCursor(direction); 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/PlayEntityAnimationOnceEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.General; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class PlayEntityAnimationOnceEvent : IEvent 6 | { 7 | private readonly TerrainEntity terrainEntity; 8 | public bool Complete { get; private set; } 9 | 10 | public PlayEntityAnimationOnceEvent(TerrainEntity terrainEntity) 11 | { 12 | this.terrainEntity = terrainEntity; 13 | } 14 | 15 | public void Continue() 16 | { 17 | (terrainEntity.RenderSprite as AnimatedSpriteSheet)?.PlayOnce(); 18 | Complete = true; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/Texture2DWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace SolStandard.Utility.Monogame 5 | { 6 | public class Texture2DWrapper : ITexture2D 7 | { 8 | public Texture2DWrapper(Texture2D texture) 9 | { 10 | MonoGameTexture = texture; 11 | } 12 | 13 | public Rectangle Bounds => MonoGameTexture.Bounds; 14 | 15 | public int Width => MonoGameTexture.Width; 16 | 17 | public int Height => MonoGameTexture.Height; 18 | 19 | public string Name => MonoGameTexture.Name; 20 | 21 | public Texture2D MonoGameTexture { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Collections/CollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | namespace SolStandard.Utility.Collections 6 | { 7 | public static class CollectionExtensions 8 | { 9 | public static bool IsEmpty(this ICollection me) => me.Count == 0; 10 | public static bool IsNotEmpty(this ICollection me) => !IsEmpty(me); 11 | 12 | public static Stack Clone(this Stack original) 13 | { 14 | var arr = new T[original.Count]; 15 | original.CopyTo(arr, 0); 16 | Array.Reverse(arr); 17 | return new Stack(arr); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/DecrementCurrentAdjustableActionEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class DecrementCurrentAdjustableActionEvent : NetworkEvent 8 | { 9 | private readonly int value; 10 | public DecrementCurrentAdjustableActionEvent(int value) 11 | { 12 | this.value = value; 13 | } 14 | 15 | public override void Continue() 16 | { 17 | GlobalContext.WorldContext.DecrementCurrentAdjustableAction(value); 18 | Complete = true; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Containers/Components/SplashScreen/SplashScreenContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using MonoGame.Extended; 3 | 4 | namespace SolStandard.Containers.Components.SplashScreen 5 | { 6 | public class SplashScreenContext : IUpdate 7 | { 8 | public IUserInterface SplashScreenHUD => splashScreenHUD; 9 | private readonly SplashScreenHUD splashScreenHUD; 10 | 11 | public SplashScreenContext(SplashScreenHUD splashScreenHUD) 12 | { 13 | this.splashScreenHUD = splashScreenHUD; 14 | } 15 | 16 | public void Update(GameTime gameTime) 17 | { 18 | splashScreenHUD.Update(gameTime); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/FirstTurnOfNewRoundEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.World.SubContext.Initiative; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class FirstTurnOfNewRoundEvent : IEvent 6 | { 7 | private readonly InitiativePhase initiativePhase; 8 | 9 | public FirstTurnOfNewRoundEvent(InitiativePhase initiativePhase) 10 | { 11 | this.initiativePhase = initiativePhase; 12 | } 13 | 14 | public bool Complete { get; private set; } 15 | 16 | public void Continue() 17 | { 18 | initiativePhase.StartFirstTurnOfNewRound(); 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/IncrementCurrentAdjustableActionEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class IncrementCurrentAdjustableActionEvent : NetworkEvent 8 | { 9 | private readonly int value; 10 | 11 | public IncrementCurrentAdjustableActionEvent(int value) 12 | { 13 | this.value = value; 14 | } 15 | 16 | public override void Continue() 17 | { 18 | GlobalContext.WorldContext.IncrementCurrentAdjustableAction(value); 19 | Complete = true; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/ArrayToList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SolStandard.Utility 4 | { 5 | public static class ArrayToList 6 | { 7 | public static List> Convert2DArrayToNestedList(T[,] array) 8 | { 9 | var result = new List>(); 10 | for (int i = 0; i < array.GetLength(0); i++) 11 | { 12 | var row = new List(); 13 | for (int j = 0; j < array.GetLength(1); j++) 14 | { 15 | row.Add(array[i, j]); 16 | } 17 | result.Add(row); 18 | } 19 | 20 | return result; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/WaitFramesEvent.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.Events 2 | { 3 | public class WaitFramesEvent : IEvent 4 | { 5 | public bool Complete { get; private set; } 6 | private int framesRemaining; 7 | 8 | public WaitFramesEvent(int waitTimeInFrames) 9 | { 10 | Complete = false; 11 | framesRemaining = waitTimeInFrames; 12 | } 13 | 14 | public void Continue() 15 | { 16 | if (framesRemaining > 0) 17 | { 18 | framesRemaining--; 19 | } 20 | else 21 | { 22 | Complete = true; 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/RecallPoint.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Entity.General 5 | { 6 | public class RecallPoint : TerrainEntity 7 | { 8 | private readonly string recallId; 9 | 10 | public RecallPoint(string recallId, IRenderable sprite, Vector2 mapCoordinates) : 11 | base(recallId + " Point", "RecallPoint", sprite, mapCoordinates) 12 | { 13 | this.recallId = recallId; 14 | } 15 | 16 | // ReSharper disable once ParameterHidesMember 17 | public bool BelongsToSource(string recallId) 18 | { 19 | return recallId.Equals(this.recallId); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/MoveActionMenuEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Menu; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class MoveActionMenuEvent: NetworkEvent 9 | { 10 | private readonly MenuCursorDirection direction; 11 | 12 | public MoveActionMenuEvent(MenuCursorDirection direction) 13 | { 14 | this.direction = direction; 15 | } 16 | 17 | public override void Continue() 18 | { 19 | GlobalContext.WorldContext.MoveActionMenuCursor(direction); 20 | 21 | Complete = true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/DeleteItemEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Entity; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class DeleteItemEvent : IEvent 8 | { 9 | private readonly IItem itemToDelete; 10 | public bool Complete { get; private set; } 11 | 12 | public DeleteItemEvent(IItem itemToDelete) 13 | { 14 | this.itemToDelete = itemToDelete; 15 | } 16 | 17 | public void Continue() 18 | { 19 | GlobalContext.ActiveUnit.RemoveItemFromInventory(itemToDelete); 20 | AssetManager.MenuConfirmSFX.Play(); 21 | Complete = true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/BankDepositEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.General; 2 | using SolStandard.Entity.Unit; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class BankDepositEvent : IEvent 7 | { 8 | private readonly GameUnit actingUnit; 9 | private readonly int goldToDeposit; 10 | 11 | public BankDepositEvent(GameUnit actingUnit, int goldToDeposit) 12 | { 13 | this.actingUnit = actingUnit; 14 | this.goldToDeposit = goldToDeposit; 15 | } 16 | 17 | public bool Complete { get; private set; } 18 | 19 | public void Continue() 20 | { 21 | Bank.Deposit(actingUnit, goldToDeposit); 22 | Complete = true; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/RemoveExpiredEffectTilesEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Entity; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class RemoveExpiredEffectTilesEvent : IEvent 8 | { 9 | private readonly List effectTiles; 10 | 11 | public RemoveExpiredEffectTilesEvent(List effectTiles) 12 | { 13 | this.effectTiles = effectTiles; 14 | } 15 | 16 | public bool Complete { get; private set; } 17 | 18 | public void Continue() 19 | { 20 | WorldContext.RemoveExpiredEffectTiles(effectTiles); 21 | Complete = true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/BankWithdrawEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.General; 2 | using SolStandard.Entity.Unit; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class BankWithdrawEvent : IEvent 7 | { 8 | private readonly GameUnit actingUnit; 9 | private readonly int goldToDeposit; 10 | 11 | public BankWithdrawEvent(GameUnit actingUnit, int goldToDeposit) 12 | { 13 | this.actingUnit = actingUnit; 14 | this.goldToDeposit = goldToDeposit; 15 | } 16 | 17 | public bool Complete { get; private set; } 18 | 19 | public void Continue() 20 | { 21 | Bank.Withdraw(actingUnit, goldToDeposit); 22 | Complete = true; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/UpdateStatusEffectEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | using SolStandard.Entity.Unit.Statuses; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class UpdateStatusEffectEvent : IEvent 7 | { 8 | private readonly StatusEffect effect; 9 | private readonly GameUnit effectedUnit; 10 | public bool Complete { get; private set; } 11 | 12 | public UpdateStatusEffectEvent(StatusEffect effect, GameUnit effectedUnit) 13 | { 14 | this.effect = effect; 15 | this.effectedUnit = effectedUnit; 16 | } 17 | 18 | public void Continue() 19 | { 20 | effect.UpdateEffect(effectedUnit); 21 | Complete = true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Inputs/GameControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Inputs 4 | { 5 | [Serializable] 6 | public abstract class GameControl 7 | { 8 | public int InputCounter { get; private set; } 9 | 10 | protected GameControl() 11 | { 12 | InputCounter = 0; 13 | } 14 | 15 | public abstract bool Pressed { get; } 16 | public abstract IRenderable GetInputIcon(int iconSize); 17 | 18 | public bool Released => !Pressed && InputCounter > 0; 19 | 20 | public void IncrementInputCounter() 21 | { 22 | InputCounter++; 23 | } 24 | 25 | public void ResetInputCounter() 26 | { 27 | InputCounter = 0; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Juice/JuiceBoxUtils.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility.HUD.Neo; 2 | 3 | namespace SolStandard.Utility.HUD.Juice 4 | { 5 | public static class JuiceBoxUtils 6 | { 7 | public static JuiceBox.Builder JuiceBoxForWindow(NeoWindow window, float speed) 8 | { 9 | return new JuiceBox.Builder(speed) 10 | .WithMoveSmoothing(window.CurrentPosition) 11 | .WithSizeSmoothing(window.Size()) 12 | .WithColorShifting(window.DefaultColor); 13 | } 14 | 15 | public static NeoWindow.JuicyWindow ToJuicyWindow(this NeoWindow window, float speed = 0.99f) 16 | { 17 | return new NeoWindow.JuicyWindow(window, JuiceBoxForWindow(window, speed).Build()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/InitializeRandomizerNet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NLog; 3 | 4 | namespace SolStandard.Utility.Events.Network 5 | { 6 | [Serializable] 7 | public class InitializeRandomizerNet : NetworkEvent 8 | { 9 | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); 10 | 11 | private readonly int rngSeed; 12 | 13 | public InitializeRandomizerNet(int rngSeed) 14 | { 15 | this.rngSeed = rngSeed; 16 | } 17 | 18 | public override void Continue() 19 | { 20 | GameDriver.Random = new Random(rngSeed); 21 | Logger.Debug($"New rng seed: {rngSeed}. Next value: {GameDriver.Random.Next()}"); 22 | Complete = true; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/RegenerateArmorEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class RegenerateArmorEvent : IEvent 7 | { 8 | private readonly GameUnit targetUnit; 9 | private readonly int armorPoints; 10 | 11 | public RegenerateArmorEvent(GameUnit targetUnit, int armorPoints) 12 | { 13 | this.targetUnit = targetUnit; 14 | this.armorPoints = armorPoints; 15 | } 16 | 17 | public bool Complete { get; private set; } 18 | 19 | public void Continue() 20 | { 21 | AssetManager.SkillBuffSFX.Play(); 22 | targetUnit.RecoverArmor(armorPoints); 23 | Complete = true; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/CreditsOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.HUD.Menu.Options.MainMenu 8 | { 9 | public class CreditsOption : MenuOption 10 | { 11 | public CreditsOption(Color windowColor) : 12 | base(new RenderText(AssetManager.MainMenuFont, "Credits"), windowColor) 13 | { 14 | } 15 | 16 | public override void Execute() 17 | { 18 | GlobalContext.CreditsContext.OpenView(); 19 | } 20 | 21 | public override IRenderable Clone() 22 | { 23 | return new CreditsOption(DefaultColor); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/QuitGameOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.HUD.Menu.Options.MainMenu 7 | { 8 | public class QuitGameOption : MenuOption 9 | { 10 | private const string QuitGameOptionText = "Quit Game"; 11 | 12 | public QuitGameOption(Color windowColor) : base(new RenderText(AssetManager.MainMenuFont, QuitGameOptionText), windowColor) 13 | { 14 | } 15 | 16 | public override void Execute() 17 | { 18 | GameDriver.QuitGame(); 19 | } 20 | 21 | public override IRenderable Clone() 22 | { 23 | return new QuitGameOption(DefaultColor); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ContinueOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.HUD.Menu.Options.PauseMenu 8 | { 9 | public class ContinueOption : MenuOption 10 | { 11 | public ContinueOption(Color color) : base(new RenderText(AssetManager.MainMenuFont, "Continue"), color) 12 | { 13 | } 14 | 15 | public override void Execute() 16 | { 17 | GlobalContext.CurrentGameState = GlobalContext.GameState.InGame; 18 | } 19 | 20 | public override IRenderable Clone() 21 | { 22 | return new ConcedeOption(DefaultColor); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/HostGameOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.HUD.Menu.Options.MainMenu 7 | { 8 | public class HostGameOption : MenuOption 9 | { 10 | private const string HostGameOptionText = "Host Game"; 11 | 12 | public HostGameOption(Color windowColor) : 13 | base(new RenderText(AssetManager.MainMenuFont, HostGameOptionText), windowColor) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | GameDriver.HostGame(); 20 | } 21 | 22 | public override IRenderable Clone() 23 | { 24 | return new HostGameOption(DefaultColor); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/HowToPlayOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.HUD.Menu.Options.MainMenu 8 | { 9 | public class HowToPlayOption : MenuOption 10 | { 11 | public HowToPlayOption(Color windowColor) : 12 | base(new RenderText(AssetManager.MainMenuFont, "How To Play"), windowColor) 13 | { 14 | } 15 | 16 | public override void Execute() 17 | { 18 | GlobalContext.HowToPlayContext.OpenView(); 19 | } 20 | 21 | public override IRenderable Clone() 22 | { 23 | return new HowToPlayOption(DefaultColor); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/JoinGameOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.HUD.Menu.Options.MainMenu 7 | { 8 | public class JoinGameOption : MenuOption 9 | { 10 | private const string JoinGameOptionText = "Join Game"; 11 | 12 | public JoinGameOption(Color windowColor) : 13 | base(new RenderText(AssetManager.MainMenuFont, JoinGameOptionText), windowColor) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | GameDriver.JoinGame(); 20 | } 21 | 22 | public override IRenderable Clone() 23 | { 24 | return new JoinGameOption(DefaultColor); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ResetGameEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class ResetGameEvent : NetworkEvent 9 | { 10 | public override void Continue() 11 | { 12 | if (GameDriver.ConnectedAsClient || GameDriver.ConnectedAsServer) 13 | { 14 | GameDriver.ConnectionManager.CloseServer(); 15 | GameDriver.ConnectionManager.DisconnectClient(); 16 | } 17 | 18 | AssetManager.MenuConfirmSFX.Play(); 19 | GlobalContext.Initialize(GlobalContext.MainMenuHUD, GlobalContext.NetworkHUD); 20 | 21 | Complete = true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/UnselectableOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.HUD.Menu.Options 7 | { 8 | public class UnselectableOption : MenuOption 9 | { 10 | public UnselectableOption(IRenderable labelContent, Color color, 11 | HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left) : 12 | base(labelContent, color, horizontalAlignment) 13 | { 14 | } 15 | 16 | public override void Execute() 17 | { 18 | AssetManager.WarningSFX.Play(); 19 | } 20 | 21 | public override IRenderable Clone() 22 | { 23 | return new UnselectableOption(LabelContent, DefaultColor); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/MapPingEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Containers.Components.Global; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Utility.Events.Network 7 | { 8 | [Serializable] 9 | public class MapPingEvent : NetworkEvent 10 | { 11 | public override void Continue() 12 | { 13 | Vector2 coordinates = (GlobalContext.MapCursor != null) ? GlobalContext.MapCursor.MapCoordinates : Vector2.Zero; 14 | 15 | GlobalContext.WorldContext.PlayAnimationAtCoordinates( 16 | AnimatedIconProvider.GetAnimatedIcon(AnimatedIconType.Ping, GameDriver.CellSizeVector), 17 | coordinates 18 | ); 19 | AssetManager.PingSFX.Play(); 20 | 21 | Complete = true; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Exceptions/VendorMisconfiguredException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SolStandard.Utility.Exceptions 4 | { 5 | public class VendorMisconfiguredException : Exception 6 | { 7 | public VendorMisconfiguredException(string message, int itemCount, int priceCount, int quantityCount) 8 | { 9 | throw new Exception(message + Environment.NewLine + ItemCounts(itemCount, priceCount, quantityCount)); 10 | } 11 | 12 | private static string ItemCounts(int itemCount, int priceCount, int quantityCount) 13 | { 14 | return string.Format( 15 | "Items: {0}" + Environment.NewLine + 16 | "Prices: {1}" + Environment.NewLine + 17 | "Quantities: {2}", 18 | itemCount, priceCount, quantityCount 19 | ); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/NewGameOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.HUD.Menu.Options.MainMenu 8 | { 9 | public class NewGameOption : MenuOption 10 | { 11 | private const string NewGameOptionText = "New Game"; 12 | 13 | public NewGameOption(Color windowColor) : base(new RenderText(AssetManager.MainMenuFont, NewGameOptionText), windowColor) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | GlobalContext.LoadMapSelect(); 20 | } 21 | 22 | public override IRenderable Clone() 23 | { 24 | return new NewGameOption(DefaultColor); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/BlinkCoordinatesEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Map.Elements; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class BlinkCoordinatesEvent : IEvent 8 | { 9 | private readonly Vector2 targetCoordinates; 10 | private readonly MapEntity entity; 11 | 12 | public BlinkCoordinatesEvent(MapEntity entity, Vector2 targetCoordinates) 13 | { 14 | this.targetCoordinates = targetCoordinates; 15 | this.entity = entity; 16 | } 17 | 18 | public bool Complete { get; private set; } 19 | 20 | public void Continue() 21 | { 22 | entity.SnapToCoordinates(targetCoordinates); 23 | AssetManager.SkillBlinkSFX.Play(); 24 | Complete = true; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/MusicVolumeUpOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | using SolStandard.Utility.Monogame; 6 | 7 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 8 | { 9 | public class MusicVolumeUpOption : MenuOption 10 | { 11 | private const string VolumeLabel = "Music Volume Up"; 12 | 13 | public MusicVolumeUpOption(Color color) : base(new RenderText(AssetManager.WindowFont, VolumeLabel), color) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | MusicBox.IncreaseVolume(0.1f); 20 | } 21 | 22 | public override IRenderable Clone() 23 | { 24 | return new MusicVolumeUpOption(DefaultColor); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/MusicVolumeDownOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | using SolStandard.Utility.Monogame; 6 | 7 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 8 | { 9 | public class MusicVolumeDownOption : MenuOption 10 | { 11 | private const string VolumeLabel = "Music Volume Down"; 12 | 13 | public MusicVolumeDownOption(Color color) : base(new RenderText(AssetManager.WindowFont, VolumeLabel), color) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | MusicBox.ReduceVolume(0.1f); 20 | } 21 | 22 | public override IRenderable Clone() 23 | { 24 | return new MusicVolumeDownOption(DefaultColor); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/MoveEntityToCoordinatesEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Map.Elements; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class MoveEntityToCoordinatesEvent : IEvent 8 | { 9 | private readonly MapEntity entity; 10 | private readonly Vector2 targetCoordinates; 11 | 12 | public MoveEntityToCoordinatesEvent(MapEntity entity, Vector2 targetCoordinates) 13 | { 14 | this.entity = entity; 15 | this.targetCoordinates = targetCoordinates; 16 | } 17 | 18 | public bool Complete { get; private set; } 19 | 20 | public void Continue() 21 | { 22 | entity.SlideToCoordinates(targetCoordinates); 23 | AssetManager.MapUnitMoveSFX.Play(); 24 | Complete = true; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/ToggleOpenEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.World; 2 | using SolStandard.Entity; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class ToggleOpenEvent : IEvent 7 | { 8 | private readonly IOpenable openable; 9 | public bool Complete { get; private set; } 10 | 11 | public ToggleOpenEvent(IOpenable openable) 12 | { 13 | this.openable = openable; 14 | Complete = false; 15 | } 16 | 17 | public void Continue() 18 | { 19 | if (!openable.IsOpen) 20 | { 21 | openable.Open(); 22 | WorldContext.WorldHUD.GenerateObjectiveWindow(); 23 | } 24 | else 25 | { 26 | openable.Close(); 27 | } 28 | 29 | Complete = true; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/TeamUtility.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Entity.Unit; 3 | 4 | namespace SolStandard.Utility 5 | { 6 | public static class TeamUtility 7 | { 8 | public static Color DetermineTeamWindowColor(Team team) 9 | { 10 | return team switch 11 | { 12 | Team.Blue => new Color(40, 40, 100, 200), 13 | Team.Red => new Color(100, 35, 35, 200), 14 | _ => new Color(35, 100, 35, 200) 15 | }; 16 | } 17 | 18 | public static Color DetermineTeamCursorColor(Team team) 19 | { 20 | return team switch 21 | { 22 | Team.Blue => new Color(150, 180, 240), 23 | Team.Red => new Color(240, 120, 120), 24 | _ => new Color(180, 240, 180) 25 | }; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/OpenCodexOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.HUD.Menu.Options.MainMenu 8 | { 9 | public class OpenCodexOption : MenuOption 10 | { 11 | private const string CodexOptionText = "View Codex"; 12 | 13 | public OpenCodexOption(Color windowColor) : 14 | base(new RenderText(AssetManager.MainMenuFont, CodexOptionText), windowColor) 15 | { 16 | } 17 | 18 | public override void Execute() 19 | { 20 | GlobalContext.CodexContext.OpenMenu(); 21 | } 22 | 23 | public override IRenderable Clone() 24 | { 25 | return new OpenCodexOption(DefaultColor); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/PushBlock.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit.Actions; 4 | using SolStandard.Entity.Unit.Actions.Terrain; 5 | using SolStandard.Utility; 6 | 7 | namespace SolStandard.Entity.General 8 | { 9 | public class PushBlock : TerrainEntity, IActionTile 10 | { 11 | public int[] InteractRange { get; } 12 | 13 | public PushBlock(string name, string type, IRenderable sprite, Vector2 mapCoordinates) : 14 | base(name, type, sprite, mapCoordinates) 15 | { 16 | CanMove = false; 17 | InteractRange = new[] {1}; 18 | } 19 | 20 | public List TileActions() 21 | { 22 | return new List 23 | { 24 | new PushBlockAction(this, MapCoordinates) 25 | }; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/Creep/NextRoutineStatus.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity.Unit.Actions; 2 | 3 | namespace SolStandard.Entity.Unit.Statuses.Creep 4 | { 5 | public class NextRoutineStatus : StatusEffect 6 | { 7 | public NextRoutineStatus( 8 | IRoutine routine 9 | ) : base( 10 | routine.Icon, 11 | routine.Name, 12 | "Next AI Routine", 13 | 2, 14 | false, 15 | false 16 | ) 17 | { 18 | } 19 | 20 | public override void ApplyEffect(GameUnit target) 21 | { 22 | //Do nothing 23 | } 24 | 25 | protected override void ExecuteEffect(GameUnit target) 26 | { 27 | //Do nothing 28 | } 29 | 30 | public override void RemoveEffect(GameUnit target) 31 | { 32 | //Do nothing 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /SolStandard.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | EULAHUD 3 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE 4 | True 5 | True 6 | True -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ControlsMenu/OpenControlsMenuOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Menu.Options.MainMenu; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ControlsMenu 9 | { 10 | public class OpenControlsMenuOption : MenuOption 11 | { 12 | public OpenControlsMenuOption(Color color) : 13 | base(new RenderText(AssetManager.WindowFont, "Control Config"), color) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | GlobalContext.ControlConfigContext.OpenMenu(); 20 | } 21 | 22 | public override IRenderable Clone() 23 | { 24 | return new OpenCodexOption(DefaultColor); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/EffectTilesStartOfRoundEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.World; 2 | using SolStandard.Entity; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class EffectTilesStartOfRoundEvent : IEvent 7 | { 8 | private readonly IEvent callback; 9 | public bool Complete { get; private set; } 10 | 11 | public EffectTilesStartOfRoundEvent(IEvent callback = null) 12 | { 13 | this.callback = callback; 14 | } 15 | 16 | public void Continue() 17 | { 18 | //IMPORTANT Do not allow tiles that have been triggered to trigger again or the risk of soft-locking via infinite triggers can occur 19 | WorldContext.TriggerEffectTiles(EffectTriggerTime.StartOfRound, false); 20 | Complete = true; 21 | if (callback is object) GlobalEventQueue.QueueSingleEvent(callback); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/Creep/IndependentStatus.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility.Assets; 2 | 3 | namespace SolStandard.Entity.Unit.Statuses.Creep 4 | { 5 | public class IndependentStatus : StatusEffect 6 | { 7 | public IndependentStatus() : base( 8 | MiscIconProvider.GetMiscIcon(MiscIcon.Independent, GameDriver.CellSizeVector), 9 | "Independent", 10 | "Unit can attack team mates.", 11 | 100, 12 | false, 13 | false 14 | ) 15 | { 16 | } 17 | 18 | public override void ApplyEffect(GameUnit target) 19 | { 20 | //Do nothing 21 | } 22 | 23 | protected override void ExecuteEffect(GameUnit target) 24 | { 25 | //Do nothing 26 | } 27 | 28 | public override void RemoveEffect(GameUnit target) 29 | { 30 | //Do nothing 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Archer/HuntingTrap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Actions.Archer 5 | { 6 | public class HuntingTrap : LayTrap 7 | { 8 | public HuntingTrap(int damage, int maxTriggers) : base( 9 | skillIcon: SkillIconProvider.GetSkillIcon(SkillIcon.Trap, GameDriver.CellSizeVector), 10 | trapSprite: SkillIconProvider.GetSkillIcon(SkillIcon.Trap, GameDriver.CellSizeVector), 11 | title: "Hunting Trap", 12 | damage: damage, 13 | maxTriggers: maxTriggers, 14 | range: new[] {1}, 15 | description: "Place a tile that will deal [" + damage + 16 | "] damage to enemies that start their turn on it and immobilize them." + 17 | Environment.NewLine + "Max activations: [" + maxTriggers + "]" 18 | ) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/ToggleFullscreenOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 7 | { 8 | public class ToggleFullscreenOption : MenuOption 9 | { 10 | private readonly GameDriver gameDriver; 11 | 12 | public ToggleFullscreenOption(Color color, GameDriver gameDriver) : base( 13 | new RenderText(AssetManager.WindowFont, "Toggle Fullscreen"), color) 14 | { 15 | this.gameDriver = gameDriver; 16 | } 17 | 18 | public override void Execute() 19 | { 20 | gameDriver.ToggleFullscreen(); 21 | } 22 | 23 | public override IRenderable Clone() 24 | { 25 | return new ToggleFullscreenOption(DefaultColor, gameDriver); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Neo/WindowContentExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility.HUD.Neo 4 | { 5 | public static class WindowContentExtensions 6 | { 7 | public static NeoWindow.Builder ToWindowBuilder(this IRenderable me) 8 | { 9 | return new NeoWindow.Builder().Content(me); 10 | } 11 | 12 | public static NeoWindow ToWindow(this IRenderable me, Color? windowColor = null, 13 | WindowBorder borderStyle = WindowBorder.Pixel, int? paddingPx = null) 14 | { 15 | NeoWindow.Builder builder = new NeoWindow.Builder().Content(me); 16 | 17 | if (windowColor is object) builder = builder.WindowColor(windowColor.Value); 18 | if (paddingPx is object) builder.InsidePadding(paddingPx.Value); 19 | 20 | builder = builder.BorderStyle(borderStyle); 21 | 22 | return builder.Build(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SolStandard/Utility/UnitSelector.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Containers.Components.Global; 4 | using SolStandard.Entity.Unit; 5 | using SolStandard.Map.Elements; 6 | 7 | namespace SolStandard.Utility 8 | { 9 | public static class UnitSelector 10 | { 11 | public static GameUnit SelectUnit(MapEntity unit) => GlobalContext.Units.FirstOrDefault(gameUnit => gameUnit.UnitEntity == unit); 12 | 13 | public static UnitEntity FindOtherUnitEntityAtCoordinates(Vector2 coordinates, MapEntity excludedEntity) 14 | { 15 | foreach (GameUnit unit in GlobalContext.Units) 16 | { 17 | if (unit.UnitEntity != null && unit.UnitEntity != excludedEntity) 18 | { 19 | if (unit.UnitEntity.MapCoordinates == coordinates) return unit.UnitEntity; 20 | } 21 | } 22 | 23 | return null; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.World.SubContext.Pause; 3 | using SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.PauseMenu 9 | { 10 | public class ConfigOption : MenuOption 11 | { 12 | public ConfigOption(Color color) : 13 | base(new RenderText(AssetManager.MainMenuFont, "Config"), color) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | ReturnToPauseMenuOption.FromMainMenu = false; 20 | PauseScreenUtils.OpenScreen(PauseScreenUtils.PauseMenus.PauseConfig); 21 | } 22 | 23 | public override IRenderable Clone() 24 | { 25 | return new ConfigOption(DefaultColor); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/SpawnUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit; 4 | using SolStandard.Entity.Unit.Actions; 5 | 6 | namespace SolStandard.Utility.Events.Network 7 | { 8 | [Serializable] 9 | public class SpawnUnitEvent : NetworkEvent 10 | { 11 | private readonly Role unitRole; 12 | private readonly Team unitTeam; 13 | private readonly float x; 14 | private readonly float y; 15 | 16 | public SpawnUnitEvent(Role unitRole, Team unitTeam, Vector2 coordinates) 17 | { 18 | this.unitRole = unitRole; 19 | this.unitTeam = unitTeam; 20 | x = coordinates.X; 21 | y = coordinates.Y; 22 | } 23 | 24 | 25 | public override void Continue() 26 | { 27 | SpawnUnitAction.PlaceUnitInTile(unitRole, unitTeam, new Vector2(x, y)); 28 | Complete = true; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/PlayAnimationAtCoordinatesEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class PlayAnimationAtCoordinatesEvent : IEvent 8 | { 9 | public bool Complete { get; private set; } 10 | private readonly TriggeredAnimation animation; 11 | private readonly Vector2 mapCoordinates; 12 | 13 | public PlayAnimationAtCoordinatesEvent(AnimatedIconType iconType, Vector2 mapCoordinates) 14 | { 15 | this.mapCoordinates = mapCoordinates; 16 | animation = AnimatedIconProvider.GetAnimatedIcon(iconType, GameDriver.CellSizeVector); 17 | } 18 | 19 | public void Continue() 20 | { 21 | GlobalContext.WorldContext.PlayAnimationAtCoordinates(animation, mapCoordinates); 22 | Complete = true; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SolStandard/Map/Elements/MapEntity.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Map.Elements 5 | { 6 | /** 7 | * GameObject 8 | * Holds a texture and certain attributes that impact how the tile can be interacted with on the game map 9 | */ 10 | public class MapEntity : MapElement 11 | { 12 | protected MapEntity(string name, string type, IRenderable spriteSheet, Vector2 mapCoordinates) : 13 | base(spriteSheet, mapCoordinates) 14 | { 15 | Name = name; 16 | Type = type; 17 | } 18 | 19 | public string Name { get; } 20 | 21 | public string Type { get; } 22 | 23 | public override string ToString() 24 | { 25 | string output = ""; 26 | 27 | output += "(" + Name + "):{"; 28 | output += "TileCell," + Sprite; 29 | output += "}"; 30 | 31 | return output; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SolStandard/Map/Camera/IMapCamera.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Map.Camera 4 | { 5 | public interface IMapCamera 6 | { 7 | public enum ZoomLevel 8 | { 9 | Far, 10 | Default, 11 | Close, 12 | Combat 13 | } 14 | 15 | float CurrentZoom { get; } 16 | float TargetZoom { get; } 17 | Vector2 CurrentPosition { get; } 18 | Vector2 TargetPosition { get; } 19 | Matrix CameraMatrix { get; } 20 | void RevertToPreviousZoomLevel(); 21 | void SetZoomLevel(ZoomLevel zoomLevel); 22 | void ZoomIn(); 23 | void ZoomOut(); 24 | void UpdateEveryFrame(); 25 | void SnapCameraCenterToCursor(); 26 | void CenterCameraToCursor(); 27 | void MoveCameraInDirection(CameraDirection direction, float panRateOverride); 28 | void StopMovingCamera(); 29 | void StartMovingCameraToCursor(); 30 | } 31 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/AdditionalActionEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class AdditionalActionEvent : IEvent 7 | { 8 | public bool Complete { get; private set; } 9 | 10 | public void Continue() 11 | { 12 | if (GlobalContext.ActiveUnit.IsAlive) 13 | { 14 | StartExtraAction("Extra action!"); 15 | } 16 | else 17 | { 18 | WorldContext.FinishTurn(true); 19 | } 20 | 21 | Complete = true; 22 | } 23 | 24 | public static void StartExtraAction(string message) 25 | { 26 | GlobalContext.WorldContext.ResetToActionMenu(); 27 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor(message, 50); 28 | WorldContext.UpdateWindowsEachTurn(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Juice/ScaleSmoother.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Utility.HUD.Juice 2 | { 3 | public class ScaleSmoother 4 | { 5 | public float CurrentScale { get; private set; } 6 | public float TargetScale { get; private set; } 7 | 8 | private readonly float speed; 9 | 10 | public ScaleSmoother(float initialScale, float speed) 11 | { 12 | CurrentScale = initialScale; 13 | TargetScale = initialScale; 14 | this.speed = speed; 15 | } 16 | 17 | public void ShiftToNewScale(float nextSize) 18 | { 19 | TargetScale = nextSize; 20 | } 21 | 22 | public void SnapToNewScale(float nextSize) 23 | { 24 | CurrentScale = nextSize; 25 | TargetScale = nextSize; 26 | } 27 | 28 | public void Update() 29 | { 30 | CurrentScale = MathUtils.AsymptoticAverage(CurrentScale, TargetScale, speed); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/MainMenu/MainMenuConfigOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.World.SubContext.Pause; 3 | using SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.MainMenu 9 | { 10 | public class MainMenuConfigOption : MenuOption 11 | { 12 | public MainMenuConfigOption(Color color) : 13 | base(new RenderText(AssetManager.MainMenuFont, "Config"), color) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | ReturnToPauseMenuOption.FromMainMenu = true; 20 | PauseScreenUtils.OpenScreen(PauseScreenUtils.PauseMenus.PauseConfig); 21 | } 22 | 23 | public override IRenderable Clone() 24 | { 25 | return new MainMenuConfigOption(DefaultColor); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Content/RenderBlank.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using SolStandard.Utility; 4 | 5 | namespace SolStandard.HUD.Window.Content 6 | { 7 | public class RenderBlank : IRenderable 8 | { 9 | public static IRenderable Blank { get; } = new RenderBlank(); 10 | 11 | public int Height { get; } 12 | public int Width { get; } 13 | public Color DefaultColor { get; set; } 14 | 15 | private RenderBlank() 16 | { 17 | Height = 0; 18 | Width = 0; 19 | } 20 | 21 | public void Draw(SpriteBatch spriteBatch, Vector2 position) 22 | { 23 | //Do nothing 24 | } 25 | 26 | public void Draw(SpriteBatch spriteBatch, Vector2 position, Color colorOverride) 27 | { 28 | //Do nothing 29 | } 30 | 31 | public IRenderable Clone() 32 | { 33 | return Blank; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/AI/SpawnCreepEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit; 4 | using SolStandard.Entity.Unit.Actions.Creeps; 5 | 6 | namespace SolStandard.Utility.Events.AI 7 | { 8 | public class SpawnCreepEvent : IEvent 9 | { 10 | private readonly Role unitRole; 11 | private readonly Dictionary entityProperties; 12 | private readonly Vector2 coordinates; 13 | public bool Complete { get; private set; } 14 | 15 | public SpawnCreepEvent(Role unitRole, Vector2 coordinates, Dictionary entityProperties) 16 | { 17 | this.unitRole = unitRole; 18 | this.entityProperties = entityProperties; 19 | this.coordinates = coordinates; 20 | } 21 | 22 | public void Continue() 23 | { 24 | SummoningRoutine.PlaceCreepInTile(unitRole, coordinates, entityProperties); 25 | Complete = true; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ControlsMenu/SaveControllerOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Window; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ControlsMenu 9 | { 10 | public class SaveControllerOption : MenuOption 11 | { 12 | private readonly string label; 13 | 14 | public SaveControllerOption(string label, Color color) : 15 | base(new RenderText(AssetManager.WindowFont, label), color, HorizontalAlignment.Centered) 16 | { 17 | this.label = label; 18 | } 19 | 20 | public override void Execute() 21 | { 22 | GlobalContext.ControlConfigContext.SaveControlMappings(); 23 | } 24 | 25 | public override IRenderable Clone() 26 | { 27 | return new SaveControllerOption(label, DefaultColor); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Containers/Components/Global/BonusStatistics.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Containers.Components.Global 2 | { 3 | public readonly struct BonusStatistics 4 | { 5 | public readonly int AtkBonus; 6 | public readonly int RetBonus; 7 | public readonly int BlockBonus; 8 | public readonly int LuckBonus; 9 | 10 | public BonusStatistics(int atkBonus, int retBonus, int blockBonus, int luckBonus) 11 | { 12 | AtkBonus = atkBonus; 13 | RetBonus = retBonus; 14 | BlockBonus = blockBonus; 15 | LuckBonus = luckBonus; 16 | } 17 | 18 | public static BonusStatistics operator +(BonusStatistics stat1, BonusStatistics stat2) 19 | { 20 | return new BonusStatistics( 21 | stat1.AtkBonus + stat2.AtkBonus, 22 | stat1.RetBonus + stat2.RetBonus, 23 | stat1.BlockBonus + stat2.BlockBonus, 24 | stat1.LuckBonus + stat2.LuckBonus 25 | ); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/DialMenu/CopyIPAddressOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Network; 3 | using SolStandard.HUD.Window; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.DialMenu 9 | { 10 | public class CopyIPAddressOption : MenuOption 11 | { 12 | private readonly NetworkHUD menu; 13 | 14 | public CopyIPAddressOption(Color menuColor, NetworkHUD menu) : base( 15 | new RenderText(AssetManager.WindowFont, "Copy IP"), 16 | menuColor, 17 | HorizontalAlignment.Centered 18 | ) 19 | { 20 | this.menu = menu; 21 | } 22 | 23 | public override void Execute() 24 | { 25 | menu.CopyHostIPAddress(); 26 | } 27 | 28 | public override IRenderable Clone() 29 | { 30 | return new CopyIPAddressOption(DefaultColor, menu); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConcedeOption.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | using SolStandard.Utility.Events; 7 | using SolStandard.Utility.Events.Network; 8 | 9 | namespace SolStandard.HUD.Menu.Options.PauseMenu 10 | { 11 | public class ConcedeOption : MenuOption 12 | { 13 | public ConcedeOption(Color color) : base(new RenderText(AssetManager.MainMenuFont, "Surrender"), color) 14 | { 15 | } 16 | 17 | public override void Execute() 18 | { 19 | var eventsToQueue = new Queue(); 20 | eventsToQueue.Enqueue(new ConcedeEvent()); 21 | eventsToQueue.Enqueue(new EndTurnEvent()); 22 | GlobalEventQueue.QueueEvents(eventsToQueue); 23 | } 24 | 25 | public override IRenderable Clone() 26 | { 27 | return new ConcedeOption(DefaultColor); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/DialMenu/PasteIPAddressOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Network; 3 | using SolStandard.HUD.Window; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.DialMenu 9 | { 10 | public class PasteIPAddressOption : MenuOption 11 | { 12 | private readonly NetworkHUD menu; 13 | 14 | public PasteIPAddressOption(Color menuColor, NetworkHUD menu) : base( 15 | new RenderText(AssetManager.WindowFont, "Paste IP"), 16 | menuColor, 17 | HorizontalAlignment.Centered 18 | ) 19 | { 20 | this.menu = menu; 21 | } 22 | 23 | public override void Execute() 24 | { 25 | menu.PasteIPAddressFromClipboard(); 26 | } 27 | 28 | public override IRenderable Clone() 29 | { 30 | return new CopyIPAddressOption(DefaultColor, menu); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/DialMenu/ConnectOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Network; 3 | using SolStandard.HUD.Window; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.DialMenu 9 | { 10 | public class ConnectOption : MenuOption 11 | { 12 | private NetworkHUD NetworkHUD { get; } 13 | private const string Connect = "Connect"; 14 | 15 | public ConnectOption(Color color, NetworkHUD networkHUD) : base( 16 | new RenderText(AssetManager.WindowFont, Connect), color, HorizontalAlignment.Centered 17 | ) 18 | { 19 | NetworkHUD = networkHUD; 20 | } 21 | 22 | public override void Execute() 23 | { 24 | NetworkHUD.AttemptConnection(); 25 | } 26 | 27 | public override IRenderable Clone() 28 | { 29 | return new ConnectOption(DefaultColor, NetworkHUD); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/MoveMapCursorAndUnitEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Map.Elements; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class MoveMapCursorAndUnitEvent : NetworkEvent 9 | { 10 | private readonly Direction direction; 11 | private readonly GlobalContext.GameState gameState; 12 | 13 | public MoveMapCursorAndUnitEvent(Direction direction, GlobalContext.GameState gameState) 14 | { 15 | this.direction = direction; 16 | this.gameState = gameState; 17 | } 18 | 19 | public override void Continue() 20 | { 21 | if (gameState == GlobalContext.GameState.InGame) 22 | { 23 | GlobalContext.WorldContext.MoveCursorAndSelectedUnitWithinMoveGrid(direction); 24 | GlobalContext.WorldContext.UpdateUnitAttackRangePreview(); 25 | } 26 | 27 | Complete = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/RemoveEntityFromMapEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Map; 3 | using SolStandard.Utility.Monogame; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class RemoveEntityFromMapEvent : IEvent 8 | { 9 | private readonly Vector2 coordinatesToClear; 10 | private readonly Layer mapLayer; 11 | private readonly ISoundEffect soundEffect; 12 | public bool Complete { get; private set; } 13 | 14 | public RemoveEntityFromMapEvent(Layer mapLayer, Vector2 coordinatesToClear, ISoundEffect soundEffect = null) 15 | { 16 | this.mapLayer = mapLayer; 17 | this.coordinatesToClear = coordinatesToClear; 18 | this.soundEffect = soundEffect; 19 | } 20 | 21 | public void Continue() 22 | { 23 | MapContainer.GameGrid[(int) mapLayer][(int) coordinatesToClear.X, (int) coordinatesToClear.Y] = null; 24 | 25 | soundEffect?.Play(); 26 | 27 | Complete = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/DialMenu/BackspaceOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Network; 3 | using SolStandard.HUD.Window; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.DialMenu 9 | { 10 | public class BackspaceOption : MenuOption 11 | { 12 | private NetworkHUD NetworkHUD { get; } 13 | private const string Backspace = "<<"; 14 | 15 | public BackspaceOption(Color color, NetworkHUD networkHUD) : base( 16 | new RenderText(AssetManager.MainMenuFont, Backspace), color, HorizontalAlignment.Centered 17 | ) 18 | { 19 | NetworkHUD = networkHUD; 20 | } 21 | 22 | public override void Execute() 23 | { 24 | NetworkHUD.BackspaceCharacter(); 25 | } 26 | 27 | public override IRenderable Clone() 28 | { 29 | return new BackspaceOption(DefaultColor, NetworkHUD); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/IncreaseTeamGoldEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Entity.General.Item; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Utility.Events 7 | { 8 | public class IncreaseTeamGoldEvent : IEvent 9 | { 10 | private readonly int gold; 11 | 12 | public IncreaseTeamGoldEvent(int gold) 13 | { 14 | this.gold = gold; 15 | } 16 | 17 | public bool Complete { get; private set; } 18 | 19 | public void Continue() 20 | { 21 | GlobalContext.InitiativePhase.AddGoldToTeam(gold, GlobalContext.ActiveTeam); 22 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor( 23 | $"{GlobalContext.ActiveTeam} team got {gold} {Currency.CurrencyAbbreviation}!", 50 24 | ); 25 | AssetManager.CoinSFX.Play(); 26 | WorldContext.WorldHUD.GenerateObjectiveWindow(); 27 | Complete = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/DecreaseTeamGoldEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Entity.General.Item; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Utility.Events 7 | { 8 | public class DecreaseTeamGoldEvent : IEvent 9 | { 10 | private readonly int gold; 11 | 12 | public DecreaseTeamGoldEvent(int gold) 13 | { 14 | this.gold = gold; 15 | } 16 | 17 | public bool Complete { get; private set; } 18 | 19 | public void Continue() 20 | { 21 | GlobalContext.InitiativePhase.DeductGoldFromTeam(gold, GlobalContext.ActiveTeam); 22 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor( 23 | $"{GlobalContext.ActiveTeam} team lost {gold} {Currency.CurrencyAbbreviation}!", 50 24 | ); 25 | AssetManager.CoinSFX.Play(); 26 | WorldContext.WorldHUD.GenerateObjectiveWindow(); 27 | Complete = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Containers/Scenario/Objectives/Surrender.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.HUD.Window.Content; 2 | using SolStandard.Utility; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Containers.Scenario.Objectives 6 | { 7 | public class Surrender : Objective 8 | { 9 | public bool BlueConcedes { private get; set; } 10 | public bool RedConcedes { private get; set; } 11 | 12 | 13 | protected override IRenderable VictoryLabelContent => 14 | new RenderText(AssetManager.ResultsFont, "PLAYER SURRENDERED"); 15 | 16 | public override bool ConditionsMet 17 | { 18 | get 19 | { 20 | if (BlueConcedes) 21 | { 22 | RedTeamWins = true; 23 | return RedTeamWins; 24 | } 25 | 26 | if (RedConcedes) 27 | { 28 | BlueTeamWins = true; 29 | return BlueTeamWins; 30 | } 31 | 32 | return false; 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/PullEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Entity.Unit; 4 | using SolStandard.Entity.Unit.Actions.Champion; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.Utility.Events 8 | { 9 | public class PullEvent : IEvent 10 | { 11 | private readonly GameUnit target; 12 | 13 | public PullEvent(GameUnit target) 14 | { 15 | this.target = target; 16 | } 17 | 18 | public bool Complete { get; private set; } 19 | 20 | public void Continue() 21 | { 22 | Vector2 actorCoordinates = GlobalContext.ActiveUnit.UnitEntity.MapCoordinates; 23 | Vector2 targetCoordinates = target.UnitEntity.MapCoordinates; 24 | Vector2 pullCoordinates = Challenge.DeterminePullPosition(actorCoordinates, targetCoordinates); 25 | target.UnitEntity.SlideToCoordinates(pullCoordinates); 26 | AssetManager.CombatBlockSFX.Play(); 27 | Complete = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/MusicMuteOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | using SolStandard.Utility.Monogame; 6 | 7 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 8 | { 9 | public class MusicMuteOption : MenuOption 10 | { 11 | private const string OnLabel = "Music: On"; 12 | private const string OffLabel = "Music: Off"; 13 | 14 | public MusicMuteOption(Color color) : base( 15 | new RenderText(AssetManager.WindowFont, (MusicBox.Muted) ? OffLabel : OnLabel), 16 | color 17 | ) 18 | { 19 | } 20 | 21 | public override void Execute() 22 | { 23 | MusicBox.ToggleMute(); 24 | UpdateLabel(new RenderText(AssetManager.WindowFont, (MusicBox.Muted) ? OffLabel : OnLabel)); 25 | } 26 | 27 | public override IRenderable Clone() 28 | { 29 | return new MusicMuteOption(DefaultColor); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/ShoveEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Entity.Unit; 4 | using SolStandard.Entity.Unit.Actions; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.Utility.Events 8 | { 9 | public class ShoveEvent : IEvent 10 | { 11 | private readonly GameUnit target; 12 | 13 | public ShoveEvent(GameUnit target) 14 | { 15 | this.target = target; 16 | } 17 | 18 | public bool Complete { get; private set; } 19 | 20 | public void Continue() 21 | { 22 | Vector2 actorCoordinates = GlobalContext.ActiveUnit.UnitEntity.MapCoordinates; 23 | Vector2 targetCoordinates = target.UnitEntity.MapCoordinates; 24 | Vector2 oppositeCoordinates = UnitAction.DetermineOppositeTileOfUnit(actorCoordinates, targetCoordinates); 25 | target.UnitEntity.SlideToCoordinates(oppositeCoordinates); 26 | AssetManager.CombatBlockSFX.Play(); 27 | Complete = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Inputs/MultiControlParser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace SolStandard.Utility.Inputs 5 | { 6 | public class MultiControlParser : ControlMapper 7 | { 8 | private readonly List controlMappers; 9 | 10 | public MultiControlParser(params ControlMapper[] controlMappers) : base(controlMappers.First().Controller) 11 | { 12 | this.controlMappers = controlMappers.ToList(); 13 | } 14 | 15 | public override bool Press(Input input, PressType pressType) 16 | { 17 | return controlMappers.Any(controlMapper => controlMapper.Press(input, pressType)); 18 | } 19 | 20 | public override bool Peek(Input input, PressType pressType) 21 | { 22 | return controlMappers.Any(controlMapper => controlMapper.Peek(input, pressType)); 23 | } 24 | 25 | public override bool Released(Input input) 26 | { 27 | return controlMappers.Any(controlMapper => controlMapper.Released(input)); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/RegenerateHealthEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Entity.Unit; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class RegenerateHealthEvent : IEvent 8 | { 9 | private readonly GameUnit targetUnit; 10 | private readonly int hpHealed; 11 | 12 | public RegenerateHealthEvent(GameUnit targetUnit, int hpHealed) 13 | { 14 | this.targetUnit = targetUnit; 15 | this.hpHealed = hpHealed; 16 | } 17 | 18 | public bool Complete { get; private set; } 19 | 20 | public void Continue() 21 | { 22 | targetUnit.RecoverHP(hpHealed); 23 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCellCoordinates( 24 | targetUnit.Id + " recovers " + hpHealed + " HP!", 25 | targetUnit.UnitEntity.MapCoordinates, 26 | 50 27 | ); 28 | AssetManager.SkillBuffSFX.Play(); 29 | Complete = true; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/EscapeEntity.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit.Actions; 4 | using SolStandard.Entity.Unit.Actions.Terrain; 5 | using SolStandard.Utility; 6 | 7 | namespace SolStandard.Entity.General 8 | { 9 | public class EscapeEntity : TerrainEntity, IActionTile 10 | { 11 | public int[] InteractRange { get; } 12 | public readonly bool UseableByBlue; 13 | public readonly bool UseableByRed; 14 | 15 | public EscapeEntity(string name, string type, IRenderable sprite, Vector2 mapCoordinates, bool useableByBlue, 16 | bool useableByRed) 17 | : base(name, type, sprite, mapCoordinates) 18 | { 19 | UseableByBlue = useableByBlue; 20 | UseableByRed = useableByRed; 21 | InteractRange = new[] {0}; 22 | } 23 | 24 | public List TileActions() 25 | { 26 | return new List 27 | { 28 | new EscapeAction(this, MapCoordinates) 29 | }; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Monogame/SongWrapper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework.Media; 2 | 3 | namespace SolStandard.Utility.Monogame 4 | { 5 | public class SongWrapper : IPlayableAudio 6 | { 7 | private readonly Song monogameSong; 8 | public float Volume { get; set; } 9 | public string Name => monogameSong.Name; 10 | 11 | public SongWrapper(Song monogameSong) 12 | { 13 | this.monogameSong = monogameSong; 14 | } 15 | 16 | public void PlayLoop() 17 | { 18 | MediaPlayer.Volume = Volume; 19 | MediaPlayer.IsRepeating = true; 20 | MediaPlayer.Play(monogameSong); 21 | } 22 | 23 | public void PlayOnce() 24 | { 25 | MediaPlayer.Volume = Volume; 26 | MediaPlayer.IsRepeating = false; 27 | MediaPlayer.Play(monogameSong); 28 | } 29 | 30 | public void Stop() 31 | { 32 | MediaPlayer.Stop(); 33 | } 34 | 35 | public void Pause() 36 | { 37 | MediaPlayer.Pause(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/CameraCursorPositionEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class CameraCursorPositionEvent : IEvent 7 | { 8 | private readonly Vector2 targetCameraPosition; 9 | public bool Complete { get; private set; } 10 | 11 | public CameraCursorPositionEvent(Vector2 targetCameraPosition) 12 | { 13 | this.targetCameraPosition = targetCameraPosition; 14 | } 15 | 16 | public void Continue() 17 | { 18 | GlobalContext.MapCursor.SnapCameraAndCursorToCoordinates(targetCameraPosition); 19 | 20 | if (GlobalContext.WorldContext.MapContainer.MapCursor.IsOnScreen) 21 | { 22 | GlobalContext.WorldContext.MapContainer.MapCamera.CenterCameraToCursor(); 23 | } 24 | else 25 | { 26 | GlobalContext.WorldContext.MapContainer.MapCamera.SnapCameraCenterToCursor(); 27 | } 28 | 29 | Complete = true; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/CreepDisableOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.HUD.Menu.Options.MainMenu; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 9 | { 10 | public class CreepDisableOption : MenuOption 11 | { 12 | public static string OptionText => 13 | $"Disable Creeps in 2P: <{(!CreepPreferences.Instance.CreepsCanSpawn).ToString().ToUpper()}>"; 14 | 15 | public CreepDisableOption(Color color) : base(new RenderText(AssetManager.WindowFont, OptionText), color) 16 | { 17 | } 18 | 19 | public override void Execute() 20 | { 21 | CreepPreferences.Instance.ToggleCreepsCanSpawn(); 22 | UpdateLabel(new RenderText(AssetManager.WindowFont, OptionText)); 23 | } 24 | 25 | public override IRenderable Clone() 26 | { 27 | return new OpenCodexOption(DefaultColor); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Item/Barricade.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Entity.Unit.Actions; 3 | using SolStandard.Entity.Unit.Actions.Item; 4 | using SolStandard.Utility; 5 | 6 | namespace SolStandard.Entity.General.Item 7 | { 8 | public class Barricade : BreakableObstacle, IItem 9 | { 10 | public string ItemPool { get; } 11 | 12 | public Barricade(string name, string type, IRenderable sprite, Vector2 mapCoordinates, int hp, 13 | string itemPool) : 14 | base(name, type, sprite, mapCoordinates, hp, false, hp < 1, 0) 15 | { 16 | ItemPool = itemPool; 17 | } 18 | 19 | public IRenderable Icon => Sprite; 20 | 21 | 22 | public UnitAction UseAction() 23 | { 24 | return new DeployBarricadeAction(this); 25 | } 26 | 27 | public UnitAction DropAction() 28 | { 29 | return new DropGiveItemAction(this); 30 | } 31 | 32 | public IItem Duplicate() 33 | { 34 | return new Barricade(Name, Type, Sprite, MapCoordinates, HP, ItemPool); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/DialMenu/CharacterOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Network; 3 | using SolStandard.HUD.Window; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.DialMenu 9 | { 10 | public class CharacterOption : MenuOption 11 | { 12 | private readonly char character; 13 | private NetworkHUD NetworkHUD { get; } 14 | 15 | public CharacterOption(char character, Color color, NetworkHUD networkHUD) : base( 16 | new RenderText(AssetManager.MainMenuFont, character.ToString()), color, HorizontalAlignment.Centered 17 | ) 18 | { 19 | this.character = character; 20 | NetworkHUD = networkHUD; 21 | } 22 | 23 | public override void Execute() 24 | { 25 | NetworkHUD.EnterCharacter(character); 26 | } 27 | 28 | public override IRenderable Clone() 29 | { 30 | return new CharacterOption(character, DefaultColor, NetworkHUD); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/SoundEffectMuteOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.HUD.Window.Content; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | using SolStandard.Utility.Monogame; 6 | 7 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 8 | { 9 | public class SoundEffectMuteOption : MenuOption 10 | { 11 | private const string OnLabel = "SFX: On"; 12 | private const string OffLabel = "SFX: Off"; 13 | 14 | public SoundEffectMuteOption(Color color) : base( 15 | new RenderText(AssetManager.WindowFont, (SoundEffectWrapper.Muted) ? OffLabel : OnLabel), 16 | color 17 | ) 18 | { 19 | } 20 | 21 | public override void Execute() 22 | { 23 | SoundEffectWrapper.ToggleMute(); 24 | 25 | UpdateLabel(new RenderText(AssetManager.WindowFont, (SoundEffectWrapper.Muted) ? OffLabel : OnLabel)); 26 | } 27 | 28 | public override IRenderable Clone() 29 | { 30 | return new SoundEffectMuteOption(DefaultColor); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/ToastAtCursorEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Monogame; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class ToastAtCursorEvent : IEvent 7 | { 8 | public bool Complete { get; private set; } 9 | private readonly string message; 10 | private readonly int duration; 11 | private readonly ISoundEffect soundEffect; 12 | 13 | public ToastAtCursorEvent(string message, ISoundEffect soundEffect = null, 14 | int duration = 50) 15 | { 16 | this.message = message; 17 | this.soundEffect = soundEffect; 18 | this.duration = duration; 19 | } 20 | 21 | public ToastAtCursorEvent(string message, int duration) : 22 | this(message, null, duration) 23 | { 24 | } 25 | 26 | public void Continue() 27 | { 28 | soundEffect?.Play(); 29 | 30 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor(message, duration); 31 | 32 | Complete = true; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Juice/SizeSmoother.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility.HUD.Juice 4 | { 5 | public class SizeSmoother 6 | { 7 | public Vector2 CurrentSize { get; private set; } 8 | public Vector2 TargetSize { get; private set; } 9 | 10 | private readonly float speed; 11 | 12 | public SizeSmoother(Vector2 initialSize, float speed) 13 | { 14 | CurrentSize = initialSize; 15 | TargetSize = initialSize; 16 | this.speed = speed; 17 | } 18 | 19 | public void ShiftToNewSize(Vector2 nextSize) 20 | { 21 | TargetSize = nextSize; 22 | } 23 | 24 | public void SnapToNewSize(Vector2 nextSize) 25 | { 26 | CurrentSize = nextSize; 27 | TargetSize = nextSize; 28 | } 29 | 30 | public void Update() 31 | { 32 | float nextX = MathUtils.AsymptoticAverage(CurrentSize.X, TargetSize.X, speed); 33 | float nextY = MathUtils.AsymptoticAverage(CurrentSize.Y, TargetSize.Y, speed); 34 | CurrentSize = new Vector2(nextX, nextY); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/CastStatusEffectEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Entity.Unit; 4 | using SolStandard.Entity.Unit.Statuses; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.Utility.Events 8 | { 9 | public class CastStatusEffectEvent : IEvent 10 | { 11 | private readonly GameUnit targetUnit; 12 | private readonly StatusEffect statusEffect; 13 | 14 | public CastStatusEffectEvent(GameUnit targetUnit, StatusEffect statusEffect) 15 | { 16 | this.targetUnit = targetUnit; 17 | this.statusEffect = statusEffect; 18 | } 19 | 20 | public bool Complete { get; private set; } 21 | 22 | public void Continue() 23 | { 24 | targetUnit.AddStatusEffect(statusEffect); 25 | GlobalContext.WorldContext.PlayAnimationAtCoordinates( 26 | AnimatedIconProvider.GetAnimatedIcon(AnimatedIconType.Interact, GameDriver.CellSizeVector), 27 | targetUnit.UnitEntity?.MapCoordinates ?? Vector2.Zero 28 | ); 29 | Complete = true; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Containers/Components/Global/CreepPreferences.cs: -------------------------------------------------------------------------------- 1 | namespace SolStandard.Containers.Components.Global 2 | { 3 | public class CreepPreferences 4 | { 5 | public static CreepPreferences Instance { get; } = new CreepPreferences(); 6 | private const string CreepPreferencesFileName = "CreepSpawn"; 7 | 8 | public bool CreepsCanSpawn { get; private set; } 9 | 10 | private CreepPreferences() 11 | { 12 | LoadSavedPreferences(); 13 | } 14 | 15 | private void LoadSavedPreferences() 16 | { 17 | if (GameDriver.FileIO.FileExists(CreepPreferencesFileName)) 18 | { 19 | CreepsCanSpawn = GameDriver.FileIO.Load(CreepPreferencesFileName); 20 | } 21 | else 22 | { 23 | CreepsCanSpawn = true; 24 | GameDriver.FileIO.Save(CreepPreferencesFileName, CreepsCanSpawn); 25 | } 26 | } 27 | 28 | public void ToggleCreepsCanSpawn() 29 | { 30 | CreepsCanSpawn = !CreepsCanSpawn; 31 | GameDriver.FileIO.Save(CreepPreferencesFileName, CreepsCanSpawn); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/AI/CreepMoveEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Entity.Unit; 3 | using SolStandard.Map.Elements; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Utility.Events.AI 7 | { 8 | public class CreepMoveEvent : IEvent 9 | { 10 | private readonly GameUnit unitToMove; 11 | private readonly Direction directionToMove; 12 | private readonly bool ignoreCollision; 13 | 14 | public CreepMoveEvent(GameUnit unitToMove, Direction directionToMove, bool ignoreCollision = false) 15 | { 16 | this.unitToMove = unitToMove; 17 | this.directionToMove = directionToMove; 18 | this.ignoreCollision = ignoreCollision; 19 | } 20 | 21 | public bool Complete { get; private set; } 22 | 23 | public void Continue() 24 | { 25 | unitToMove.MoveUnitInDirection(directionToMove, ignoreCollision); 26 | GlobalContext.WorldContext.ResetCursorToActiveUnit(); 27 | 28 | if (directionToMove != Direction.None) AssetManager.MapUnitMoveSFX.Play(); 29 | 30 | Complete = true; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Item/LadderBridge.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Entity.Unit.Actions; 3 | using SolStandard.Entity.Unit.Actions.Item; 4 | using SolStandard.Utility; 5 | 6 | namespace SolStandard.Entity.General.Item 7 | { 8 | public class LadderBridge : Movable, IItem 9 | { 10 | public IRenderable Icon { get; } 11 | public string ItemPool { get; } 12 | 13 | public LadderBridge(string name, string type, IRenderable sprite, Vector2 mapCoordinates, string itemPool, 14 | bool canMove) : 15 | base(name, type, sprite, mapCoordinates, canMove) 16 | { 17 | Icon = sprite; 18 | ItemPool = itemPool; 19 | } 20 | 21 | public bool IsBroken => false; 22 | 23 | public UnitAction UseAction() 24 | { 25 | return new DeployLadderBridgeAction(this); 26 | } 27 | 28 | public UnitAction DropAction() 29 | { 30 | return new DropGiveItemAction(this); 31 | } 32 | 33 | public IItem Duplicate() 34 | { 35 | return new LadderBridge(Name, Type, Sprite, MapCoordinates, ItemPool, CanMove); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /SolStandard/SolStandardCore.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.168 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SolStandardCore", "SolStandardCore.csproj", "{30716DB2-2C70-4617-BC8B-C0E677D9235C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {30716DB2-2C70-4617-BC8B-C0E677D9235C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {30716DB2-2C70-4617-BC8B-C0E677D9235C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {30716DB2-2C70-4617-BC8B-C0E677D9235C}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {30716DB2-2C70-4617-BC8B-C0E677D9235C}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C1B1BE0F-AFA3-4986-97F0-4DC45C20D95F} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Bard/SongAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using SolStandard.Containers.Components.Global; 4 | using SolStandard.Entity.Unit.Statuses.Bard; 5 | using SolStandard.Utility; 6 | 7 | namespace SolStandard.Entity.Unit.Actions.Bard 8 | { 9 | public abstract class SongAction : UnitAction 10 | { 11 | protected SongAction(IRenderable icon, string name, string description, SpriteAtlas tileSprite, int[] range, 12 | bool freeAction) 13 | : base( 14 | icon, 15 | name, 16 | description + Environment.NewLine + "Removes other songs currently applied.", 17 | tileSprite, 18 | range, 19 | freeAction 20 | ) 21 | { 22 | } 23 | 24 | protected bool SingerIsSinging 25 | { 26 | get 27 | { 28 | GameUnit singer = GlobalContext.Units.FirstOrDefault(unit => unit.Actions.Contains(this)); 29 | return singer != null && 30 | singer.StatusEffects.Any(status => status is SoloStatus || status is ConcertoStatus); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Juice/CameraSmoother.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility.HUD.Juice 4 | { 5 | public class CameraSmoother 6 | { 7 | public Vector2 CurrentPosition => moveSmoother.CurrentPosition; 8 | 9 | private float Speed { get; } 10 | 11 | public float CurrentZoom { get; private set; } 12 | private float targetZoom; 13 | 14 | private readonly MoveSmoother moveSmoother; 15 | 16 | public CameraSmoother(float speed, float startingZoom) 17 | { 18 | moveSmoother = new MoveSmoother(Vector2.Zero, speed); 19 | 20 | Speed = speed; 21 | CurrentZoom = startingZoom; 22 | targetZoom = CurrentZoom; 23 | } 24 | 25 | public void MoveTowards(Vector2 newTarget) 26 | { 27 | moveSmoother.MoveTowards(newTarget); 28 | } 29 | 30 | public void ZoomTowards(float newTarget) 31 | { 32 | targetZoom = newTarget; 33 | } 34 | 35 | public void Update() 36 | { 37 | moveSmoother.Update(); 38 | CurrentZoom = MathUtils.AsymptoticAverage(CurrentZoom, targetZoom, Speed); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Portal.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit.Actions; 4 | using SolStandard.Entity.Unit.Actions.Terrain; 5 | using SolStandard.HUD.Window.Content; 6 | using SolStandard.Utility; 7 | using SolStandard.Utility.Assets; 8 | 9 | namespace SolStandard.Entity.General 10 | { 11 | public class Portal : TerrainEntity, IActionTile 12 | { 13 | private readonly string destinationId; 14 | public int[] InteractRange { get; } 15 | 16 | public Portal(string name, string type, IRenderable sprite, Vector2 mapCoordinates, string destinationId, 17 | int[] range) : 18 | base(name, type, sprite, mapCoordinates) 19 | { 20 | this.destinationId = destinationId; 21 | InteractRange = range; 22 | } 23 | 24 | public List TileActions() 25 | { 26 | return new List 27 | { 28 | new Transport(this, destinationId) 29 | }; 30 | } 31 | 32 | protected override IRenderable EntityInfo => 33 | new RenderText(AssetManager.WindowFont, "Destination: " + destinationId); 34 | } 35 | } -------------------------------------------------------------------------------- /SolStandardTest/SolStandardTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.0 5 | 6 | false 7 | 8 | 8 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | PreserveNewest 28 | 29 | 30 | PreserveNewest 31 | 32 | 33 | PreserveNewest 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ControlsMenu/DeviceSelectOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Containers.Components.InputRemapping; 4 | using SolStandard.HUD.Window; 5 | using SolStandard.HUD.Window.Content; 6 | using SolStandard.Utility; 7 | using SolStandard.Utility.Assets; 8 | 9 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ControlsMenu 10 | { 11 | public class DeviceSelectOption : MenuOption 12 | { 13 | private readonly string labelText; 14 | private readonly ControlConfigContext.Device device; 15 | 16 | public DeviceSelectOption(string labelText, ControlConfigContext.Device device, Color color) : 17 | base(new RenderText(AssetManager.WindowFont, labelText), color, HorizontalAlignment.Centered) 18 | { 19 | this.labelText = labelText; 20 | this.device = device; 21 | } 22 | 23 | public override void Execute() 24 | { 25 | GlobalContext.ControlConfigContext.OpenRemapMenu(device); 26 | } 27 | 28 | public override IRenderable Clone() 29 | { 30 | return new DeviceSelectOption(labelText, device, DefaultColor); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/CenterScreenRenderableEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.World; 2 | using SolStandard.Utility.Monogame; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class CenterScreenRenderableEvent : IEvent 7 | { 8 | private readonly IRenderable content; 9 | private readonly int frameLifetime; 10 | private readonly ISoundEffect soundEffect; 11 | private int frameCounter; 12 | public bool Complete { get; private set; } 13 | 14 | public CenterScreenRenderableEvent(IRenderable content, int frameLifetime, ISoundEffect soundEffect = null) 15 | { 16 | this.content = content; 17 | this.frameLifetime = frameLifetime; 18 | this.soundEffect = soundEffect; 19 | frameCounter = 0; 20 | } 21 | 22 | public void Continue() 23 | { 24 | if (frameCounter == 0) soundEffect?.Play(); 25 | 26 | frameCounter++; 27 | 28 | WorldContext.WorldHUD.RenderCenterScreen(content); 29 | 30 | if (frameCounter <= frameLifetime) return; 31 | 32 | WorldContext.WorldHUD.StopRenderingCenterScreenContent(); 33 | Complete = true; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Inputs/IController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Utility.Inputs 5 | { 6 | public interface IController 7 | { 8 | ControlType ControlType { get; } 9 | GameControl GetInput(Input input); 10 | void RemapControl(Input inputToRemap, GameControl newInput); 11 | 12 | Dictionary Inputs { get; } 13 | 14 | GameControl Confirm { get; } 15 | GameControl Cancel { get; } 16 | GameControl PreviewUnit { get; } 17 | GameControl PreviewItem { get; } 18 | 19 | GameControl CursorUp { get; } 20 | GameControl CursorDown { get; } 21 | GameControl CursorLeft { get; } 22 | GameControl CursorRight { get; } 23 | 24 | GameControl CameraUp { get; } 25 | GameControl CameraDown { get; } 26 | GameControl CameraLeft { get; } 27 | GameControl CameraRight { get; } 28 | 29 | GameControl Menu { get; } 30 | GameControl Status { get; } 31 | 32 | GameControl SetWideZoom { get; } 33 | GameControl SetCloseZoom { get; } 34 | GameControl AdjustZoomOut { get; } 35 | GameControl AdjustZoomIn { get; } 36 | } 37 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/DialMenu/MainMenuOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Containers.Components.Network; 4 | using SolStandard.HUD.Window; 5 | using SolStandard.HUD.Window.Content; 6 | using SolStandard.Utility; 7 | using SolStandard.Utility.Monogame; 8 | 9 | namespace SolStandard.HUD.Menu.Options.DialMenu 10 | { 11 | public class MainMenuOption : MenuOption 12 | { 13 | private readonly ISpriteFont font; 14 | private NetworkHUD NetworkHUD { get; } 15 | private const string MainMenu = "Menu"; 16 | 17 | public MainMenuOption(ISpriteFont font, Color color, NetworkHUD networkHUD) : base( 18 | new RenderText(font, MainMenu), color, HorizontalAlignment.Centered 19 | ) 20 | { 21 | this.font = font; 22 | NetworkHUD = networkHUD; 23 | } 24 | 25 | public override void Execute() 26 | { 27 | GlobalContext.CurrentGameState = GlobalContext.GameState.MainMenu; 28 | NetworkHUD.ResetIPAddress(); 29 | } 30 | 31 | public override IRenderable Clone() 32 | { 33 | return new MainMenuOption(font, DefaultColor, NetworkHUD); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/EndTurnEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Entity; 4 | using SolStandard.Entity.Unit.Statuses.Duelist; 5 | 6 | namespace SolStandard.Utility.Events 7 | { 8 | public class EndTurnEvent : IEvent 9 | { 10 | public bool Complete { get; private set; } 11 | private readonly bool duelistHasFocusPoints; 12 | 13 | public EndTurnEvent() 14 | { 15 | duelistHasFocusPoints = FocusStatus.ActiveDuelistHasFocusPoints; 16 | } 17 | 18 | public void Continue() 19 | { 20 | if (duelistHasFocusPoints) 21 | { 22 | (GlobalContext.ActiveUnit.StatusEffects.Find(status => status is FocusStatus) as FocusStatus) 23 | ?.StartAdditionalAction(); 24 | } 25 | //IMPORTANT Do not allow tiles that have been triggered to trigger again or the risk of soft-locking via infinite triggers can occur 26 | else if (!WorldContext.TriggerEffectTiles(EffectTriggerTime.EndOfTurn, false)) 27 | { 28 | WorldContext.FinishTurn(false); 29 | } 30 | 31 | Complete = true; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/MenuContext.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SolStandard.HUD.Menu 4 | { 5 | public class MenuContext 6 | { 7 | private readonly Stack menuStack; 8 | public IMenu CurrentMenu => menuStack.Count > 0 ? menuStack.Peek() : null; 9 | public bool IsAtRootMenu => menuStack.Count < 2; 10 | 11 | public MenuContext(IMenu initialMenu) 12 | { 13 | menuStack = new Stack(); 14 | menuStack.Push(initialMenu); 15 | } 16 | 17 | public void OpenSubMenu(IMenu submenu) 18 | { 19 | menuStack.Push(submenu); 20 | } 21 | 22 | public void GoToPreviousMenu() 23 | { 24 | menuStack.Pop(); 25 | } 26 | 27 | public void ClearMenuStack() 28 | { 29 | menuStack.Clear(); 30 | } 31 | 32 | public void Hide() 33 | { 34 | foreach (IMenu menu in menuStack) 35 | { 36 | menu.IsVisible = false; 37 | } 38 | } 39 | 40 | public void Unhide() 41 | { 42 | foreach (IMenu menu in menuStack) 43 | { 44 | menu.IsVisible = true; 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/AI/CreepEndTurnEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Entity; 4 | using SolStandard.Entity.Unit; 5 | using SolStandard.Map; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.Utility.Events.AI 9 | { 10 | public class CreepEndTurnEvent : IEvent 11 | { 12 | public bool Complete { get; private set; } 13 | 14 | public void Continue() 15 | { 16 | MapContainer.ClearDynamicAndPreviewGrids(); 17 | 18 | if (GlobalContext.WorldContext.SelectedUnit != null) 19 | { 20 | GlobalContext.WorldContext.SelectedUnit.SetUnitAnimation(UnitAnimationState.Idle); 21 | } 22 | 23 | //IMPORTANT Do not allow tiles that have been triggered to trigger again or the risk of soft-locking via infinite triggers can occur 24 | if (!WorldContext.TriggerEffectTiles(EffectTriggerTime.EndOfTurn, true)) 25 | { 26 | GlobalContext.WorldContext.ResolveTurn(); 27 | MapContainer.ClearDynamicAndPreviewGrids(); 28 | } 29 | 30 | AssetManager.MapUnitCancelSFX.Play(); 31 | Complete = true; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ControlsMenu/ResetControllerConfigOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Containers.Components.InputRemapping; 4 | using SolStandard.HUD.Window; 5 | using SolStandard.HUD.Window.Content; 6 | using SolStandard.Utility; 7 | using SolStandard.Utility.Assets; 8 | 9 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ControlsMenu 10 | { 11 | public class ResetControllerConfigOption : MenuOption 12 | { 13 | private readonly string label; 14 | private readonly ControlConfigContext.Device deviceType; 15 | 16 | public ResetControllerConfigOption(string label, ControlConfigContext.Device deviceType, Color color) : 17 | base(new RenderText(AssetManager.WindowFont, label), color, HorizontalAlignment.Centered) 18 | { 19 | this.label = label; 20 | this.deviceType = deviceType; 21 | } 22 | 23 | public override void Execute() 24 | { 25 | GlobalContext.ControlConfigContext.ResetMetaController(deviceType); 26 | } 27 | 28 | public override IRenderable Clone() 29 | { 30 | return new ResetControllerConfigOption(label, deviceType, DefaultColor); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/ImmovableStatus.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility; 3 | using SolStandard.Utility.Assets; 4 | 5 | namespace SolStandard.Entity.Unit.Statuses 6 | { 7 | public class ImmovableStatus : StatusEffect 8 | { 9 | public ImmovableStatus(IRenderable icon, int turnDuration) : base( 10 | statusIcon: icon, 11 | name: "Immovable!", 12 | description: "Cannot be moved by other unit abilities.", 13 | turnDuration: turnDuration, 14 | hasNotification: false, 15 | canCleanse: false 16 | ) 17 | { 18 | } 19 | 20 | public override void ApplyEffect(GameUnit target) 21 | { 22 | AssetManager.SkillBuffSFX.Play(); 23 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit( 24 | target.UnitEntity, 25 | Name, 26 | 50 27 | ); 28 | target.IsMovable = false; 29 | } 30 | 31 | protected override void ExecuteEffect(GameUnit target) 32 | { 33 | //Do nothing 34 | } 35 | 36 | public override void RemoveEffect(GameUnit target) 37 | { 38 | target.IsMovable = true; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/PauseMenu/ConfigMenu/ReturnToPauseMenuOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Containers.Components.World.SubContext.Pause; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options.PauseMenu.ConfigMenu 9 | { 10 | public class ReturnToPauseMenuOption : MenuOption 11 | { 12 | public static bool FromMainMenu { get; set; } 13 | 14 | public ReturnToPauseMenuOption(Color color) : base( 15 | new RenderText(AssetManager.WindowFont, "Back"), 16 | color 17 | ) 18 | { 19 | } 20 | 21 | public override void Execute() 22 | { 23 | if (FromMainMenu) 24 | { 25 | AssetManager.MapUnitSelectSFX.Play(); 26 | GlobalContext.CurrentGameState = GlobalContext.GameState.MainMenu; 27 | } 28 | else 29 | { 30 | PauseScreenUtils.ChangeMenu(PauseScreenUtils.PauseMenus.Primary); 31 | } 32 | } 33 | 34 | public override IRenderable Clone() 35 | { 36 | return new ReturnToPauseMenuOption(DefaultColor); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Juice/MoveSmoother.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility.HUD.Juice 4 | { 5 | public class MoveSmoother 6 | { 7 | public Vector2 CurrentPosition => currentPosition; 8 | public Vector2 TargetPosition => targetPosition; 9 | 10 | private float Speed { get; } 11 | 12 | private Vector2 currentPosition; 13 | private Vector2 targetPosition; 14 | 15 | public MoveSmoother(Vector2 initialPosition, float speed) 16 | { 17 | Speed = speed; 18 | currentPosition = initialPosition; 19 | targetPosition = initialPosition; 20 | } 21 | 22 | public void MoveTowards(Vector2 newTarget) 23 | { 24 | targetPosition = newTarget.WithoutPrecision(); 25 | } 26 | 27 | public void SnapTo(Vector2 newTarget) 28 | { 29 | targetPosition = newTarget.WithoutPrecision(); 30 | currentPosition = newTarget.WithoutPrecision(); 31 | } 32 | 33 | public void Update() 34 | { 35 | currentPosition.X = MathUtils.AsymptoticAverage(currentPosition.X, targetPosition.X, Speed); 36 | currentPosition.Y = MathUtils.AsymptoticAverage(currentPosition.Y, targetPosition.Y, Speed); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Containers/Components/EULA/EULAContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Map.Elements; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Containers.Components.EULA 7 | { 8 | public class EULAContext 9 | { 10 | private const string EULAFileName = "EULA_Confirmed"; 11 | public ScrollingTextPaneHUD EULAHUD { get; } 12 | 13 | public bool EULAConfirmed { get; private set; } 14 | 15 | public EULAContext() 16 | { 17 | var savedEula = GameDriver.FileIO.Load(EULAFileName); 18 | EULAConfirmed = savedEula != null && savedEula == true; 19 | EULAHUD = new EULAHUD(); 20 | } 21 | 22 | public void ConfirmEULAPrompt() 23 | { 24 | AssetManager.MenuConfirmSFX.Play(); 25 | GameDriver.FileIO.Save(EULAFileName, true); 26 | EULAConfirmed = true; 27 | GlobalContext.CurrentGameState = GlobalContext.GameState.MainMenu; 28 | } 29 | 30 | public void ScrollWindow(Direction direction) 31 | { 32 | EULAHUD.ScrollContents(direction); 33 | }public void Update(GameTime gameTime) 34 | { 35 | throw new System.NotImplementedException(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /SolStandard/Map/Camera/MoveSmoother.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility; 3 | 4 | namespace SolStandard.Map.Camera 5 | { 6 | public class MoveSmoother 7 | { 8 | public Vector2 CurrentPosition => currentPosition; 9 | public Vector2 TargetPosition => targetPosition; 10 | 11 | private float Speed { get; } 12 | 13 | private Vector2 currentPosition; 14 | private Vector2 targetPosition; 15 | 16 | public MoveSmoother(Vector2 initialPosition, float speed) 17 | { 18 | Speed = speed; 19 | currentPosition = initialPosition; 20 | targetPosition = initialPosition; 21 | } 22 | 23 | public void MoveTowards(Vector2 newTarget) 24 | { 25 | targetPosition = newTarget.WithoutPrecision(); 26 | } 27 | 28 | public void SnapTo(Vector2 newTarget) 29 | { 30 | targetPosition = newTarget.WithoutPrecision(); 31 | currentPosition = newTarget.WithoutPrecision(); 32 | } 33 | 34 | public void Update() 35 | { 36 | currentPosition.X = MathUtils.AsymptoticAverage(currentPosition.X, targetPosition.X, Speed); 37 | currentPosition.Y = MathUtils.AsymptoticAverage(currentPosition.Y, targetPosition.Y, Speed); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/HudNotification.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using SolStandard.HUD.Window.Content; 4 | using SolStandard.Utility; 5 | using SolStandard.Utility.Assets; 6 | 7 | namespace SolStandard.HUD.Window 8 | { 9 | public class HudNotification : IRenderable 10 | { 11 | private static readonly Color WindowColor = new Color(40, 40, 40, 180); 12 | 13 | private readonly IRenderable content; 14 | public int Height => content.Height; 15 | public int Width => content.Width; 16 | public Color DefaultColor { get; set; } 17 | 18 | public HudNotification(string notificationMessage) 19 | { 20 | content = new Window(new RenderText(AssetManager.WindowFont, notificationMessage), WindowColor); 21 | DefaultColor = WindowColor; 22 | } 23 | 24 | public void Draw(SpriteBatch spriteBatch, Vector2 position) 25 | { 26 | Draw(spriteBatch, position, DefaultColor); 27 | } 28 | 29 | public void Draw(SpriteBatch spriteBatch, Vector2 position, Color colorOverride) 30 | { 31 | content.Draw(spriteBatch, position, colorOverride); 32 | } 33 | 34 | public IRenderable Clone() 35 | { 36 | return content.Clone(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/TriggerSingleEffectTileEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Entity; 2 | 3 | namespace SolStandard.Utility.Events 4 | { 5 | public class TriggerSingleEffectTileEvent : IEvent 6 | { 7 | public bool Complete { get; private set; } 8 | private readonly IEffectTile effectTile; 9 | private readonly EffectTriggerTime effectTriggerTime; 10 | private readonly int delayTime; 11 | private int delayTicker; 12 | 13 | public TriggerSingleEffectTileEvent(IEffectTile effectTile, EffectTriggerTime effectTriggerTime, 14 | int delayTime = 100) 15 | { 16 | this.effectTile = effectTile; 17 | this.effectTriggerTime = effectTriggerTime; 18 | this.delayTime = delayTime; 19 | delayTicker = delayTime; 20 | } 21 | 22 | public void Continue() 23 | { 24 | if (delayTicker == delayTime) 25 | { 26 | if (!effectTile.Trigger(effectTriggerTime)) 27 | { 28 | Complete = true; 29 | return; 30 | } 31 | 32 | effectTile.HasTriggered = true; 33 | } 34 | 35 | delayTicker--; 36 | 37 | if (delayTicker > 0) return; 38 | 39 | Complete = true; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/SkippableWaitFramesEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Utility.Inputs; 3 | 4 | namespace SolStandard.Utility.Events 5 | { 6 | public class SkippableWaitFramesEvent : IEvent 7 | { 8 | public bool Complete { get; private set; } 9 | private int framesRemaining; 10 | 11 | public SkippableWaitFramesEvent(int waitTimeInFrames) 12 | { 13 | Complete = false; 14 | framesRemaining = waitTimeInFrames; 15 | } 16 | 17 | public void Continue() 18 | { 19 | if (!GameDriver.ConnectedAsClient && !GameDriver.ConnectedAsServer) 20 | { 21 | ControlMapper p1Input = GameDriver.GetControlMapperForPlayer(PlayerIndex.One); 22 | ControlMapper p2Input = GameDriver.GetControlMapperForPlayer(PlayerIndex.Two); 23 | if (p1Input.Press(Input.Confirm, PressType.InstantRepeat) || 24 | p2Input.Press(Input.Confirm, PressType.InstantRepeat)) 25 | { 26 | framesRemaining = 0; 27 | } 28 | } 29 | 30 | if (framesRemaining > 0) 31 | { 32 | framesRemaining--; 33 | } 34 | else 35 | { 36 | Complete = true; 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Utility/System/TemporaryFilesIO.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization.Formatters.Binary; 3 | 4 | namespace SolStandard.Utility.System 5 | { 6 | public class TemporaryFilesIO : IFileIO 7 | { 8 | public const string GameFolder = "SolStandard"; 9 | private static readonly string SaveFolder = Path.Combine(Path.GetTempPath(), GameFolder); 10 | 11 | public void Save(string fileName, object content) 12 | { 13 | Directory.CreateDirectory(SaveFolder); 14 | 15 | string fileToSaveTo = Path.Combine(SaveFolder, fileName); 16 | using Stream stream = File.OpenWrite(fileToSaveTo); 17 | new BinaryFormatter().Serialize(stream, content); 18 | } 19 | 20 | public T Load(string fileName) 21 | { 22 | string fileToLoadFrom = Path.Combine(SaveFolder, fileName); 23 | 24 | if (!Directory.Exists(SaveFolder) || !File.Exists(fileToLoadFrom)) return default; 25 | 26 | using Stream stream = File.OpenRead(fileToLoadFrom); 27 | return (T) new BinaryFormatter().Deserialize(stream); 28 | } 29 | 30 | public bool FileExists(string fileName) 31 | { 32 | string fileToLoadFrom = Path.Combine(SaveFolder, fileName); 33 | return Directory.Exists(SaveFolder) && File.Exists(fileToLoadFrom); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/MoveMapCursorEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Map.Elements; 4 | 5 | namespace SolStandard.Utility.Events.Network 6 | { 7 | [Serializable] 8 | public class MoveMapCursorEvent : NetworkEvent 9 | { 10 | private readonly Direction direction; 11 | private readonly GlobalContext.GameState gameState; 12 | 13 | public MoveMapCursorEvent(Direction direction, GlobalContext.GameState gameState) 14 | { 15 | this.direction = direction; 16 | this.gameState = gameState; 17 | } 18 | 19 | public override void Continue() 20 | { 21 | switch (gameState) 22 | { 23 | case GlobalContext.GameState.Deployment: 24 | GlobalContext.DeploymentContext.MoveCursorOnMap(direction); 25 | break; 26 | case GlobalContext.GameState.MapSelect: 27 | GlobalContext.MapCursor.MoveCursorInDirection(direction); 28 | GlobalContext.MapSelectContext.HoverOverEntity(); 29 | break; 30 | case GlobalContext.GameState.InGame: 31 | GlobalContext.WorldContext.MoveCursorOnMap(direction); 32 | break; 33 | } 34 | 35 | Complete = true; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/ConcedeEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Containers.Scenario; 4 | using SolStandard.Containers.Scenario.Objectives; 5 | using SolStandard.Entity.Unit; 6 | using SolStandard.Utility.Exceptions; 7 | 8 | namespace SolStandard.Utility.Events.Network 9 | { 10 | [Serializable] 11 | public class ConcedeEvent : NetworkEvent 12 | { 13 | public override void Continue() 14 | { 15 | if (GlobalContext.Scenario.Objectives[VictoryConditions.Surrender] is Surrender surrender) 16 | { 17 | switch (GlobalContext.ActiveTeam) 18 | { 19 | case Team.Red: 20 | surrender.RedConcedes = true; 21 | break; 22 | case Team.Blue: 23 | surrender.BlueConcedes = true; 24 | break; 25 | default: 26 | throw new ArgumentOutOfRangeException(); 27 | } 28 | 29 | //Exit the menu and end the turn 30 | GlobalContext.CurrentGameState = GlobalContext.GameState.InGame; 31 | } 32 | else 33 | { 34 | throw new ScenarioNotFoundException(); 35 | } 36 | 37 | Complete = true; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandardTest/HUD/Window/Content/Health/FakeResourceBar.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.Xna.Framework; 4 | using SolStandard.HUD.Window.Content.Health; 5 | using SolStandard.Utility; 6 | using SolStandardTest.Utility.Monogame; 7 | 8 | namespace SolStandardTest.HUD.Window.Content.Health 9 | { 10 | public class FakeResourceBar : HealthBar 11 | { 12 | public FakeResourceBar(int maxHp, int currentHp, Vector2 barSize) : base(maxHp, currentHp, barSize) 13 | { 14 | } 15 | 16 | protected override void AddHealthPoint(List points) 17 | { 18 | points.Add( 19 | new ResourcePoint( 20 | Vector2.One, 21 | new SpriteAtlas(new FakeTexture2D(""), Vector2.One), 22 | new SpriteAtlas(new FakeTexture2D(""), Vector2.One) 23 | ) 24 | ); 25 | } 26 | 27 | protected override void AddArmorPoint(List points) 28 | { 29 | AddHealthPoint(points); 30 | } 31 | 32 | public List GetHealthPips => HealthPips; 33 | 34 | public List GetArmorPips => ArmorPips; 35 | 36 | public IEnumerable HealthPipValues 37 | { 38 | get { return GetHealthPips.Select(pip => pip.Active.ToString()).ToList(); } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Assets/InputIconProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Containers.Components.Global; 4 | using SolStandard.Utility.Inputs; 5 | 6 | namespace SolStandard.Utility.Assets 7 | { 8 | public enum ControlType 9 | { 10 | Keyboard, 11 | Gamepad 12 | } 13 | 14 | public static class InputIconProvider 15 | { 16 | private static ControlType _lastInput = ControlType.Keyboard; 17 | 18 | public static void UpdateLastInputType(ControlType controlType) 19 | { 20 | _lastInput = controlType; 21 | } 22 | 23 | public static IRenderable GetInputIcon(Input inputType, int iconSize) 24 | { 25 | switch (_lastInput) 26 | { 27 | case ControlType.Keyboard: 28 | return GameDriver.KeyboardParser.Controller.GetInput(inputType).GetInputIcon(iconSize); 29 | case ControlType.Gamepad: 30 | GameControlParser activePlayerParser = (GlobalContext.ActivePlayer == PlayerIndex.One) 31 | ? GameDriver.P1GamepadParser 32 | : GameDriver.P2GamepadParser; 33 | 34 | return activePlayerParser.Controller.GetInput(inputType).GetInputIcon(iconSize); 35 | default: 36 | throw new ArgumentOutOfRangeException(); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Utility/RangeComparison.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.Xna.Framework; 5 | 6 | namespace SolStandard.Utility 7 | { 8 | public static class RangeComparison 9 | { 10 | /// 11 | /// Check if two points are within range on a square grid where each int is one cardinal direction point from the origin. 12 | /// 13 | /// NOTE: This assumes that there are no concentric rings in the range. 14 | /// 15 | /// NOTE: This does not account for pathing; this is a pure numbers comparison as if no obstacles would obstruct the range. 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// True if the target is within range. 21 | public static bool TargetIsWithinRangeOfOrigin(Vector2 originPosition, IEnumerable rangeFromOrigin, 22 | Vector2 targetPosition) 23 | { 24 | Vector2 adjustedTarget = targetPosition - originPosition; 25 | (float targetX, float targetY) = adjustedTarget; 26 | 27 | int distanceFromOrigin = Math.Abs(Convert.ToInt32(targetX)) + Math.Abs(Convert.ToInt32(targetY)); 28 | 29 | return rangeFromOrigin.Any(range => distanceFromOrigin == range); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/HUD/Juice/ColorShifter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace SolStandard.Utility.HUD.Juice 4 | { 5 | public class ColorShifter 6 | { 7 | public Color CurrentColor { get; private set; } 8 | public Color TargetColor { get; private set; } 9 | 10 | private readonly float speed; 11 | 12 | public ColorShifter(Color initialColor, float speed) 13 | { 14 | this.speed = speed; 15 | CurrentColor = initialColor; 16 | TargetColor = initialColor; 17 | } 18 | 19 | public void HueShiftTo(Color newTargetColor) 20 | { 21 | TargetColor = newTargetColor; 22 | } 23 | 24 | public void HueSnapTo(Color newTargetColor) 25 | { 26 | CurrentColor = newTargetColor; 27 | TargetColor = newTargetColor; 28 | } 29 | 30 | public void Update() 31 | { 32 | int nextRed = (int) MathUtils.AsymptoticAverage(CurrentColor.R, TargetColor.R, speed); 33 | int nextGreen = (int) MathUtils.AsymptoticAverage(CurrentColor.G, TargetColor.G, speed); 34 | int nextBlue = (int) MathUtils.AsymptoticAverage(CurrentColor.B, TargetColor.B, speed); 35 | int nextAlpha = (int) MathUtils.AsymptoticAverage(CurrentColor.A, TargetColor.A, speed); 36 | 37 | CurrentColor = new Color(nextRed, nextGreen, nextBlue, nextAlpha); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/RetributionStatUp.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Statuses 5 | { 6 | public class RetributionStatUp : StatusEffect 7 | { 8 | private readonly int retModifier; 9 | 10 | public RetributionStatUp(int turnDuration, int retModifier) : base( 11 | statusIcon: UnitStatistics.GetSpriteAtlas(Stats.Retribution, GameDriver.CellSizeVector), 12 | name: UnitStatistics.Abbreviation[Stats.Retribution] + " Up! <+" + retModifier + ">", 13 | description: "Increased retribution.", 14 | turnDuration: turnDuration, 15 | hasNotification: false, 16 | canCleanse: false 17 | ) 18 | { 19 | this.retModifier = retModifier; 20 | } 21 | 22 | public override void ApplyEffect(GameUnit target) 23 | { 24 | AssetManager.SkillBuffSFX.Play(); 25 | target.Stats.RetModifier += retModifier; 26 | 27 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit(target.UnitEntity, Name, 50); 28 | } 29 | 30 | protected override void ExecuteEffect(GameUnit target) 31 | { 32 | //Do nothing 33 | } 34 | 35 | public override void RemoveEffect(GameUnit target) 36 | { 37 | target.Stats.RetModifier -= retModifier; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/RetributionStatDown.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Statuses 5 | { 6 | public class RetributionStatDown : StatusEffect 7 | { 8 | private readonly int retToReduce; 9 | 10 | public RetributionStatDown(int turnDuration, int retToReduce) : base( 11 | statusIcon: UnitStatistics.GetSpriteAtlas(Stats.Retribution, GameDriver.CellSizeVector), 12 | name: UnitStatistics.Abbreviation[Stats.Retribution] + " Down! <-" + retToReduce + ">", 13 | description: "Decreased retribution.", 14 | turnDuration: turnDuration, 15 | hasNotification: false, 16 | canCleanse: true 17 | ) 18 | { 19 | this.retToReduce = retToReduce; 20 | } 21 | 22 | public override void ApplyEffect(GameUnit target) 23 | { 24 | AssetManager.SkillBuffSFX.Play(); 25 | target.Stats.RetModifier -= retToReduce; 26 | 27 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit(target.UnitEntity, Name, 50); 28 | } 29 | 30 | protected override void ExecuteEffect(GameUnit target) 31 | { 32 | //Do nothing 33 | } 34 | 35 | public override void RemoveEffect(GameUnit target) 36 | { 37 | target.Stats.RetModifier += retToReduce; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/AtkStatDown.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Statuses 5 | { 6 | public class AtkStatDown : StatusEffect 7 | { 8 | private readonly int pointsToReduce; 9 | 10 | public AtkStatDown(int turnDuration, int pointsToReduce, string name = null) : base( 11 | statusIcon: UnitStatistics.GetSpriteAtlas(Stats.Atk, GameDriver.CellSizeVector), 12 | name: name ?? UnitStatistics.Abbreviation[Stats.Atk] + " Down! <-" + pointsToReduce + ">", 13 | description: "Decreased attack power.", 14 | turnDuration: turnDuration, 15 | hasNotification: false, 16 | canCleanse: true 17 | ) 18 | { 19 | this.pointsToReduce = pointsToReduce; 20 | } 21 | 22 | public override void ApplyEffect(GameUnit target) 23 | { 24 | AssetManager.SkillBuffSFX.Play(); 25 | target.Stats.AtkModifier -= pointsToReduce; 26 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit(target.UnitEntity, Name, 50); 27 | } 28 | 29 | protected override void ExecuteEffect(GameUnit target) 30 | { 31 | //Do nothing. 32 | } 33 | 34 | public override void RemoveEffect(GameUnit target) 35 | { 36 | target.Stats.AtkModifier += pointsToReduce; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/ToastAtCoordinatesEvent.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Utility.Monogame; 4 | 5 | namespace SolStandard.Utility.Events 6 | { 7 | public class ToastAtCoordinatesEvent : IEvent 8 | { 9 | public bool Complete { get; private set; } 10 | private readonly string message; 11 | private readonly Vector2 toastCoordinates; 12 | private readonly int duration; 13 | private readonly ISoundEffect soundEffect; 14 | 15 | public ToastAtCoordinatesEvent(Vector2 toastCoordinates, string message, ISoundEffect soundEffect = null, 16 | int duration = 50) 17 | { 18 | this.message = message; 19 | this.soundEffect = soundEffect; 20 | this.toastCoordinates = toastCoordinates; 21 | this.duration = duration; 22 | } 23 | 24 | public ToastAtCoordinatesEvent(Vector2 toastCoordinates, string message, int duration) : 25 | this(toastCoordinates, message, null, duration) 26 | { 27 | } 28 | 29 | public void Continue() 30 | { 31 | soundEffect?.Play(); 32 | 33 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCellCoordinates( 34 | message, 35 | toastCoordinates, 36 | duration 37 | ); 38 | Complete = true; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Railgun.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.General.Item; 4 | using SolStandard.Entity.Unit.Actions; 5 | using SolStandard.Entity.Unit.Actions.Terrain; 6 | using SolStandard.HUD.Window; 7 | using SolStandard.Utility; 8 | 9 | namespace SolStandard.Entity.General 10 | { 11 | public class Railgun : TerrainEntity, IActionTile 12 | { 13 | public int[] InteractRange { get; } 14 | private int AtkRange { get; } 15 | private readonly WeaponStatistics weaponStatistics; 16 | private readonly Window statWindow; 17 | 18 | public Railgun(string name, string type, IRenderable sprite, Vector2 mapCoordinates, bool canMove, int atkRange, 19 | int atkDamage) : 20 | base(name, type, sprite, mapCoordinates) 21 | { 22 | CanMove = canMove; 23 | AtkRange = atkRange; 24 | InteractRange = new[] {0}; 25 | weaponStatistics = new WeaponStatistics(atkDamage, -100, new[] {AtkRange}, 100); 26 | statWindow = Weapon.BuildStatWindow(weaponStatistics); 27 | } 28 | 29 | public List TileActions() 30 | { 31 | return new List 32 | { 33 | new RailgunAction(Sprite, AtkRange, weaponStatistics) 34 | }; 35 | } 36 | 37 | protected override IRenderable EntityInfo => statWindow; 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Artillery.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.General.Item; 4 | using SolStandard.Entity.Unit.Actions; 5 | using SolStandard.Entity.Unit.Actions.Terrain; 6 | using SolStandard.HUD.Window; 7 | using SolStandard.Utility; 8 | 9 | namespace SolStandard.Entity.General 10 | { 11 | public class Artillery : TerrainEntity, IActionTile 12 | { 13 | public int[] InteractRange { get; } 14 | private int[] AtkRange { get; } 15 | private readonly WeaponStatistics weaponStatistics; 16 | private readonly Window statWindow; 17 | 18 | public Artillery(string name, string type, IRenderable sprite, Vector2 mapCoordinates, bool canMove, 19 | int[] atkRange, int atkDamage) : 20 | base(name, type, sprite, mapCoordinates) 21 | { 22 | CanMove = canMove; 23 | AtkRange = atkRange; 24 | InteractRange = new[] {0}; 25 | weaponStatistics = new WeaponStatistics(atkDamage, -100, AtkRange, 100); 26 | statWindow = Weapon.BuildStatWindow(weaponStatistics); 27 | } 28 | 29 | public List TileActions() 30 | { 31 | return new List 32 | { 33 | new ArtilleryAction(Sprite, AtkRange, weaponStatistics) 34 | }; 35 | } 36 | 37 | protected override IRenderable EntityInfo => statWindow; 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/AtkStatUp.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Statuses 5 | { 6 | public class AtkStatUp : StatusEffect 7 | { 8 | private readonly int pointsToIncrease; 9 | 10 | public AtkStatUp(int turnDuration, int pointsToIncrease, string name = null) : base( 11 | statusIcon: UnitStatistics.GetSpriteAtlas(Stats.Atk, GameDriver.CellSizeVector), 12 | name: name ?? UnitStatistics.Abbreviation[Stats.Atk] + " Up! <+" + pointsToIncrease + ">", 13 | description: "Increased attack power.", 14 | turnDuration: turnDuration, 15 | hasNotification: false, 16 | canCleanse: false 17 | ) 18 | { 19 | this.pointsToIncrease = pointsToIncrease; 20 | } 21 | 22 | public override void ApplyEffect(GameUnit target) 23 | { 24 | AssetManager.SkillBuffSFX.Play(); 25 | target.Stats.AtkModifier += pointsToIncrease; 26 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit(target.UnitEntity, Name, 50); 27 | } 28 | 29 | protected override void ExecuteEffect(GameUnit target) 30 | { 31 | //Do nothing. 32 | } 33 | 34 | public override void RemoveEffect(GameUnit target) 35 | { 36 | target.Stats.AtkModifier -= pointsToIncrease; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Utility/GlobalAsyncActions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Xna.Framework; 4 | using NLog; 5 | using SolStandard.Utility.Collections; 6 | 7 | namespace SolStandard.Utility 8 | { 9 | public static class GlobalAsyncActions 10 | { 11 | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); 12 | 13 | private static readonly List> PendingActions = 14 | new List>(); 15 | 16 | public static void PerformActionAfterTime(Action action, TimeSpan delay) 17 | { 18 | Logger.Trace("Adding new action: {}", action); 19 | PendingActions.Add(new MutableKeyValuePair(action, delay)); 20 | } 21 | 22 | public static void Update(GameTime gameTime) 23 | { 24 | foreach (MutableKeyValuePair kvp in PendingActions) 25 | { 26 | kvp.Value -= gameTime.ElapsedGameTime; 27 | 28 | if (kvp.Value > TimeSpan.Zero) continue; 29 | 30 | Logger.Trace("Invoking action: {}", kvp.Key); 31 | kvp.Key.Invoke(); 32 | } 33 | 34 | PendingActions.RemoveAll(kvp => kvp.Value <= TimeSpan.Zero); 35 | } 36 | 37 | public static void CancelAllActions() 38 | { 39 | PendingActions.Clear(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/BlkStatUp.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Statuses 5 | { 6 | public class BlkStatUp : StatusEffect 7 | { 8 | private readonly int pointsToIncrease; 9 | 10 | public BlkStatUp(int turnDuration, int pointsToIncrease, string name = null) : base( 11 | statusIcon: UnitStatistics.GetSpriteAtlas(Stats.Block, GameDriver.CellSizeVector), 12 | name: name ?? UnitStatistics.Abbreviation[Stats.Block] + " Up! <+" + pointsToIncrease + ">", 13 | description: "Increased damage mitigation.", 14 | turnDuration: turnDuration, 15 | hasNotification: false, 16 | canCleanse: false 17 | ) 18 | { 19 | this.pointsToIncrease = pointsToIncrease; 20 | } 21 | 22 | public override void ApplyEffect(GameUnit target) 23 | { 24 | AssetManager.SkillBuffSFX.Play(); 25 | target.Stats.BlkModifier += pointsToIncrease; 26 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit(target.UnitEntity, Name, 50); 27 | } 28 | 29 | protected override void ExecuteEffect(GameUnit target) 30 | { 31 | //Do nothing. 32 | } 33 | 34 | public override void RemoveEffect(GameUnit target) 35 | { 36 | target.Stats.BlkModifier -= pointsToIncrease; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SolStandard/Containers/Components/Global/StaticBackgroundView.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Containers.Components.Global 7 | { 8 | public class StaticBackgroundView : IUserInterface 9 | { 10 | private static readonly Color RenderColor = new Color(100, 100, 100); 11 | 12 | private static SpriteAtlas Background => 13 | new SpriteAtlas(AssetManager.MainMenuBackground, 14 | new Vector2(AssetManager.MainMenuBackground.Width, AssetManager.MainMenuBackground.Height), 15 | ScaleHeightToWidth( 16 | new Vector2(AssetManager.MainMenuBackground.Width, AssetManager.MainMenuBackground.Height), 17 | GameDriver.ScreenSize.X)); 18 | 19 | private static Vector2 ScaleHeightToWidth(Vector2 sourceProportions, float width) 20 | { 21 | var scaledProportions = new Vector2 {X = width, Y = sourceProportions.Y * width / sourceProportions.X}; 22 | return scaledProportions; 23 | } 24 | 25 | public void Draw(SpriteBatch spriteBatch) 26 | { 27 | Vector2 centerScreen = GameDriver.ScreenSize / 2; 28 | Vector2 backgroundCenter = new Vector2(Background.Width, Background.Height) / 2; 29 | Background.Draw(spriteBatch, centerScreen - backgroundCenter, RenderColor); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/StartCombatEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Entity.Unit; 4 | using SolStandard.Utility.Assets; 5 | 6 | namespace SolStandard.Utility.Events 7 | { 8 | public class StartCombatEvent : IEvent 9 | { 10 | private readonly GameUnit targetUnit; 11 | private readonly bool freeAction; 12 | private readonly UnitStatistics attackerStatsOverride; 13 | 14 | public bool Complete { get; private set; } 15 | 16 | public StartCombatEvent(GameUnit targetUnit, bool freeAction = false, 17 | UnitStatistics attackerStatsOverride = null) 18 | { 19 | this.targetUnit = targetUnit; 20 | this.freeAction = freeAction; 21 | 22 | this.attackerStatsOverride = attackerStatsOverride ?? GlobalContext.ActiveUnit.Stats; 23 | } 24 | 25 | public void Continue() 26 | { 27 | GameUnit attackingUnit = GlobalContext.ActiveUnit; 28 | GameUnit defendingUnit = targetUnit; 29 | 30 | GlobalContext.CombatPhase.StartNewCombat(attackingUnit, defendingUnit, attackerStatsOverride, 31 | defendingUnit.Stats, freeAction); 32 | 33 | AssetManager.CombatStartSFX.Play(); 34 | 35 | 36 | GlobalContext.WorldContext.CurrentTurnState = WorldContext.TurnState.UnitActing; 37 | Complete = true; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/LuckStatUp.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Utility.Assets; 3 | 4 | namespace SolStandard.Entity.Unit.Statuses 5 | { 6 | public class LuckStatUp : StatusEffect 7 | { 8 | private readonly int luckModifier; 9 | 10 | public LuckStatUp(int turnDuration, int luckModifier) : base( 11 | statusIcon: UnitStatistics.GetSpriteAtlas(Stats.Luck, GameDriver.CellSizeVector), 12 | name: UnitStatistics.Abbreviation[Stats.Luck] + " Up! <+" + luckModifier + ">", 13 | description: "Increased luck.", 14 | turnDuration: turnDuration, 15 | hasNotification: false, 16 | canCleanse: false 17 | ) 18 | { 19 | this.luckModifier = luckModifier; 20 | } 21 | 22 | public override void ApplyEffect(GameUnit target) 23 | { 24 | AssetManager.SkillBuffSFX.Play(); 25 | target.Stats.LuckModifier += luckModifier; 26 | 27 | GlobalContext.WorldContext.MapContainer.AddNewToastAtUnit( 28 | target.UnitEntity, 29 | Name, 30 | 50 31 | ); 32 | } 33 | 34 | protected override void ExecuteEffect(GameUnit target) 35 | { 36 | //Do nothing 37 | } 38 | 39 | public override void RemoveEffect(GameUnit target) 40 | { 41 | target.Stats.LuckModifier -= luckModifier; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/PlaceEntityOnMapEvent.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.Map; 4 | using SolStandard.Map.Elements; 5 | using SolStandard.Utility.Monogame; 6 | 7 | namespace SolStandard.Utility.Events 8 | { 9 | public class PlaceEntityOnMapEvent : IEvent 10 | { 11 | private readonly MapEntity entityToPlace; 12 | private readonly Layer mapLayer; 13 | private readonly ISoundEffect soundEffect; 14 | 15 | public PlaceEntityOnMapEvent(MapEntity entityToPlace, Layer mapLayer, ISoundEffect soundEffect) 16 | { 17 | this.entityToPlace = entityToPlace; 18 | this.mapLayer = mapLayer; 19 | this.soundEffect = soundEffect; 20 | } 21 | 22 | public bool Complete { get; private set; } 23 | 24 | public void Continue() 25 | { 26 | MapContainer.GameGrid[(int) mapLayer][(int) entityToPlace.MapCoordinates.X, 27 | (int) entityToPlace.MapCoordinates.Y] = entityToPlace; 28 | 29 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCellCoordinates( 30 | "Placed " + entityToPlace.Name + "!", 31 | entityToPlace.MapCoordinates, 32 | 50 33 | ); 34 | 35 | soundEffect.Play(); 36 | 37 | WorldContext.WorldHUD.GenerateObjectiveWindow(); 38 | 39 | Complete = true; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SolStandard/Utility/Events/Network/CombatNotifyStateCompleteEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NLog; 3 | using SolStandard.Containers.Components.Global; 4 | using SolStandard.Containers.Components.World.SubContext.Battle; 5 | 6 | namespace SolStandard.Utility.Events.Network 7 | { 8 | [Serializable] 9 | public class CombatNotifyStateCompleteEvent : NetworkEvent 10 | { 11 | private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); 12 | 13 | private readonly CombatPhase.BattleState battleState; 14 | 15 | public CombatNotifyStateCompleteEvent(CombatPhase.BattleState battleState) 16 | { 17 | this.battleState = battleState; 18 | } 19 | 20 | public override void Continue() 21 | { 22 | //Notify peer that we have finished the current combat step 23 | //Don't process this if you sent it yourself 24 | if (FromServer && GameDriver.ConnectedAsServer) 25 | { 26 | //Do nothing 27 | } 28 | else if (!FromServer && GameDriver.ConnectedAsClient) 29 | { 30 | //Do nothing 31 | } 32 | else 33 | { 34 | GlobalContext.CombatPhase.PeerCanContinue = true; 35 | Logger.Debug("Received completed battlestate from peer: " + battleState + 36 | ". Current state: " + GlobalContext.CombatPhase.CurrentState); 37 | } 38 | 39 | Complete = true; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Wait.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Map; 4 | using SolStandard.Map.Elements; 5 | using SolStandard.Map.Elements.Cursor; 6 | using SolStandard.Utility.Assets; 7 | using SolStandard.Utility.Events; 8 | 9 | namespace SolStandard.Entity.Unit.Actions 10 | { 11 | public class Wait : UnitAction 12 | { 13 | public Wait() : base( 14 | icon: SkillIconProvider.GetSkillIcon(SkillIcon.Wait, GameDriver.CellSizeVector), 15 | name: "Wait", 16 | description: "Take no action and end your turn.", 17 | tileSprite: MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Action), 18 | range: new[] {0}, 19 | freeAction: false 20 | ) 21 | { 22 | } 23 | 24 | public override void ExecuteAction(MapSlice targetSlice) 25 | { 26 | if (targetSlice.DynamicEntity != null) 27 | { 28 | MapContainer.ClearDynamicAndPreviewGrids(); 29 | 30 | var eventQueue = new Queue(); 31 | eventQueue.Enqueue(new WaitActionEvent()); 32 | eventQueue.Enqueue(new EndTurnEvent()); 33 | GlobalEventQueue.QueueEvents(eventQueue); 34 | } 35 | else 36 | { 37 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor("Can't wait here!", 50); 38 | AssetManager.WarningSFX.Play(); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Pugilist/Meditate.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Containers.Components.Global; 2 | using SolStandard.Entity.Unit.Actions.Cleric; 3 | using SolStandard.Map.Elements; 4 | using SolStandard.Map.Elements.Cursor; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | using SolStandard.Utility.Events; 8 | 9 | namespace SolStandard.Entity.Unit.Actions.Pugilist 10 | { 11 | public class Meditate : UnitAction 12 | { 13 | public Meditate() : base( 14 | icon: SkillIconProvider.GetSkillIcon(SkillIcon.Meditate, GameDriver.CellSizeVector), 15 | name: "Meditate", 16 | description: "Remove all cleansable status effects on self.", 17 | tileSprite: MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Action), 18 | range: new[] {0}, 19 | freeAction: true 20 | ) 21 | { 22 | } 23 | 24 | public override void ExecuteAction(MapSlice targetSlice) 25 | { 26 | GameUnit targetUnit = UnitSelector.SelectUnit(targetSlice.UnitEntity); 27 | 28 | if (TargetIsSelfInRange(targetSlice, targetUnit)) 29 | { 30 | Cleanse.CleanseAllCleansableStatuses(targetUnit); 31 | GlobalEventQueue.QueueSingleEvent(new AdditionalActionEvent()); 32 | } 33 | else 34 | { 35 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor("Must target self!", 50); 36 | AssetManager.WarningSFX.Play(); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/Content/RenderText.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using SolStandard.Utility; 4 | using SolStandard.Utility.Monogame; 5 | 6 | namespace SolStandard.HUD.Window.Content 7 | { 8 | public class RenderText : IRenderable 9 | { 10 | private readonly ISpriteFont font; 11 | private readonly string message; 12 | private const string Space = " "; 13 | public Color DefaultColor { get; set; } 14 | 15 | public RenderText(ISpriteFont font, string message, Color color) 16 | { 17 | this.font = font; 18 | this.message = message; 19 | DefaultColor = color; 20 | } 21 | 22 | public RenderText(ISpriteFont font, string message) : this(font, message, Color.White) 23 | { 24 | //Intentionally left blank 25 | } 26 | 27 | public int Height => (int) font.MeasureString(message).Y; 28 | 29 | public int Width => (int) font.MeasureString(message + Space).X; 30 | 31 | public void Draw(SpriteBatch spriteBatch, Vector2 position) 32 | { 33 | Draw(spriteBatch, position, DefaultColor); 34 | } 35 | 36 | public void Draw(SpriteBatch spriteBatch, Vector2 position, Color colorOverride) 37 | { 38 | spriteBatch.DrawString(font.MonoGameSpriteFont, message, position, colorOverride); 39 | } 40 | 41 | public IRenderable Clone() 42 | { 43 | return new RenderText(font, message, DefaultColor); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Window/AnimatedRenderable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using SolStandard.HUD.Window.Animation; 4 | using SolStandard.Utility; 5 | 6 | namespace SolStandard.HUD.Window 7 | { 8 | public class AnimatedRenderable : IRenderable 9 | { 10 | private IRenderableAnimation RenderableAnimation { get; } 11 | private IRenderable Content { get; } 12 | public int Height => Content.Height; 13 | public int Width => Content.Width; 14 | 15 | public AnimatedRenderable(IRenderable content, IRenderableAnimation renderableAnimation) 16 | { 17 | Content = content; 18 | RenderableAnimation = renderableAnimation; 19 | } 20 | 21 | public Color DefaultColor 22 | { 23 | get => Content.DefaultColor; 24 | set => Content.DefaultColor = value; 25 | } 26 | 27 | public void Draw(SpriteBatch spriteBatch, Vector2 position) 28 | { 29 | RenderableAnimation.Update(position); 30 | Content.Draw(spriteBatch, RenderableAnimation.CurrentPosition); 31 | } 32 | 33 | public void Draw(SpriteBatch spriteBatch, Vector2 position, Color colorOverride) 34 | { 35 | RenderableAnimation.Update(position); 36 | Content.Draw(spriteBatch, RenderableAnimation.CurrentPosition, colorOverride); 37 | } 38 | 39 | public IRenderable Clone() 40 | { 41 | return new AnimatedRenderable(Content, RenderableAnimation); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Statuses/StatusEffect.cs: -------------------------------------------------------------------------------- 1 | using SolStandard.Utility; 2 | 3 | namespace SolStandard.Entity.Unit.Statuses 4 | { 5 | public abstract class StatusEffect 6 | { 7 | public IRenderable StatusIcon { get; } 8 | public string Name { get; protected set; } 9 | public string Description { get; } 10 | public int TurnDuration { get; protected set; } 11 | public bool HasNotification { get; } 12 | public bool CanCleanse { get; } 13 | 14 | protected StatusEffect(IRenderable statusIcon, string name, string description, int turnDuration, 15 | bool hasNotification, bool canCleanse) 16 | { 17 | StatusIcon = statusIcon; 18 | Name = name; 19 | Description = description; 20 | TurnDuration = turnDuration; 21 | HasNotification = hasNotification; 22 | CanCleanse = canCleanse; 23 | } 24 | 25 | public abstract void ApplyEffect(GameUnit target); 26 | 27 | public void UpdateEffect(GameUnit target) 28 | { 29 | TurnDuration--; 30 | 31 | if (TurnDuration < 1) 32 | { 33 | ExecuteEffect(target); 34 | RemoveEffect(target); 35 | target.StatusEffects.Remove(this); 36 | } 37 | else 38 | { 39 | ExecuteEffect(target); 40 | } 41 | } 42 | 43 | protected abstract void ExecuteEffect(GameUnit target); 44 | public abstract void RemoveEffect(GameUnit target); 45 | } 46 | } -------------------------------------------------------------------------------- /SolStandard/Entity/General/Item/Relic.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Xna.Framework; 3 | using SolStandard.Entity.Unit.Actions; 4 | using SolStandard.Entity.Unit.Actions.Item; 5 | using SolStandard.Entity.Unit.Actions.Terrain; 6 | using SolStandard.Utility; 7 | 8 | namespace SolStandard.Entity.General.Item 9 | { 10 | public class Relic : TerrainEntity, IItem, IActionTile 11 | { 12 | public string ItemPool { get; } 13 | public int[] InteractRange { get; } 14 | 15 | public Relic(string name, string type, IRenderable sprite, Vector2 mapCoordinates, int[] pickupRange, 16 | string itemPool) : 17 | base(name, type, sprite, mapCoordinates) 18 | { 19 | ItemPool = itemPool; 20 | InteractRange = pickupRange; 21 | } 22 | 23 | public bool IsBroken => false; 24 | 25 | public IRenderable Icon => Sprite; 26 | 27 | public UnitAction UseAction() 28 | { 29 | return new DropGiveItemAction(this); 30 | } 31 | 32 | public UnitAction DropAction() 33 | { 34 | return new DropGiveItemAction(this); 35 | } 36 | 37 | public IItem Duplicate() 38 | { 39 | return new Relic(Name, Type, Sprite.Clone(), MapCoordinates, InteractRange, ItemPool); 40 | } 41 | 42 | 43 | public List TileActions() 44 | { 45 | return new List 46 | { 47 | new PickUpItemAction(this, MapCoordinates) 48 | }; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /SolStandard/HUD/Menu/Options/SubmenuOption.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using SolStandard.Containers.Components.World; 3 | using SolStandard.HUD.Menu.Options.ActionMenu; 4 | using SolStandard.HUD.Window.Content; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | 8 | namespace SolStandard.HUD.Menu.Options 9 | { 10 | public class SubmenuOption : MenuOption, IOptionDescription 11 | { 12 | private readonly IMenu submenu; 13 | private readonly IRenderable icon; 14 | private readonly string label; 15 | public IRenderable Description { get; } 16 | 17 | public SubmenuOption(IMenu submenu, IRenderable icon, string label, Color color) : this( 18 | submenu, icon, label, string.Empty, color 19 | ) 20 | { 21 | } 22 | 23 | public SubmenuOption(IMenu submenu, IRenderable icon, string label, string description, Color color) : base( 24 | ActionOption.GenerateActionContent(icon, label, false), 25 | color 26 | ) 27 | { 28 | this.submenu = submenu; 29 | this.icon = icon; 30 | this.label = label; 31 | Description = new RenderText(AssetManager.WindowFont, description); 32 | } 33 | 34 | 35 | public override void Execute() 36 | { 37 | WorldContext.WorldHUD.ActionMenuContext.OpenSubMenu(submenu); 38 | } 39 | 40 | public override IRenderable Clone() 41 | { 42 | return new SubmenuOption(submenu, icon, label, DefaultColor); 43 | } 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /SolStandard/Entity/Unit/Actions/Rogue/ThrowingKnife.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SolStandard.Containers.Components.Global; 3 | using SolStandard.Map.Elements; 4 | using SolStandard.Map.Elements.Cursor; 5 | using SolStandard.Utility; 6 | using SolStandard.Utility.Assets; 7 | using SolStandard.Utility.Events; 8 | 9 | namespace SolStandard.Entity.Unit.Actions.Rogue 10 | { 11 | public class ThrowingKnife : UnitAction 12 | { 13 | public ThrowingKnife() : base( 14 | icon: SkillIconProvider.GetSkillIcon(SkillIcon.ThrowingKnife, GameDriver.CellSizeVector), 15 | name: "Throwing Knife", 16 | description: "Perform a basic ranged attack. " + Environment.NewLine + 17 | "Will not affect range when other units attack this one.", 18 | tileSprite: MapDistanceTile.GetTileSprite(MapDistanceTile.TileType.Attack), 19 | range: new[] {2}, 20 | freeAction: false 21 | ) 22 | { 23 | } 24 | 25 | 26 | public override void ExecuteAction(MapSlice targetSlice) 27 | { 28 | GameUnit targetUnit = UnitSelector.SelectUnit(targetSlice.UnitEntity); 29 | if (TargetIsAnEnemyInRange(targetSlice, targetUnit)) 30 | { 31 | GlobalEventQueue.QueueSingleEvent(new StartCombatEvent(targetUnit)); 32 | } 33 | else 34 | { 35 | GlobalContext.WorldContext.MapContainer.AddNewToastAtMapCursor("Can't attack here!", 50); 36 | AssetManager.WarningSFX.Play(); 37 | } 38 | } 39 | } 40 | } --------------------------------------------------------------------------------