コード例 #1
0
        public void Initialize()
        {
            NameValueCollection settings = new NameValueCollection()
            {
                { "discardThreshold", "0.5" },
                { "groupDiscardThreshold", "0.6" },
                { "entitiesPerGroup", "4" },
                { "tickPeriod", int.MaxValue.ToString() }       //Stick to manual matching
            };

            DarkRiftThreadHelper threadHelper = new DarkRiftThreadHelper(false, null);

            PluginLoadData loadData = new PluginLoadData("Matchmaker", settings, null, threadHelper, (Logger)null, null);

            matchmaker = new Mock <RankingMatchmaker <TestEntity> >(loadData)
            {
                CallBase = true
            };

            //Setup suitability metric function to be a simple minimization of MMRs
            matchmaker.Setup(m => m.GetSuitabilityMetric(It.IsAny <TestEntity>(), It.IsAny <TestEntity>(), It.IsAny <MatchRankingContext <TestEntity> >()))
            .Returns((TestEntity e1, TestEntity e2, MatchRankingContext <TestEntity> context) => 1 - Math.Abs(e1.Mmr - e2.Mmr) / 1);
        }
コード例 #2
0
 /// <summary>
 ///     Creates new load data for a <see cref="MetricsWriter"/>.
 /// </summary>
 /// <param name="name">The name of the metrics writer.</param>
 /// <param name="settings">The settings to pass the metrics writer.</param>
 /// <param name="serverInfo">The runtime details about the server.</param>
 /// <param name="threadHelper">The server's thread helper.</param>
 public MetricsWriterLoadData(string name, NameValueCollection settings, DarkRiftInfo serverInfo, DarkRiftThreadHelper threadHelper)
     : base(name, settings, serverInfo, threadHelper)
 {
 }