static void Main(string[] args) { int.TryParse(ConfigurationManager.AppSettings["PointsToWin"], out _pointsToWin); _game = new GameCore(new RandomNumberGenerator(), _leaderBoard); Console.WriteLine("Please enter your username:"******"Your username is invalid. Quitting"); return; } _game.SetUsername(_userName); while (true) { NewGame(); Console.WriteLine("Play again? y/n"); if (Console.ReadLine().ToLower().Equals("n")) { break; } _game.ResetGame(); } }
public void InjectDependencies( List <CivilizationDisplayBase> civilizationDisplays, CoreSignals coreSignals, IGameCore gameCore, UIStateMachineBrain brain, CitySummaryManager citySummaryManager, IPossessionRelationship <IHexCell, ICity> cityLocationCanon, ITechCanon techCanon, IExplorationCanon explorationCanon, VisibilitySignals visibilitySignals, IFreeGreatPeopleCanon freeGreatPeopleCanon, ICameraFocuser cameraFocuser, [Inject(Id = "Free Techs Display")] RectTransform freeTechsDisplay, [Inject(Id = "Play Mode Default Panels")] List <RectTransform> defaultPanels, [Inject(Id = "Free Great People Notification")] RectTransform freeGreatPeopleNotification ) { CivilizationDisplays = civilizationDisplays; CoreSignals = coreSignals; GameCore = gameCore; Brain = brain; CitySummaryManager = citySummaryManager; CityLocationCanon = cityLocationCanon; TechCanon = techCanon; ExplorationCanon = explorationCanon; VisibilitySignals = visibilitySignals; FreeGreatPeopleCanon = freeGreatPeopleCanon; CameraFocuser = cameraFocuser; FreeTechsDisplay = freeTechsDisplay; DefaultPanels = defaultPanels; FreeGreatPeopleNotification = freeGreatPeopleNotification; }
public string OutputGameState(IGameCore game) { StringBuilder output = new StringBuilder(); Player player = game.Player; string nameString = string.Format("{0} the {1}", player.PlayerName, player.Title); output.AppendFormat("{0,-30}", nameString); output.AppendFormat("St:{0,-3}", player.Strength); output.AppendFormat("Dx:{0,-3}", player.Dexterity); output.AppendFormat("Co:{0,-3}", player.Constitution); output.AppendFormat("In:{0,-3}", player.Intelligence); output.AppendFormat("Lu:{0,-3}", player.Luck); output.AppendLine(); output.AppendFormat("Dlvl:{0,-4} ", game.Dungeon.CurrentDungeonLevel); output.AppendFormat("$:{0} ", "N/A"); output.AppendFormat("HP:{0}({1}) ", player.CurrentHP, player.MaxHP); output.AppendFormat("MP:{0}({1}) ", player.CurrentMP, player.MaxMP); output.AppendFormat("AC:{0} ", player.Armour); output.AppendFormat("XP:{0} ", "N/A"); output.AppendFormat("T:{0} ", "N/A"); output.AppendLine(); return(output.ToString()); }
/// <summary> /// Create new GameCorePlayer by the given arguments /// </summary> /// <param name="gameCore"></param> /// <param name="sidePlayer">The side of the player in play world</param> /// <returns>new GameCorePlayer that matched to the given arguments</returns> public static GameCorePlayer GetGameCorePlayer(IGameCore gameCore, Side sidePlayer) { if (sidePlayer == Side.Left) { //Create new struct with relevent player keyconfig (left player) KeyConfigPlayer keyConfig = new KeyConfigPlayer { PlayerUpKey = gameCore.GetKeyConfig().LeftPlayerUpKey, PlayerDownKey = gameCore.GetKeyConfig().LeftPlayerDownKey }; return new GameCorePlayer(gameCore.GetPlayerPaddle1(), gameCore.GetBall(), keyConfig, gameCore.GetPlayer1Text()); } else { //Create new struct with relevent player keyconfig (left player) KeyConfigPlayer keyConfig = new KeyConfigPlayer { PlayerUpKey = gameCore.GetKeyConfig().RightPlayerUpKey, PlayerDownKey = gameCore.GetKeyConfig().RightPlayerDownKey }; return new GameCorePlayer(gameCore.GetPlayerPaddle2(), gameCore.GetBall(), keyConfig, gameCore.GetPlayer2Text()); } }
internal ServiceManager(IGameCore game) { CurrentGame = game; Services = new Dictionary <Type, IService>(); ActiveServices = new Dictionary <Type, IActiveService>(); CurrentGame.TurnCompleted += GameTurnCompleted; }
public static void StartGame(IGameCore newGame) { if (Current != null) { Current.EndGame(); } Current = newGame; }
public void InjectDependencies( UIStateMachineBrain brain, IGameCore gameCore, FreeGreatPeopleDisplay freeGreatPeopleDisplay ) { Brain = brain; GameCore = gameCore; FreeGreatPeopleDisplay = freeGreatPeopleDisplay; }
private void InjectDependencies( TechTreeDisplay techTreeDisplay, IGameCore gameCore, [Inject(Id = "UI Animator")] Animator uiAnimator ) { TechTreeDisplay = techTreeDisplay; GameCore = gameCore; UIAnimator = uiAnimator; }
public void InjectDependencies( SocialPoliciesDisplay socialPoliciesDisplay, UIStateMachineBrain brain, IGameCore gameCore ) { SocialPoliciesDisplay = socialPoliciesDisplay; Brain = brain; GameCore = gameCore; }
public CompositeCitySignals(CitySignals signals, IGameCore gameCore, IPossessionRelationship <ICivilization, ICity> cityPossessionCanon ) { GameCore = gameCore; CityPossessionCanon = cityPossessionCanon; ActiveCivCityClickedSignal = signals.PointerClicked.Where(ActivCivCityFilter); }
public CompositeUnitSignals(UnitSignals signals, IGameCore gameCore, IPossessionRelationship <ICivilization, IUnit> unitPossessionCanon ) { GameCore = gameCore; UnitPossessionCanon = unitPossessionCanon; ActiveCivUnitClickedSignal = signals.Clicked.Where(ActiveCivUnitFilter); }
public void Init(IGameInput iInput, IGameCore iGameCore, IGameRender iGameRender) { theInput = iInput; theGameCore = iGameCore; theGameRender = iGameRender; theInput.ModuleInit(); theGameCore.ModuleInit(); theGameRender.ModuleInit(); }
public void InjectDependencies( IVisibilityCanon visibilityCanon, IExplorationCanon explorationCanon, IPlayerFactory playerFactory, IGameCore gameCore ) { VisibilityCanon = visibilityCanon; ExplorationCanon = explorationCanon; PlayerFactory = playerFactory; GameCore = gameCore; }
public PlayerComposer( IPlayerFactory playerFactory, ICivilizationFactory civFactory, IGameCore gameCore, IBrainPile brainPile ) { PlayerFactory = playerFactory; CivFactory = civFactory; GameCore = gameCore; BrainPile = brainPile; }
public void InjectDependencies( IWarCanon warCanon, ICivilizationFactory civilizationFactory, IGameCore gameCore, DiContainer container ) { WarCanon = warCanon; CivilizationFactory = civilizationFactory; GameCore = gameCore; Container = container; }
public ExplorationCanon( IGameCore gameCore, VisibilitySignals visibilitySignals, HexCellSignals cellSignals ) { GameCore = gameCore; VisibilitySignals = visibilitySignals; CellSignals = cellSignals; CellSignals.MapBeingClearedSignal.Subscribe(unit => Clear()); }
public void InjectDependencies( IGameCore gameCore, ICivDiscoveryCanon civDiscoveryCanon, IDiplomacyCore diplomacyCore, IExchangeBuilder exchangeBuilder ) { GameCore = gameCore; CivDiscoveryCanon = civDiscoveryCanon; DiplomacyCore = diplomacyCore; ExchangeBuilder = exchangeBuilder; }
public void InstantiateCore() { if (_logger == null) { _logger = new UniLogger(); } if (_core == null) { _core = new GameCore(_logger); } }
public VisibilityCanon( IGameCore gameCore, ITechCanon techCanon, VisibilitySignals visibilitySignals, HexCellSignals cellSignals ) { GameCore = gameCore; TechCanon = techCanon; VisibilitySignals = visibilitySignals; cellSignals.MapBeingClearedSignal.Subscribe(unit => ClearCellVisibility()); }
public string GetMapStateOutput(IGameCore game) { MapState mapState = game.Dungeon.CurrentMapState; char[,] output = new char[mapState.Map.Width, mapState.Map.Height]; OutputBasicTerrain(mapState.Map, output); OutputStairs(mapState.Map, output); OutputMonsters(game, output); return(BuildOutputString(output, mapState.Map.Width, mapState.Map.Height)); }
public void InjectDependencies( IGameCore gameCore, IFreeResourcesLogic freeResourcesLogic, IResourceExtractionLogic extractionLogic, IResourceTransferCanon resourceTransferCanon, [Inject(Id = "Available Resources")] IEnumerable <IResourceDefinition> availableResources ) { GameCore = gameCore; FreeResourcesLogic = freeResourcesLogic; ExtractionLogic = extractionLogic; ResourceTransferCanon = resourceTransferCanon; AvailableResources = availableResources; }
private void OutputMonsters(IGameCore game, char[,] output) { if (game.Player != null) { output[game.Player.Position.X, game.Player.Position.Y] = game.Player.Symbol; } foreach (IMonster m in game.Dungeon.CurrentMapState.Monsters) { output[m.Position.X, m.Position.Y] = m.Symbol; } }
public ConfigGameViewModel(IGameCore game) { this.Name = game.Name; this.UseTimeLimit = game.UseTimeLimit; this.MinPlayers = game.MinPlayers; this.MaxPlayers = game.MaxPlayers; this.MaxTimeLimit = game.MaxTimeLimit; this.CanUseTimeLimit = game.CanUseTimeLimit; this.Image = CommonUtils.GetIconGame(game); this.FillMaxPlayersItems(); this.FillMaxTimeLimitItems(); }
public static RoutedUICommand GetRoutedUIConfigGameCommand(IGameCore gameCore, int index) { return(new RoutedUICommand( $"Config {gameCore.Name}", //descripcion "Config", //accion typeof(Commands), new InputGestureCollection() { new KeyGesture((Key)(90 + index), ModifierKeys.Control) } )); }
public virtual void Update() { IGameCore game = Game.Current; MapState state = game.Dungeon.CurrentMapState; if(state.ArePositionsAdjacent(Position, game.Player.Position)) { AttackTargetAndOutput(game.Player); } }
public static Image GetIconGame(IGameCore game) { using (var ms = new System.IO.MemoryStream(game.Image)) { var image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; // here image.StreamSource = ms; image.EndInit(); return(new System.Windows.Controls.Image { Source = image }); } }
public void SetGameCore(IGameCore game) { Game = game; _startTime = DateTime.Now; // Start ticking game if (_timer == null) { _timer = new DispatcherTimer(); _timer.Interval = new TimeSpan(0, 0, 0, 0, 10); _timer.Tick += _timer_Tick; _timer.Start(); } }
public void InjectDependencies( UIStateMachineBrain brain, IMapComposer mapComposer, IVisibilityResponder visibilityResponder, IVisibilityCanon visibilityCanon, IExplorationCanon explorationCanon, IGameCore gameCore, IUnitMapIconManager unitMapIconManager, List <IPlayModeSensitiveElement> playModeSensitiveElements ) { Brain = brain; MapComposer = mapComposer; VisibilityResponder = visibilityResponder; VisibilityCanon = visibilityCanon; ExplorationCanon = explorationCanon; GameCore = gameCore; UnitMapIconManager = unitMapIconManager; PlayModeSensitiveElements = playModeSensitiveElements; }
private void ShowConfigGame() { var configGameViewModel = new ConfigGameViewModel(this.selectedGame); var configGame = new ConfigGame() { Game = this.selectedGame, DataContext = configGameViewModel }; configGame.Owner = this; configGame.ShowDialog(); if (configGame.DialogResult ?? true) { this.selectedGame = configGame.Game; FillPlayers(); } }
public void InstantiateCore() { if (_logger == null) { _logger = new UniLogger(); } if (_core == null) { IGameModuleCollection collection = new DefaultGameModuleCollection(); if (UseProxy) { var proxyFactory = new Proxy.DefaultProxyFactory(); collection = new Proxy.ProxyModuleCollection(collection, proxyFactory); } _core = new GameCore(_logger, collection); } }
public void InjectDependencies( IHexGrid grid, ICityConfig config, IUnitPositionCanon unitPositionCanon, ICombatExecuter combatExecuter, UIStateMachineBrain brain, IPopulationGrowthLogic growthLogic, IProductionLogic productionLogic, IYieldGenerationLogic resourceGenerationLogic, IGameCore gameCore, IPossessionRelationship <ICivilization, ICity> cityPossessionCanon, IPossessionRelationship <IHexCell, ICity> cityLocationCanon, [Inject(Id = "UI Animator")] Animator uiAnimator ) { Grid = grid; Config = config; UnitPositionCanon = unitPositionCanon; CombatExecuter = combatExecuter; Brain = brain; GrowthLogic = growthLogic; ProductionLogic = productionLogic; YieldGenerationLogic = resourceGenerationLogic; GameCore = gameCore; CityPossessionCanon = cityPossessionCanon; CityLocationCanon = cityLocationCanon; UIAnimator = uiAnimator; }