Exemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplication server,
                              IShamanLogger logger, IMatchMaker matchMaker, IServerActualizer serverActualizer, IMatchMakerServerInfoProvider serverInfoProvider, IBundleLoader bundleLoader)
        {
            serverActualizer.Start(Convert.ToInt32(Configuration["LauncherSettings:ActualizationIntervalMs"]));

            base.ConfigureMm(app, env, server, logger, matchMaker, serverInfoProvider, bundleLoader);
        }
Exemplo n.º 2
0
 internal MainServiceImpl(PlayerAuth auth, IDB db, SingleThreadScheduler in_memory_worker, IMatchMaker match_maker)
 {
     this.db               = db;
     this.auth             = auth;
     this.in_memory_worker = in_memory_worker;
     this.match_maker      = match_maker;
 }
        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}");
        }
Exemplo n.º 4
0
        internal void TryCreateArenaForPlayersAsync(IMatchMaker match_maker, List <Player> buffer)
        {
            if (is_disposing())
            {
                return;
            }

            Task.Run(async() =>
            {
                var attempt = new CreateArenaAttempt();
                foreach (var player in buffer)
                {
                    attempt.PlayerInfo.Add(new ArenaServer.PlayerInfo
                    {
                        AuthToken = GuidOps.ToByteString(Guid.NewGuid()),
                        BasicInfo = player.BasicPlayerInfo()
                    });
                }

                foreach (var arena in hosts)
                {
                    if (await arena.TryCreateArenaForPlayers(buffer, attempt))
                    {
                        return;
                    }
                }

                match_maker.AddPlayers(buffer);
            });
        }
Exemplo n.º 5
0
        public GameSimulationManager(IMatchMaker matchMaker, IGameSimulation gameSimulation)
        {
            Contract.Assert(matchMaker != null, "matchMaker!=null");
            Contract.Assert(gameSimulation != null, "gameSimulation!=null");

            _matchMaker     = matchMaker;
            _gameSimulation = gameSimulation;
        }
 public SecretSantaManager(
     IContactRepository contactsRepo,
     IMatchMaker <Contact> matchMaker,
     ISecretSantaNotifier <Contact> notifier)
 {
     this.contactsRepo = contactsRepo;
     this.matchMaker   = matchMaker;
     this.notifier     = notifier;
 }
Exemplo n.º 7
0
 public void Initialize(IMatchMaker matchMaker, IShamanMessageSender packetSender, IRoomManager roomManager, IMatchMakingGroupsManager matchMakingGroupsManager,
                        string authSecret)
 {
     _matchMaker               = matchMaker;
     _messageSender            = packetSender;
     _authSecret               = authSecret;
     _roomManager              = roomManager;
     _matchMakingGroupsManager = matchMakingGroupsManager;
 }
Exemplo n.º 8
0
 public MasterHub(IMasterRepo masterRepo, ILobbyManager lobbyManager,
                  ISessionRepo sessionRepo, IRoomManager roomManager, IMatchMaker matchMaker,
                  ILogger <MasterHub> logger)
 {
     _masterRepo   = masterRepo;
     _lobbyManager = lobbyManager;
     _sessionRepo  = sessionRepo;
     _roomManager  = roomManager;
     _matchMaker   = matchMaker;
     _logger       = logger;
 }
Exemplo n.º 9
0
        public async Task <Guid> QuickMatch()
        {
            // Find an available room first
            IMatchMaker match  = GrainFactory.GetGrain <IMatchMaker>(0);
            Guid        roomId = await match.QuickMatch(this.GetPrimaryKeyLong());

            IGameRoom room = GrainFactory.GetGrain <IGameRoom>(roomId);
            await room.Subscribe(this);

            return(roomId);
        }
Exemplo n.º 10
0
        /// <summary>
        /// MM related middleware configuration
        /// </summary>
        /// <param name="app"></param>
        /// <param name="env"></param>
        /// <param name="server"></param>
        /// <param name="logger"></param>
        /// <param name="matchMaker"></param>
        /// <param name="serverInfoProvider"></param>
        /// <param name="bundleLoader"></param>
        public void ConfigureMm(IApplicationBuilder app, IHostingEnvironment env, IApplication server,
                                IShamanLogger logger, IMatchMaker matchMaker, IMatchMakerServerInfoProvider serverInfoProvider, IBundleLoader bundleLoader)
        {
            //load bundle
            bundleLoader.LoadBundle().Wait();

            //resolve main bundle type and configure it
            //in case of matchmaker we can load bundle during this stage
            var resolver = bundleLoader.LoadTypeFromBundle <IMmResolver>();

            RoomPropertiesProvider.RoomPropertiesProviderImplementation = resolver.GetRoomPropertiesProvider();
            resolver.Configure(matchMaker);

            //start game server info provider - gathers info about game servers connected to this matchmaker
            serverInfoProvider.Start();

            base.ConfigureCommon(app, env, server, logger);
        }
 public TournamentController(IMatchMaker matchMaker)
 {
     _matchMaker = matchMaker;
     Config      = TournamentConfiguration.Default;
 }
Exemplo n.º 12
0
 public MatchSimulator(IMatchMaker matchMaker, TimeSimulatorTickInfo tickInfo)
 {
     _matchMaker = matchMaker;
     _tickInfo   = tickInfo;
 }
 public void PerTestSetup()
 {
     _matchMaker = Substitute.For <IMatchMaker>();
     _tournament = new TournamentController(_matchMaker);
 }
Exemplo n.º 14
0
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplication server,
                       IShamanLogger logger, IMatchMaker matchMaker, IMatchMakerServerInfoProvider serverInfoProvider, IBundleLoader bundleLoader)
 {
     base.ConfigureMm(app, env, server, logger, matchMaker, serverInfoProvider, bundleLoader);
 }