Beispiel #1
0
        public void SetPosition(IPlayerNotifier notifier)
        {
            Vector3 position = notifier.Position;

            position.y = _camera.transform.position.y;
            _camera.transform.position = position;
        }
 public RunKataAnalysisCommand(IPlayerNotifier playerNotifier,
                               ISettingsManager settingsManager,
                               IAnalysisContainer analysisContainer,
                               IAnalysisRunnerFactory analysisRunnerFactory,
                               IAnalysisResultProcessor analysisResultProcessor,
                               IKataraiApp kataraiApp)
 {
     if (playerNotifier == null)
     {
         throw new ArgumentNullException("playerNotifier");
     }
     if (settingsManager == null)
     {
         throw new ArgumentNullException("settingsManager");
     }
     if (analysisContainer == null)
     {
         throw new ArgumentNullException("analysisContainer");
     }
     if (analysisRunnerFactory == null)
     {
         throw new ArgumentNullException("analysisRunnerFactory");
     }
     if (kataraiApp == null)
     {
         throw new ArgumentNullException("kataraiApp");
     }
     _playerNotifier          = playerNotifier;
     _settingsManager         = settingsManager;
     _analysisRunnerFactory   = analysisRunnerFactory;
     AnalysisContainer        = analysisContainer;
     _analysisResultProcessor = analysisResultProcessor;
     _kataraiApp = kataraiApp;
 }
Beispiel #3
0
        private static MainWindowViewModel Create(
            IEventAggregator eventAggregator         = null,
            IKataAttemptRepository attemptRepository = null,
            IGenerateAndLaunchKataCommand generateAndLaunchKataCommand = null,
            ISettingsManager settingsManager = null,
            IPlayerNotifier playerNotifier   = null,
            IKataraiApp kataraiApp           = null)
        {
            settingsManager = settingsManager ?? CreateSubstituteSettingsManager();
            var viewModel = new MainWindowViewModel(
                eventAggregator ?? Substitute.For <IEventAggregator>(),
                kataraiApp ?? Substitute.For <IKataraiApp>(),
                playerNotifier ?? Substitute.For <IPlayerNotifier>(),
                attemptRepository ?? Substitute.For <IKataAttemptRepository>(),
                generateAndLaunchKataCommand ?? Substitute.For <IGenerateAndLaunchKataCommand>(),
                Substitute.For <ISendFeedbackCommand>(),
                Substitute.For <IShowMainWindowCommand>(),
                Substitute.For <IHideMainWindowCommand>(),
                Substitute.For <IExitApplicationCommand>(),
                settingsManager,
                Substitute.For <IOpenKataSolutionCommand>(),
                Substitute.For <IShowReminderSettingsCommand>(),
                Substitute.For <IShowAttemptsCommand>(),
                Substitute.For <IShowCompletedKatasCommand>(),
                Substitute.For <IShowAttemptsPerWeekCommand>(),
                Substitute.For <IAbandonAttemptCommand>(),
                Substitute.For <IShowAboutWindowCommand>());

            viewModel.KataraiApp = new KataraiApp(settingsManager);
            return(viewModel);
        }
        public void ProcessAnalysisResult(IPlayerNotifier playerNotifier, Result result, string errorMessage,
                                          AttemptGameState attemptGameState)
        {
            if (result != null)
            {
                attemptGameState.SetLatestResult(result);
                var feedback           = CreateFeedback(attemptGameState);
                var latestResult       = attemptGameState.LatestResult;
                var kataFullyCompleted = latestResult.PlayerFeedback.KataCompleted &&
                                         !latestResult.PlayerFeedback.AllLevelsCompleted;
                if (kataFullyCompleted)
                {
                    var kataDuration = attemptGameState.KataTimer.KataDuration;

                    feedback.Message = feedback.Message + Environment.NewLine + Environment.NewLine + "Time taken: " + kataDuration;
                    var kataCompletedView = new Views.KataCompletedView();
                    kataCompletedView.SetMessage(feedback.Message);
                    kataCompletedView.ShowActivated = true;
                    kataCompletedView.Show();
                }
                else
                {
                    playerNotifier.DisplayMessage("Test State", feedback.Message, feedback.KataStateIcon, feedback.PlayerTestStateIcon);
                }
            }
            if (!string.IsNullOrEmpty(errorMessage))
            {
                playerNotifier.DisplayErrorMessage(errorMessage);
            }
        }
        public void SetPlayerPosition(IPlayerNotifier notifier)
        {
            Vector3 targetDir = notifier.Position - transform.position;

            targetDir.Normalize();
            _vehicleController.TargetDirection = targetDir;
        }
Beispiel #6
0
        private CompositePlayerNotifier CreateNotifier(IPlayerNotifier playerNotifier = null)
        {
            playerNotifier = playerNotifier ?? Substitute.For <IPlayerNotifier>();
            var loggingNotifier = new CompositePlayerNotifier(playerNotifier);

            _itemsToDispose.Push(loggingNotifier);
            return(loggingNotifier);
        }
Beispiel #7
0
 public ApplicationController(IEventAggregator eventAggregator,
                              IConvenientWindowManager windowManager,
                              IWindowController windowController,
                              IGameMonitor gameMonitor,
                              IPlayerNotifier playerNotifier,
                              ISplunkLogger splunkLogger,
                              IKataFilesMonitor kataFilesMonitor,
                              IReminderTimer reminderTimer,
                              IMonitorTimer monitorTimer)
 {
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     if (windowManager == null)
     {
         throw new ArgumentNullException(nameof(windowManager));
     }
     if (windowController == null)
     {
         throw new ArgumentNullException(nameof(windowController));
     }
     if (gameMonitor == null)
     {
         throw new ArgumentNullException(nameof(gameMonitor));
     }
     if (playerNotifier == null)
     {
         throw new ArgumentNullException(nameof(playerNotifier));
     }
     if (splunkLogger == null)
     {
         throw new ArgumentNullException(nameof(splunkLogger));
     }
     if (kataFilesMonitor == null)
     {
         throw new ArgumentNullException(nameof(kataFilesMonitor));
     }
     if (reminderTimer == null)
     {
         throw new ArgumentNullException(nameof(reminderTimer));
     }
     if (monitorTimer == null)
     {
         throw new ArgumentNullException(nameof(monitorTimer));
     }
     _eventAggregator  = eventAggregator;
     _windowManager    = windowManager;
     _windowController = windowController;
     _gameMonitor      = gameMonitor;
     _playerNotifier   = playerNotifier;
     _splunkLogger     = splunkLogger;
     _kataFilesMonitor = kataFilesMonitor;
     _reminderTimer    = reminderTimer;
     _monitorTimer     = monitorTimer;
     eventAggregator.Subscribe(this);
 }
Beispiel #8
0
        public void OnDestroy(IPlayerNotifier enemy, ICollidable other)
        {
            if (other is Projectile)
            {
                _score++;

                if (_onScore != null)
                {
                    _onScore(Score);
                }
            }
        }
Beispiel #9
0
        private static RunKataAnalysisCommand CreateRunKataAnalysisCommand(IPlayerNotifier playerNotifier = null, ISettingsManager settingsManager = null, IAnalysisContainer analysisContainer = null, IAnalysisRunnerFactory analysisRunnerFactory = null, IAnalysisResultProcessor analysisResultProcessor = null, KataraiSettings kataraiSettings = null, IKataraiApp kataraiApp = null)
        {
            playerNotifier  = playerNotifier ?? Substitute.For <IPlayerNotifier>();
            kataraiSettings = kataraiSettings ?? new KataraiSettings();
            if (settingsManager == null)
            {
                settingsManager = Substitute.For <ISettingsManager>();
                settingsManager.FetchCurrentSettings().Returns(kataraiSettings);
            }
            analysisContainer       = analysisContainer ?? Substitute.For <IAnalysisContainer>();
            analysisResultProcessor = analysisResultProcessor ?? Substitute.For <IAnalysisResultProcessor>();
            analysisRunnerFactory   = analysisRunnerFactory ?? Substitute.For <IAnalysisRunnerFactory>();
            kataraiApp = kataraiApp ?? Substitute.For <IKataraiApp>();
            var runKataAnalysisCommand = new RunKataAnalysisCommand(playerNotifier, settingsManager, analysisContainer, analysisRunnerFactory, analysisResultProcessor, kataraiApp);

            return(runKataAnalysisCommand);
        }
 private IApplicationController Create(
     IEventAggregator eventAggregator       = null,
     IConvenientWindowManager windowManager = null,
     IWindowController windowController     = null,
     IGameMonitor gameMonitor           = null,
     IPlayerNotifier playerNotifier     = null,
     ISplunkLogger splunkLogger         = null,
     IKataFilesMonitor kataFilesMonitor = null,
     IReminderTimer reminderTimer       = null,
     IMonitorTimer monitorTimer         = null)
 {
     return(new ApplicationController(
                eventAggregator ?? Substitute.For <IEventAggregator>(),
                windowManager ?? Substitute.For <IConvenientWindowManager>(),
                windowController ?? Substitute.For <IWindowController>(),
                gameMonitor ?? Substitute.For <IGameMonitor>(),
                playerNotifier ?? Substitute.For <IPlayerNotifier>(),
                splunkLogger ?? Substitute.For <ISplunkLogger>(),
                kataFilesMonitor ?? Substitute.For <IKataFilesMonitor>(),
                reminderTimer ?? Substitute.For <IReminderTimer>(),
                monitorTimer ?? Substitute.For <IMonitorTimer>()
                ));
 }
 private void RemoveNotifier(IPlayerNotifier notifier)
 {
     GameObject.Destroy(_notifiers[notifier.Id].gameObject);
     _notifiers.Remove(notifier.Id);
 }
 private void AddNotifier(IPlayerNotifier notifier)
 {
     _notifiers.Add(notifier.Id, CreateImage());
 }
 private void NotifyEnemyPosition(IPlayerNotifier notifier, Vector3 position)
 {
     SetImageTransform(_notifiers[notifier.Id], position, notifier.RangeFloat.Value / notifier.RangeFloat.Max);
 }
 public void Notify(IPlayerNotifier enemy)
 {
     NotifyEnemyPosition(enemy, enemy.Position);
 }
 public void OnDestroy(IPlayerNotifier enemy, ICollidable other)
 {
     RemoveNotifier(enemy);
 }
 public void OnSpawn(IPlayerNotifier enemy)
 {
     AddNotifier(enemy);
 }
Beispiel #17
0
 public void Notify(IPlayerNotifier enemy)
 {
 }
Beispiel #18
0
 public void OnSpawn(IPlayerNotifier enemy)
 {
 }
        public MainWindowViewModel(
            IEventAggregator eventAggregator,
            IKataraiApp kataraiApp,
            IPlayerNotifier playerNotifier,
            IKataAttemptRepository attemptRepository,
            IGenerateAndLaunchKataCommand generateKataCommand,
            ISendFeedbackCommand sendFeedbackCommand,
            IShowMainWindowCommand showMainWindowCommand,
            IHideMainWindowCommand hideMainWindowCommand,
            IExitApplicationCommand exitApplicationCommand,
            ISettingsManager settingsManager,
            IOpenKataSolutionCommand openKataSolutionCommand,
            IShowReminderSettingsCommand showReminderSettingsCommand,
            IShowAttemptsCommand showAttemptsCommand,
            IShowCompletedKatasCommand showCompletedKatasCommand,
            IShowAttemptsPerWeekCommand showAttemptsPerWeekCommand,
            IAbandonAttemptCommand abandonAttemptCommand,
            IShowAboutWindowCommand showAboutWindowCommand)
        {
            if (eventAggregator == null)
            {
                throw new ArgumentNullException(nameof(eventAggregator));
            }
            if (kataraiApp == null)
            {
                throw new ArgumentNullException(nameof(kataraiApp));
            }
            if (playerNotifier == null)
            {
                throw new ArgumentNullException(nameof(playerNotifier));
            }
            if (attemptRepository == null)
            {
                throw new ArgumentNullException(nameof(attemptRepository));
            }
            if (generateKataCommand == null)
            {
                throw new ArgumentNullException(nameof(generateKataCommand));
            }
            if (sendFeedbackCommand == null)
            {
                throw new ArgumentNullException(nameof(sendFeedbackCommand));
            }
            if (showMainWindowCommand == null)
            {
                throw new ArgumentNullException(nameof(showMainWindowCommand));
            }
            if (hideMainWindowCommand == null)
            {
                throw new ArgumentNullException(nameof(hideMainWindowCommand));
            }
            if (exitApplicationCommand == null)
            {
                throw new ArgumentNullException(nameof(exitApplicationCommand));
            }
            if (openKataSolutionCommand == null)
            {
                throw new ArgumentNullException(nameof(openKataSolutionCommand));
            }
            if (showReminderSettingsCommand == null)
            {
                throw new ArgumentNullException(nameof(showReminderSettingsCommand));
            }
            if (showAttemptsCommand == null)
            {
                throw new ArgumentNullException(nameof(showAttemptsCommand));
            }
            if (showCompletedKatasCommand == null)
            {
                throw new ArgumentNullException(nameof(showCompletedKatasCommand));
            }
            if (showAttemptsPerWeekCommand == null)
            {
                throw new ArgumentNullException(nameof(showAttemptsPerWeekCommand));
            }
            if (abandonAttemptCommand == null)
            {
                throw new ArgumentNullException(nameof(abandonAttemptCommand));
            }
            if (showAboutWindowCommand == null)
            {
                throw new ArgumentNullException(nameof(showAboutWindowCommand));
            }
            _eventAggregator            = eventAggregator;
            _kataraiApp                 = kataraiApp;
            _playerNotifier             = playerNotifier;
            _attemptRepository          = attemptRepository;
            _settingsManager            = settingsManager;
            ShowReminderSettingsCommand = WrapWithLogging(showReminderSettingsCommand);
            ShowAttemptsCommand         = WrapWithLogging(showAttemptsCommand);
            ShowCompletedKatasCommand   = WrapWithLogging(showCompletedKatasCommand);
            ShowAttemptsPerWeekCommand  = WrapWithLogging(showAttemptsPerWeekCommand);
            AbandonAttemptCommand       = WrapWithLogging(abandonAttemptCommand);
            GenerateKataSolution        = WrapWithLogging(generateKataCommand);
            RegisterNewKataAttemptEvent();
            SendFeedbackCommand     = sendFeedbackCommand;
            ShowWindowCommand       = WrapWithLogging(showMainWindowCommand);
            HideWindowCommand       = WrapWithLogging(hideMainWindowCommand);
            ExitApplicationCommand  = exitApplicationCommand;
            ShowAboutWindowCommand  = showAboutWindowCommand;
            OpenKataSolutionCommand = WrapWithLogging(openKataSolutionCommand);

            Katas = _attemptRepository.GetKataInfos();
            LoadSettings();
            IsAlwaysOnTop  = settingsManager.IsAlwaysOnTopOn();
            ShouldShowHint = settingsManager.IsShowHintOn();
            NotificationVisibilityTimeSeconds = settingsManager.GetNotificationVisibilityTime();
            RegisterAbandonAttemptEvent();

            Initialize();
            KataMenuItems = new ObservableCollection <MenuItem>();
            FeedbackItems = new ObservableCollection <string>();
            SetupKataMenuItems();
            _eventAggregator.Subscribe(this);
        }
 public void NotifyPlayer(IPlayerNotifier notifier)
 {
     _playerPos = notifier.Position;
 }
 private void NotifyEnemyPosition(IPlayerNotifier notifier, Vector3 position)
 {
     SetImageTransform(_notifiers[notifier.Id], _playerPos, position);
 }