public void RequirementDoesNotPass_WhenGameMetricDoesNotMeetRequiredCount() { IGameMetrics mockMetrics = Substitute.For<IGameMetrics>(); mockMetrics.GetMetric( Arg.Any<string>() ).Returns( 0 ); AchievementRequirement req = new AchievementRequirement( "TestRequirement", 100, mockMetrics ); Assert.IsFalse( req.DoesPass() ); }
public void RequirementPasses_WhenGameMetricMeetRequiredCount() { IGameMetrics mockMetrics = Substitute.For<IGameMetrics>(); mockMetrics.GetMetric( Arg.Any<string>() ).Returns( int.MaxValue ); AchievementRequirement req = new AchievementRequirement( "TestRequirement", 100, mockMetrics ); Assert.IsTrue( req.DoesPass() ); }
public GameApplication(IShamanLogger logger, IApplicationConfig config, ISerializer serializer, ISocketFactory socketFactory, ITaskSchedulerFactory taskSchedulerFactory, IRequestSender requestSender, IRoomManager roomManager, IPacketSender packetSender, IGameMetrics gameMetrics, IShamanMessageSenderFactory messageSenderFactory, IProtectionManager protectionManager) : base(logger, config, serializer, socketFactory, taskSchedulerFactory, requestSender, gameMetrics, protectionManager) { _roomManager = roomManager; _packetSender = packetSender; _messageSenderFactory = messageSenderFactory; Logger.Debug($"GameApplication constructor called"); }
public RoomManager( IShamanLogger logger, ISerializer serializer, IApplicationConfig config, ITaskSchedulerFactory taskSchedulerFactory, IRoomControllerFactory roomControllerFactory, IPacketSender packetSender, IShamanMessageSenderFactory messageSenderFactory, IGameMetrics gameMetrics, IRoomStateUpdater roomStateUpdater) { _logger = logger; _serializer = serializer; _taskSchedulerFactory = taskSchedulerFactory; _roomControllerFactory = roomControllerFactory; _taskScheduler = _taskSchedulerFactory.GetTaskScheduler(); _taskScheduler.ScheduleOnInterval(CheckRoomsState, 0, 60000); _config = config; _taskSchedulerFactory = taskSchedulerFactory; _messageSender = messageSenderFactory.Create(packetSender); _gameMetrics = gameMetrics; _roomStateUpdater = roomStateUpdater; }
protected override bool ShouldStartTutorial() { IGameMetrics metrics = PlayerManager.Data.GameMetrics; return(metrics.GetMetric(TutorialName) == 0); }
public AchievementRequirement(string i_metricName, int i_requiredCount, IGameMetrics i_metrics) { MetricName = i_metricName; RequiredCount = i_requiredCount; mMetrics = i_metrics; }
private void DownloadGameMetrics() { mBackend.GetPlayerData(BackendConstants.GAME_METRICS, (jsonData) => { mGameMetrics = JsonConvert.DeserializeObject <GameMetrics>(jsonData); }); }