当前位置: 首页>>代码示例>>C#>>正文


C# IRpcController类代码示例

本文整理汇总了C#中IRpcController的典型用法代码示例。如果您正苦于以下问题:C# IRpcController类的具体用法?C# IRpcController怎么用?C# IRpcController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRpcController类属于命名空间,在下文中一共展示了IRpcController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectToon

        public override void SelectToon(IRpcController controller, SelectToonRequest request, Action<SelectToonResponse> done)
        {
            done(new SelectToonResponse.Builder
                     {

                     }.Build());
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:7,代码来源:ToonServiceExternalImpl.cs

示例2: ListFactories

        public override void ListFactories(IRpcController controller, ListFactoriesRequest request, Action<ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            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());
        }
开发者ID:ncoop23,项目名称:mooege,代码行数:27,代码来源:GameMasterService.cs

示例3: SubscribeToUserManager

        public override void SubscribeToUserManager(IRpcController controller, SubscribeToUserManagerRequest request, Action<SubscribeToUserManagerResponse> done)
        {
            done(new SubscribeToUserManagerResponse.Builder
                     {

                     }.Build());
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:7,代码来源:UserManagerServiceImpl.cs

示例4: SendInvitation

        public override void SendInvitation(IRpcController controller, bnet.protocol.invitation.SendInvitationRequest request, Action<bnet.protocol.NoData> done)
        {
            // somehow protobuf lib doesnt handle this extension, so we're using a workaround to get that channelinfo.
            var extensionBytes = request.UnknownFields.FieldDictionary[103].LengthDelimitedList[0].ToByteArray();
            var friendRequest = bnet.protocol.friends.SendInvitationRequest.ParseFrom(extensionBytes);

            if (friendRequest.TargetEmail.ToLower() == this.Client.Account.Email.ToLower()) return; // don't allow him to invite himself - and we should actually return an error!
                                                                                                    // also he shouldn't be allowed to invite his current friends - put that check too!. /raist
            var inviteee = AccountManager.GetAccountByEmail(friendRequest.TargetEmail);
            if (inviteee == null) return; // we need send an error response here /raist.

            Logger.Trace("{0} sent {1} friend invitation.", this.Client.Account, inviteee);

            var invitation = bnet.protocol.invitation.Invitation.CreateBuilder()
                .SetId(FriendManager.InvitationIdCounter++) // we may actually need to store invitation ids in database with the actual invitation there. /raist.                
                .SetInviterIdentity(this.Client.GetIdentity(true, false, false))
                .SetInviterName(this.Client.Account.Email) // we shoulde be instead using account owner's name here.
                .SetInviteeIdentity(bnet.protocol.Identity.CreateBuilder().SetAccountId(inviteee.BnetAccountID))
                .SetInviteeName(inviteee.Email) // again we should be instead using invitee's name.
                .SetInvitationMessage(request.InvitationMessage)
                .SetCreationTime(DateTime.Now.ToUnixTime())
                .SetExpirationTime(86400);

            // Response is bnet.protocol.NoData as of 7728. /raist.
            //var response = bnet.protocol.invitation.SendInvitationResponse.CreateBuilder()
            //    .SetInvitation(invitation.Clone());

            var response = bnet.protocol.NoData.CreateBuilder();
            done(response.Build());

            // notify the invitee on invitation.
            FriendManager.HandleInvitation(this.Client, invitation.Build());
        }
开发者ID:fasbat,项目名称:mooege,代码行数:33,代码来源:FriendsService.cs

示例5: SubscribeToFriends

        public override void SubscribeToFriends(IRpcController controller, SubscribeToFriendsRequest request, Action<SubscribeToFriendsResponse> done)
        {
            done(new SubscribeToFriendsResponse.Builder
                     {

                     }.Build());
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:7,代码来源:FriendsServiceImpl.cs

示例6: SendReport

        public override void SendReport(IRpcController controller, bnet.protocol.report.SendReportRequest request, Action<bnet.protocol.NoData> done)
        {
            Logger.Trace("SendReport()");

            var report = request.Report;
            //TODO: Store reports against accounts
            foreach (var attribute in report.AttributeList)
            {
                switch (attribute.Name)
                {
                    case "target_toon_id": //uint GameAccount.Low
                        var reportee = GameAccountManager.GetAccountByPersistentID(attribute.Value.UintValue);
                        Logger.Trace("{0} reported {1} for \"{2}\".", this.Client.Account.CurrentGameAccount.CurrentToon, reportee, report.ReportType);
                        break;
                    //case "target_account_id": //uint Account.Low
                    //case "target_toon_name": //string
                    //case "target_toon_program": //fourcc
                    //case "target_toon_region": //string
                    //case "note": //string - not currently used in client
                }
            }

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());
        }
开发者ID:RC1140,项目名称:mooege,代码行数:26,代码来源:ReportService.cs

示例7: SubscribeToFriends

        public override void SubscribeToFriends(IRpcController controller, bnet.protocol.friends.SubscribeToFriendsRequest request, Action<bnet.protocol.friends.SubscribeToFriendsResponse> done)
        {
            Logger.Trace("Subscribe() {0}", this.Client);

            FriendManager.Instance.AddSubscriber(this.Client, request.ObjectId);

            var builder = bnet.protocol.friends.SubscribeToFriendsResponse.CreateBuilder()
                .SetMaxFriends(127)
                .SetMaxReceivedInvitations(127)
                .SetMaxSentInvitations(127)
                .AddRole(bnet.protocol.Role.CreateBuilder().SetId(1).SetName("battle_tag_friend").Build())
                .AddRole(bnet.protocol.Role.CreateBuilder().SetId(2).SetName("real_id_friend").Build());

            foreach (var friend in FriendManager.Friends[this.Client.Account.BnetEntityId.Low]) // send friends list.
            {
                builder.AddFriends(friend);
            }

            var invitations = new List<bnet.protocol.invitation.Invitation>();

            foreach (var invitation in FriendManager.OnGoingInvitations.Values)
            {
                if (invitation.InviteeIdentity.AccountId == this.Client.Account.BnetEntityId)
                {
                    invitations.Add(invitation);
                }
            }

            if (invitations.Count > 0)
                builder.AddRangeReceivedInvitations(invitations);

            done(builder.Build());
        }
开发者ID:ElCorpseMaker,项目名称:mooege,代码行数:33,代码来源:FriendsService.cs

示例8: ModuleMessage

        public override void ModuleMessage(IRpcController controller, ModuleMessageRequest request, Action<NoData> done)
        {
            var moduleId = request.ModuleId;

            var message = request.Message.ToByteArray();
            var command = message[0];

            done(new NoData.Builder().Build());

            if (moduleId == 0 && command == 2)
            {
                byte[] A = message.Skip(1).Take(128).ToArray();
                byte[] M1 = message.Skip(1 + 128).Take(32).ToArray();
                byte[] seed = message.Skip(1 + 32 + 128).Take(128).ToArray();

                if (srp.Verify(A, M1, seed) == false)
                {
                    client.ListenerId = 0;
                    client.ErrorCode = AuthError.InvalidCredentials;
                }
                else
                {
                    var moduleMessagedRequest = ModuleMessageRequest.CreateBuilder()
                        .SetModuleId(moduleId)
                        .SetMessage(ByteString.CopyFrom(srp.Response2))
                        .Build();

                    AuthenticationClient.CreateStub(client).ModuleMessage(controller, moduleMessagedRequest, ClientServiceCallback);
                }

                wait.Set();
            }
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:33,代码来源:AuthenticationServerImpl.cs

示例9: AcceptInvitation

        public override void AcceptInvitation(IRpcController controller, bnet.protocol.invitation.GenericRequest request, Action<bnet.protocol.NoData> done)
        {
            var response = bnet.protocol.NoData.CreateBuilder();
            done(response.Build());

            FriendManager.HandleAccept(this.Client, request);
        }
开发者ID:rosebud,项目名称:mooege,代码行数:7,代码来源:FriendsService.cs

示例10: SendInvitation

        public override void SendInvitation(IRpcController controller, bnet.protocol.invitation.SendInvitationRequest request, Action<SendInvitationResponse> done)
        {
            Logger.Trace("SendInvitation() Stub");

            //TODO: Set these to the corect values.
            const ulong accountHandle = 0x0000000000000000;
            const ulong gameAccountHandle = 0x0000000000000000;

            var invitation = bnet.protocol.invitation.Invitation.CreateBuilder()
                .SetCreationTime(DateTime.Now.ToUnixTime())
                .SetExpirationTime(request.ExpirationTime)
                .SetId(0)
                .SetInvitationMessage(request.InvitationMessage)
                .SetInviteeIdentity(bnet.protocol.Identity.CreateBuilder()
                                        .SetAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(accountHandle).SetLow(0x1).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .SetGameAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(gameAccountHandle).SetLow(0x1).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .Build())
                .SetInviteeName("FriendName") //TODO: Set this to the name retrieved from the database.
                .SetInviterIdentity(bnet.protocol.Identity.CreateBuilder()
                                        .SetAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(accountHandle).SetLow(0x0).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .SetGameAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(gameAccountHandle).SetLow(0x0).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .Build())
                .SetInviterName("YourName") //TODO: Set this to the name retrieved from the database.
                .Build();

            var builder = bnet.protocol.invitation.SendInvitationResponse.CreateBuilder().SetInvitation(invitation);
            done(builder.Build());
        }
开发者ID:pvpmagebro,项目名称:d3sharp,代码行数:28,代码来源:FriendsService.cs

示例11: ListFactories

        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);
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:27,代码来源:GameMasterImpl.cs

示例12: GetConfiguration

 public override void GetConfiguration(IRpcController controller, GetConfigurationRequest request, Action<GetConfigurationResponse> done)
 {
     Logger.Trace("GetConfiguration()");
     //TODO: Figure out what the buyout rules/specialist values are, and if they are related /dustinconrad
     var builder = GetConfigurationResponse.CreateBuilder()
         .AddConfigs(SpecialistConfig.CreateBuilder()
             .SetSpecialist(1)
             .AddAuctionDurations(720)
             .AddAuctionDurations(1440)
             .AddAuctionDurations(2880)
             .AddAuctionStartDelays(5)
             .SetAntiSnipingExtensionDelay(1)
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("D3_GOLD")
                 .SetTickSize(1)
                 .SetFlatOutbidIncr(1)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(5)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(1))
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("USD")
                 .SetTickSize(2)
                 .SetFlatOutbidIncr(2)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(30)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(1)))
         .AddConfigs(SpecialistConfig.CreateBuilder()
             .SetSpecialist(2)
             .AddAuctionDurations(2880)
             .AddAuctionDurations(10080)
             .AddAuctionStartDelays(0)
             .SetAntiSnipingExtensionDelay(0)
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("D3_GOLD")
                 .SetTickSize(1)
                 .SetFlatOutbidIncr(1)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(5)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(2))
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("USD")
                 .SetTickSize(2)
                 .SetFlatOutbidIncr(2)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(30)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(2)));
     done(builder.Build());
 }
开发者ID:ncoop23,项目名称:mooege,代码行数:60,代码来源:ExchangeService.cs

示例13: FindGame

        public override void FindGame(IRpcController controller, bnet.protocol.game_master.FindGameRequest request, Action<bnet.protocol.game_master.FindGameResponse> done)
        {            
            Logger.Trace("FindGame() {0}", this.Client);

            // find the game.
            var gameFound = GameFactoryManager.FindGame(this.Client, request, ++GameFactoryManager.RequestIdCounter);
            //TODO: Find out why on rejoin game this is null
            if (Client.CurrentChannel != null)
            {
                //TODO: All these ChannelState updates can be moved to functions someplace else after packet flow is discovered and working -Egris
                //Send current JoinPermission to client before locking it
                var channelStatePermission = bnet.protocol.channel.ChannelState.CreateBuilder()
                    .AddAttribute(bnet.protocol.attribute.Attribute.CreateBuilder()
                    .SetName("D3.Party.JoinPermissionPreviousToLock")
                    .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1).Build())
                    .Build()).Build();

                var notificationPermission = bnet.protocol.channel.UpdateChannelStateNotification.CreateBuilder()
                    .SetAgentId(this.Client.Account.CurrentGameAccount.BnetEntityId)
                    .SetStateChange(channelStatePermission)
                    .Build();

                this.Client.MakeTargetedRPC(Client.CurrentChannel, () =>
                    bnet.protocol.channel.ChannelSubscriber.CreateStub(this.Client).NotifyUpdateChannelState(null, notificationPermission, callback => { }));
            }
            var builder = bnet.protocol.game_master.FindGameResponse.CreateBuilder().SetRequestId(gameFound.RequestId);
            done(builder.Build());

            var clients = new List<MooNetClient>();
            foreach (var player in request.PlayerList)
            {
                foreach (var gameAccount in GameAccountManager.GameAccountsList)
                {
                    if (player.Identity.GameAccountId.Low == gameAccount.BnetEntityId.Low)
                    {
                        clients.Add(gameAccount.LoggedInClient);
                    }
                }
            }

            // send game found notification.
            var notificationBuilder = bnet.protocol.game_master.GameFoundNotification.CreateBuilder()
                .SetRequestId(gameFound.RequestId)
                .SetGameHandle(gameFound.GameHandle);

            this.Client.MakeRPCWithListenerId(request.ObjectId, () =>
                bnet.protocol.game_master.GameFactorySubscriber.CreateStub(this.Client).NotifyGameFound(null, notificationBuilder.Build(), callback => { }));
            
            if(gameFound.Started)
            {
                Logger.Warn("Client {0} joining game with FactoryID:{1}", this.Client.Account.CurrentGameAccount.CurrentToon.HeroNameField.Value, gameFound.FactoryID);
                gameFound.JoinGame(clients, request.ObjectId);
            }
            else
            {
                Logger.Warn("Client {0} creating new game", this.Client.Account.CurrentGameAccount.CurrentToon.HeroNameField.Value);
                gameFound.StartGame(clients, request.ObjectId);
            }
        }
开发者ID:jujuman,项目名称:mooege,代码行数:59,代码来源:GameMasterService.cs

示例14: GetContentHandle

        public override void GetContentHandle(IRpcController controller, ContentHandleRequest request, Action<ContentHandle> done)
        {
            Logger.Trace("GetContentHandle()");
            //Beta this returns status 4, no payload

            throw new NotImplementedException();

        }
开发者ID:Nakyo,项目名称:mooege,代码行数:8,代码来源:ResourceService.cs

示例15: UnregisterFromService

        public override void UnregisterFromService(IRpcController controller, bnet.protocol.achievements.UnregisterFromServiceRequest request, Action<bnet.protocol.NoData> done)
        {
            Logger.Trace("Unregister()");

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());
        }
开发者ID:loonbg,项目名称:mooege,代码行数:8,代码来源:AchievementService.cs


注:本文中的IRpcController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。