• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IRpcController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ProcessClientRequest

        public override void ProcessClientRequest(IRpcController controller, ClientRequest request, Action<ClientResponse> done)
        {
            var response = new ClientResponse.Builder
                              {

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


示例17: SubscribeToFriends

 public override void SubscribeToFriends(IRpcController controller, SubscribeToFriendsRequest request, Action<SubscribeToFriendsResponse> done)
 {
     Logger.Trace("SubscribeToFriends()");
     var builder = SubscribeToFriendsResponse.CreateBuilder()
         .SetMaxFriends(127)
         .SetMaxReceivedInvitations(127)
         .SetMaxSentInvitations(127);
     done(builder.Build());
 }
开发者ID:pvpmagebro,项目名称:d3sharp,代码行数:9,代码来源:FriendsService.cs


示例18: ToonList

        public override void ToonList(IRpcController controller, ToonListRequest request, Action<ToonListResponse> done)
        {
            var builder = new ToonListResponse.Builder
                              {

                              };
            //builder.AddToons(EntityId.CreateBuilder().SetHigh(216174302532224051).SetLow(1).Build());
            done(builder.Build());
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:9,代码来源:ToonServiceExternalImpl.cs


示例19: Connect

        public override void Connect(IRpcController controller, ConnectRequest request, Action<ConnectResponse> done)
        {
            var response = ConnectResponse.CreateBuilder()
                .SetServerId(ProcessId.CreateBuilder().SetLabel(0xDEADBABE).SetEpoch(DateTime.Now.ToUnixTime()))
                .SetClientId(ProcessId.CreateBuilder().SetLabel(0xDEADBEEF).SetEpoch(DateTime.Now.ToUnixTime()))
                .Build();

            done(response);
        }
开发者ID:Geracl,项目名称:d3proto,代码行数:9,代码来源:ConnectionServiceImpl.cs


示例20: ProcessClientRequest

        public override void ProcessClientRequest(IRpcController controller, ClientRequest request, Action<ClientResponse> done)
        {
            Logger.Trace("ProcessClientRequest()");

            // TODO: handle the request. this is where banner changing happens (CustomMessageId 4)
            // CustomMessage for banner change is a D3.GameMessages.SaveBannerConfiguration
            var builder = ClientResponse.CreateBuilder();
            done(builder.Build());
        }
开发者ID:superk,项目名称:d3sharp,代码行数:9,代码来源:GameUtilitiesService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IRpcProtocol类代码示例发布时间:2022-05-24
下一篇:
C# IRow类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap