Пример #1
0
 public MatchMakingGroupManager(IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory,
                                IPlayersManager playersManager, IShamanMessageSender messageSender, IMmMetrics mmMetrics, IRoomManager roomManager,
                                IRoomPropertiesProvider roomPropertiesProvider, IApplicationConfig config)
 {
     _logger = logger;
     _taskSchedulerFactory   = taskSchedulerFactory;
     _playersManager         = playersManager;
     _messageSender          = messageSender;
     _mmMetrics              = mmMetrics;
     _roomManager            = roomManager;
     _roomPropertiesProvider = roomPropertiesProvider;
     _config = config;
 }
        public MatchMakingGroup(Dictionary <byte, object> roomProperties,
                                IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory, IPlayersManager playersManager,
                                IShamanMessageSender messageSender, IMmMetrics mmMetrics, IRoomManager roomManager)
        {
            Id = Guid.NewGuid();

            _logger             = logger;
            _playersManager     = playersManager;
            _taskScheduler      = taskSchedulerFactory.GetTaskScheduler();
            _matchmakingPlayers = new Queue <MatchMakingPlayer>();
            RoomProperties      = roomProperties;
            _messageSender      = messageSender;
            _mmMetrics          = mmMetrics;
            _roomManager        = roomManager;

            //get properties from dict
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.MatchMakingTick, out var tickProperty))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no MatchMakingTick property");
            }
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.TotalPlayersNeeded, out var totalPlayersProperty))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no TotalPlayersNeeded property");
            }
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.MaximumMmTime, out var timeBeforeBotsProperty))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no MaximumMmTime property");
            }
            if (!roomProperties.TryGetValue(PropertyCode.RoomProperties.MaximumMatchMakingWeight, out var maxMmWeight))
            {
                throw new Exception($"MatchMakingGroup ctr error: there is no MaximumMatchMakingWeight property");
            }

            _matchMakingTickMs  = (int)tickProperty;
            _totalPlayersNeeded = (int)totalPlayersProperty;
            _maximumMmTime      = (int)timeBeforeBotsProperty;
            _maxMmWeight        = (int)maxMmWeight;
        }
        public MmApplication(
            IShamanLogger logger,
            IApplicationConfig config,
            ISerializer serializer,
            ISocketFactory socketFactory,
            IMatchMaker matchMaker,
            IRequestSender requestSender,
            ITaskSchedulerFactory taskSchedulerFactory,
            IPacketSender packetSender,
            IShamanMessageSenderFactory messageSenderFactory,
            IMatchMakerServerInfoProvider serverProvider,
            IRoomManager roomManager, IMatchMakingGroupsManager matchMakingGroupManager, IPlayersManager playersManager, IMmMetrics mmMetrics, IProtectionManager protectionManager) : base(logger, config, serializer,
                                                                                                                                                                                            socketFactory, taskSchedulerFactory, requestSender, mmMetrics, protectionManager)
        {
            _packetSender            = packetSender;
            _messageSenderFactory    = messageSenderFactory;
            _serverProvider          = serverProvider;
            _roomManager             = roomManager;
            _matchMakingGroupManager = matchMakingGroupManager;
            _playersManager          = playersManager;
            _matchMaker = matchMaker;
            _id         = Guid.NewGuid();

            Logger?.Debug($"MmApplication constructor called. Id = {_id}");
        }
Пример #4
0
 public PlayersManager(IMmMetrics mmMetrics, IShamanLogger logger)
 {
     _mmMetrics = mmMetrics;
     _logger    = logger;
 }