Ejemplo n.º 1
0
 protected Station(StationLocation stationLocation, ThreatController threatController)
 {
     Players = new List <Player>();
     IrreparableMalfunctions = new List <IrreparableMalfunction>();
     StationLocation         = stationLocation;
     ThreatController        = threatController;
 }
Ejemplo n.º 2
0
        public void AutomaticUpdate(object sender, EventArgs args)
        {
            try
            {
                var updatedCollection = ThreatController.Update();
                var updatedPage       = new UpdatePage(updatedCollection, "Успешно");

                updatedPage.Title = "Автообновление";
                updatedPage.UpdatedTable.ItemsSource = updatedCollection;

                updatedPage.ShowDialog();

                LastUpdateLabel.Content = Config.LastUpdate.ToString("dd.MM.yyyy HH:mm");
            }
            catch (Exception ex)
            {
                var p = new UpdatePage($"Ошибка автообновления ({ex.Message})");
                p.Title = "Ошибка автообновления";
                p.ShowDialog();
            }
            finally
            {
                timer.Interval = Config.UpdateInterval;
            }
        }
Ejemplo n.º 3
0
        private static void Test_MoveToMostPlayers_Helper(Dictionary <StationLocation, int> countsByLocation, StationLocation currentStation, StationLocation expectedNewStation)
        {
            var seeker = new Seeker {
                CurrentStation = currentStation
            };

            seeker.SetInitialPlacement(4);
            var threatController = new ThreatController(null, null, new List <ExternalThreat>(), new List <InternalThreat>(), null);
            var mockSittingDuck  = new Mock <SittingDuck>(MockBehavior.Strict, threatController, null, null);

            foreach (var countByLocation in countsByLocation)
            {
                var count    = countByLocation.Value;
                var location = countByLocation.Key;
                mockSittingDuck
                .Setup(f => f.GetPlayerCount(location))
                .Returns(count)
                .Verifiable();
                mockSittingDuck
                .Setup(f => f.RedDoorIsSealed)
                .Returns(false);
                mockSittingDuck
                .Setup(f => f.BlueDoorIsSealed)
                .Returns(false);
            }
            seeker.Initialize(mockSittingDuck.Object, null, null);
            seeker.MoveToMostPlayers();
            Assert.AreEqual(expectedNewStation, seeker.CurrentStation);
        }
 internal InterceptorStation(
     StationLocation stationLocation,
     ThreatController threatController,
     InterceptorsInSpaceComponent interceptorComponent) : base(stationLocation, threatController)
 {
     MovingIn            += UseBattleBots;
     InterceptorComponent = interceptorComponent;
 }
Ejemplo n.º 5
0
 public CheckoutWindow()
 {
     InitializeComponent();
     _threatController = new ThreatController(new ThreatBusiness(ConstantStrings.SourceFileName, ConstantStrings.SourceFileUrl, new ThreatRepository(ConstantStrings.LocalStorageFileName)));
     if (new FileInfo(ConstantStrings.LocalStorageFileName).Exists&& _threatController.GetAllShortThreats() != null)
     {
         MainWindowShow();
     }
 }
Ejemplo n.º 6
0
 protected UpperStation(
     StationLocation stationLocation,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(stationLocation, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
 }
Ejemplo n.º 7
0
        private void InitializeNewPaginator()
        {
            _pager = new Paginator <Threat>(ThreatController.GetData(), 15);

            _pager.IsFirstPage    += () => PrevPageButton.IsEnabled = false;
            _pager.IsLastPage     += () => NextPageButton.IsEnabled = false;
            _pager.IsNotFirstPage += () => PrevPageButton.IsEnabled = true;
            _pager.IsNotLastPage  += () => NextPageButton.IsEnabled = true;
        }
Ejemplo n.º 8
0
 protected override void PerformZAction(int currentTurn)
 {
     BonusThreat.Initialize(SittingDuck, ThreatController, EventMaster);
     ThreatController.AddInternalThreat(BonusThreat, currentTurn);
     while (BonusThreat.Position >= 0)
     {
         BonusThreat.Move(currentTurn);
     }
 }
Ejemplo n.º 9
0
 private void PoisonPlayer(object sender, PlayerMoveEventArgs args)
 {
     if (poisonedPlayers == null)
     {
         poisonedPlayers = new PoisonedPlayers(this);
         poisonedPlayers.Initialize(SittingDuck, ThreatController, EventMaster);
         ThreatController.AddInternalThreat(poisonedPlayers, TimeAppears, Position);
     }
     poisonedPlayers.PoisonPlayer(args.MovingPlayer);
 }
Ejemplo n.º 10
0
 internal LowerWhiteStation(
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.LowerWhite, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     CentralReactor = new CentralReactor();
     AlphaComponent = new PulseCannon(CentralReactor);
     VisualConfirmationComponent = new VisualConfirmationComponent();
 }
Ejemplo n.º 11
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Ejemplo n.º 12
0
 internal UpperWhiteStation(
     CentralReactor whiteReactor,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.UpperWhite, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     AlphaComponent    = new CentralHeavyLaserCannon(whiteReactor, ZoneLocation.White);
     Shield            = new CentralShield(whiteReactor);
     ComputerComponent = new ComputerComponent();
 }
Ejemplo n.º 13
0
 internal UpperBlueStation(
     SideReactor redReactor,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.UpperBlue, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     AlphaComponent      = new SideHeavyLaserCannon(redReactor, ZoneLocation.Blue);
     Shield              = new SideShield(redReactor);
     BattleBotsComponent = new BattleBotsComponent();
 }
Ejemplo n.º 14
0
 internal LowerRedStation(
     CentralReactor whiteReactor,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.LowerRed, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     BatteryPack         = new BatteryPack();
     AlphaComponent      = new SideLightLaserCannon(BatteryPack, ZoneLocation.Red);
     BattleBotsComponent = new BattleBotsComponent();
     SideReactor         = new SideReactor(whiteReactor);
 }
Ejemplo n.º 15
0
 internal UpperRedStation(
     SideReactor redReactor,
     Interceptors interceptors,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.UpperRed, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     AlphaComponent       = new SideHeavyLaserCannon(redReactor, ZoneLocation.Red);
     Shield               = new SideShield(redReactor);
     InterceptorComponent = new InterceptorsOnShipComponent(sittingDuck, interceptors);
 }
Ejemplo n.º 16
0
 protected StandardStation(
     StationLocation stationLocation,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(stationLocation, threatController)
 {
     Gravolift     = gravolift;
     BluewardDoors = bluewardDoors;
     RedwardDoors  = redwardDoors;
     SittingDuck   = sittingDuck;
 }
Ejemplo n.º 17
0
        public void SpreadFrom(StationLocation spreadFromStation, int position)
        {
            var spreadToStation = GetStationToSpreadTo(spreadFromStation);

            if (spreadToStation == null ||
                ThreatController.DamageableInternalThreats.Any(threat => threat is BaseSlime && threat.CurrentStation == spreadToStation))
            {
                return;
            }
            var newProgeny = CreateProgeny(spreadToStation.Value);

            Progeny.Add(newProgeny);
            newProgeny.Initialize(SittingDuck, ThreatController, EventMaster);
            ThreatController.AddInternalThreat(newProgeny, TimeAppears, position);
        }
Ejemplo n.º 18
0
        private void InfectPlayers()
        {
            if (infectedPlayers == null)
            {
                infectedPlayers = new InfectedPlayers(this);
                infectedPlayers.Initialize(SittingDuck, ThreatController, EventMaster);
                ThreatController.AddInternalThreat(infectedPlayers, TimeAppears, Position);
            }
            var playersInCurrentStation = SittingDuck.GetPlayersInStation(CurrentStation);

            foreach (var player in playersInCurrentStation)
            {
                infectedPlayers.InfectPlayer(player);
            }
        }
Ejemplo n.º 19
0
        public MainWindow()
        {
            InitializeComponent();
            threatController = new ThreatController(new ThreatBusiness(ConstantStrings.SourceFileName, ConstantStrings.SourceFileUrl, new ThreatRepository(ConstantStrings.LocalStorageFileName)));
            var shortThreats = threatController.GetAllShortThreats();

            if (shortThreats != null)
            {
                InitializeThreadList(shortThreats);
            }
            else
            {
                DisableControls();
            }
            btnUpdateReport.IsEnabled = false;
        }
Ejemplo n.º 20
0
 internal WhiteZone(ThreatController threatController, Doors redDoors, Doors blueDoors, SittingDuck sittingDuck)
 {
     LowerWhiteStation = new LowerWhiteStation(
         threatController,
         Gravolift,
         blueDoors,
         redDoors,
         sittingDuck);
     UpperWhiteStation = new UpperWhiteStation(
         LowerWhiteStation.CentralReactor,
         threatController,
         Gravolift,
         redDoors,
         redDoors,
         sittingDuck);
 }
Ejemplo n.º 21
0
 internal BlueZone(ThreatController threatController, CentralReactor whiteReactor, Doors blueDoors, SittingDuck sittingDuck)
 {
     LowerBlueStation = new LowerBlueStation(
         whiteReactor,
         threatController,
         Gravolift,
         null,
         blueDoors,
         sittingDuck);
     UpperBlueStation = new UpperBlueStation(
         LowerBlueStation.SideReactor,
         threatController,
         Gravolift,
         null,
         blueDoors,
         sittingDuck);
 }
Ejemplo n.º 22
0
        private void UpdateAndRefresh()
        {
            BindingList <ThreatUpdate> changedThreats;
            BindingList <Threat>       newThreats;
            BindingList <Threat>       deletedThreats;

            ThreatController.UpdateInfo(out changedThreats, out newThreats, out deletedThreats);
            Refresh();

            _updatedThreatsCount = changedThreats.Count + newThreats.Count + deletedThreats.Count;

            if (_updatedThreatsCount > 0)
            {
                var updateWindow = new UpdateWindow();
                updateWindow.Show(changedThreats, newThreats, deletedThreats);
            }
        }
Ejemplo n.º 23
0
        private void SabotageAllSystems()
        {
            var newThreats = new[]
            {
                new Sabotage(ThreatType, Difficulty, CurrentStation, PlayerActionType.Alpha, this),
                new Sabotage(ThreatType, Difficulty, CurrentStation, PlayerActionType.Bravo, this),
                new Sabotage(ThreatType, Difficulty, CurrentStation, PlayerActionType.Charlie, this)
            };

            foreach (var newThreat in newThreats)
            {
                AllSabotage.Add(newThreat);
                newThreat.Initialize(SittingDuck, ThreatController, EventMaster);
                newThreat.SetThreatStatus(ThreatStatus.NotAppeared, false);
                newThreat.SetThreatStatus(ThreatStatus.OnShip, true);
                ThreatController.AddInternalTracklessThreat(newThreat);
            }
        }
Ejemplo n.º 24
0
        public void UpdateClick(object sender, EventArgs args)
        {
            try
            {
                var updateCollection = ThreatController.Update();

                var updatePage = new UpdatePage(updateCollection, "Успешно!");
                LastUpdateLabel.Content = Config.LastUpdate.ToString("dd.MM.yyyy HH:mm");

                updatePage.ShowDialog();
            }
            catch (Exception ex)
            {
                var p = new UpdatePage($"Ошибка обновления ({ex.Message})");
                p.Title = "Ошибка обновления";
                p.ShowDialog();
            }
        }
Ejemplo n.º 25
0
 internal RedZone(ThreatController threatController, CentralReactor whiteReactor, Doors redDoors, SittingDuck sittingDuck, Interceptors interceptors)
 {
     LowerRedStation = new LowerRedStation(
         whiteReactor,
         threatController,
         Gravolift,
         redDoors,
         null,
         sittingDuck);
     UpperRedStation = new UpperRedStation(
         LowerRedStation.SideReactor,
         interceptors,
         threatController,
         Gravolift,
         redDoors,
         null,
         sittingDuck);
 }
Ejemplo n.º 26
0
 protected override void OnHealthReducedToZero()
 {
     ThreatController.RemoveExternalThreatEffect(ThreatStatus.BonusAttack);
     base.OnHealthReducedToZero();
 }
Ejemplo n.º 27
0
 protected override void PerformYAction(int currentTurn)
 {
     ThreatController.MoveOtherExternalThreats(currentTurn, 1, this);
 }
Ejemplo n.º 28
0
 protected override void PerformXAction(int currentTurn)
 {
     ThreatController.AddExternalThreatEffect(ThreatStatus.BonusAttack);
 }
Ejemplo n.º 29
0
 private void CallInExternalThreat(int currentTurn)
 {
     BonusThreat.Initialize(SittingDuck, ThreatController, EventMaster);
     ThreatController.AddExternalThreat(BonusThreat, 1000 + currentTurn, CurrentZone);
     calledInThreat = true;
 }
Ejemplo n.º 30
0
 private void CallInInternalThreat(int currentTurn)
 {
     BonusThreat.Initialize(SittingDuck, ThreatController, EventMaster);
     ThreatController.AddInternalThreat(BonusThreat, 1000 + currentTurn);
 }