コード例 #1
0
ファイル: GameMasterImpl.cs プロジェクト: yuyufeng/d3
        public override void ListFactories(Google.ProtocolBuffers.IRpcController controller, ListFactoriesRequest request, Action <ListFactoriesResponse> done)
        {
            var response = ListFactoriesResponse.CreateBuilder();

            var description = GameFactoryDescription.CreateBuilder();

            description.SetId(14249086168335147635);
            description.AddAttribute(Attribute.CreateBuilder().SetName("min_players").SetValue(Variant.CreateBuilder().SetIntValue(2)));
            description.AddAttribute(Attribute.CreateBuilder().SetName("max_players").SetValue(Variant.CreateBuilder().SetIntValue(4)));
            description.AddAttribute(Attribute.CreateBuilder().SetName("num_teams").SetValue(Variant.CreateBuilder().SetIntValue(1)));
            description.AddAttribute(Attribute.CreateBuilder().SetName("version").SetValue(Variant.CreateBuilder().SetStringValue("0.3.0")));

            var stats_bucket = GameStatsBucket.CreateBuilder();

            stats_bucket.SetBucketMin(0)
            .SetBucketMax(4294967296)
            .SetWaitMilliseconds(1354)
            .SetGamesPerHour(0)
            .SetActiveGames(69)
            .SetActivePlayers(75)
            .SetFormingGames(0)
            .SetWaitingPlayers(0);

            description.AddStatsBucket(stats_bucket);
            response.AddDescription(description);
            response.SetTotalResults(1);

            done(response.Build());
        }
コード例 #2
0
        public override void ListFactories(IRpcController controller, ListFactoriesRequest request, Action <ListFactoriesResponse> done)
        {
            GameFactoryDescription.Builder description = GameFactoryDescription.CreateBuilder().SetId(0xc5beec600d8c6273);

            var atributes = new[]
            {
                Attribute.CreateBuilder().SetName("min_players").SetValue(Variant.CreateBuilder().SetIntValue(2)).Build(),
                Attribute.CreateBuilder().SetName("max_players").SetValue(Variant.CreateBuilder().SetIntValue(4)).Build(),
                Attribute.CreateBuilder().SetName("num_teams").SetValue(Variant.CreateBuilder().SetIntValue(1)).Build(),
                Attribute.CreateBuilder().SetName("version").SetValue(Variant.CreateBuilder().SetStringValue("0.3.0")).Build()
            };

            description.AddRangeAttribute(atributes);
            description.AddStatsBucket(GameStatsBucket.CreateBuilder()
                                       .SetBucketMin(0)
                                       .SetBucketMax(4294967296F)
                                       .SetWaitMilliseconds(1354)
                                       .SetGamesPerHour(0)
                                       .SetActiveGames(1)
                                       .SetActivePlayers(1)
                                       .SetFormingGames(0)
                                       .SetWaitingPlayers(0)
                                       .Build());

            ListFactoriesResponse response = ListFactoriesResponse.CreateBuilder().AddDescription(description).SetTotalResults(1).Build();

            done(response);
        }
コード例 #3
0
        public override void ListFactories(IRpcController controller, ListFactoriesRequest request, Action <ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories()");

            var description = GameFactoryDescription.CreateBuilder().SetId(14249086168335147635);
            var attributes  = new bnet.protocol.attribute.Attribute[4]
            {
                bnet.protocol.attribute.Attribute.CreateBuilder().SetName("min_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(2)).Build(),
                bnet.protocol.attribute.Attribute.CreateBuilder().SetName("max_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(4)).Build(),
                bnet.protocol.attribute.Attribute.CreateBuilder().SetName("num_teams").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1)).Build(),
                bnet.protocol.attribute.Attribute.CreateBuilder().SetName("version").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetStringValue("0.3.0")).Build()
            };

            description.AddRangeAttribute(attributes);
            description.AddStatsBucket(GameStatsBucket.CreateBuilder()
                                       .SetBucketMin(0)
                                       .SetBucketMax(4267296)
                                       .SetWaitMilliseconds(1354)
                                       .SetGamesPerHour(0)
                                       .SetActiveGames(69)
                                       .SetActivePlayers(75)
                                       .SetFormingGames(5)
                                       .SetWaitingPlayers(0).Build());

            var builder = ListFactoriesResponse.CreateBuilder().AddDescription(description).SetTotalResults(1);

            done(builder.Build());
        }