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


C# MooNet.MooNetClient类代码示例

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


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

示例1: Revoke

        public void Revoke(MooNetClient client, bnet.protocol.channel_invitation.RevokeInvitationRequest request)
        {
            if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return;
            var invitation = this._onGoingInvitations[request.InvitationId];

            //notify inviter about revoke
            var updateChannelNotification =
                bnet.protocol.channel.UpdateChannelStateNotification.CreateBuilder()
                .SetAgentId(bnet.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0)) // caps have this set to high: 0 low: 0 /dustin
                .SetStateChange(bnet.protocol.channel.ChannelState.CreateBuilder()
                    .AddInvitation(invitation)
                    .SetReason((uint)InvitationRemoveReason.Revoked));

            this._onGoingInvitations.Remove(request.InvitationId);

            client.MakeTargetedRPC(client.CurrentChannel, () =>
                bnet.protocol.channel.ChannelSubscriber.CreateStub(client).NotifyUpdateChannelState(null, updateChannelNotification.Build(), callback => { }));

            //notify invitee about revoke
            var invitationRemoved =
                bnet.protocol.channel_invitation.InvitationRemovedNotification.CreateBuilder()
                .SetInvitation(invitation)
                .SetReason((uint)InvitationRemoveReason.Revoked);

            var invitee = ToonManager.GetToonByLowID(invitation.InviteeIdentity.ToonId.Low);
            invitee.Owner.LoggedInClient.MakeTargetedRPC(this, () =>
                bnet.protocol.channel_invitation.ChannelInvitationNotify.CreateStub(invitee.Owner.LoggedInClient).NotifyReceivedInvitationRemoved(null, invitationRemoved.Build(), callback => { }));
        }
开发者ID:wow4all,项目名称:mooege,代码行数:28,代码来源:ChannelInvitationManager.cs

示例2: HandleInvitation

        public static void HandleInvitation(MooNetClient client, bnet.protocol.invitation.Invitation invitation)
        {
            var invitee = AccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.AccountId.Low);
            //var invitee = Instance.Subscribers.FirstOrDefault(subscriber => subscriber.Account.BnetEntityId.Low == invitation.InviteeIdentity.AccountId.Low);
            if (invitee == null) return; // if we can't find invite just return - though we should actually check for it until expiration time and store this in database.

            //Check for duplicate invites
            foreach (var oldInvite in OnGoingInvitations.Values)
            {
                if ((oldInvite.InviteeIdentity.AccountId == invitation.InviteeIdentity.AccountId) && (oldInvite.InviterIdentity.AccountId == invitation.InviterIdentity.AccountId))
                    return;
            }

            OnGoingInvitations.Add(invitation.Id, invitation); // track ongoing invitations so we can tranport it forth and back.

            if (invitee.IsOnline)
            {
                var inviter = AccountManager.GetAccountByPersistentID(invitation.InviterIdentity.AccountId.Low);

                var notification = bnet.protocol.friends.InvitationNotification.CreateBuilder().SetInvitation(invitation).SetGameAccountId(inviter.CurrentGameAccount.BnetEntityId);

                invitee.CurrentGameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, () =>
                    bnet.protocol.friends.FriendsNotify.CreateStub(invitee.CurrentGameAccount.LoggedInClient).NotifyReceivedInvitationAdded(null, notification.Build(), callback => { }));
            }
        }
开发者ID:avatar21,项目名称:mooege,代码行数:25,代码来源:FriendManager.cs

示例3: Portal

        public string Portal(string[] @params, MooNetClient invokerClient)
        {
            if (invokerClient == null)
                return "You can not invoke this command from console.";

            if (invokerClient.InGameClient == null)
                return "You can only invoke this command while ingame.";

            if (@params != null && @params.Count() > 0)
            {
                var worldId = 0;
                Int32.TryParse(@params[0], out worldId);

                if (worldId == 0)
                    return "Invalid arguments. Type 'help tp' to get help.";

                if (!MPQStorage.Data.Assets[SNOGroup.Worlds].ContainsKey(worldId))
                    return "There exist no world with SNOId: " + worldId;

                var world = invokerClient.InGameClient.Game.GetWorld(worldId);

                if (world == null)
                    return "Can't teleport you to world with snoId " + worldId;

                invokerClient.InGameClient.Player.ChangeWorld(world, world.StartingPoints.First().Position);
                return string.Format("Teleported to: {0} [id: {1}]", MPQStorage.Data.Assets[SNOGroup.Worlds][worldId].Name, worldId);
            }

            return "Invalid arguments. Type 'help tp' to get help.";
        }
开发者ID:n4v,项目名称:mooege,代码行数:30,代码来源:GameCommands.cs

示例4: Show

        public string Show(string[] @params, MooNetClient invokerClient)
        {
            if (@params.Count() < 1)
                return "Invalid arguments. Type 'help rpcobject show' to get help.";

            ulong localId;
            var id = @params[0];
            if (!ulong.TryParse(id, out localId))
                return string.Format("Can not parse '{0}' as valid id.", id);

            if(!RPCObjectManager.Objects.ContainsKey(localId))
                return string.Format("There exists no RPCObject with dynamidId: {0}", localId);

            var rpcObject = RPCObjectManager.Objects[localId];
            var output = string.Format("[RPCObject]\nDynamicId: 0x{0}\nType: {1}\nObject: {2}\n", rpcObject.DynamicId,
                                       rpcObject.GetType().Name, rpcObject);

            output += "[Subscribers]\n";
            foreach(var client in rpcObject.Subscribers)
            {
                var remoteId = client.GetRemoteObjectID(rpcObject.DynamicId);
                output += string.Format("RemoteId: 0x{0} - {1}\n", remoteId.ToString("X8"), client.Account.Email);
            }

            return output;
        }
开发者ID:ncoop23,项目名称:mooege,代码行数:26,代码来源:DebugCommands.cs

示例5: StartAuthentication

        private static readonly byte[] ModuleHash = "8F52906A2C85B416A595702251570F96D3522F39237603115F2F1AB24962043C".ToByteArray(); // Password.dll

        public static void StartAuthentication(MooNetClient client, bnet.protocol.authentication.LogonRequest request)
        {
            if (Config.Instance.BypassAuthentication)
                BypassAuthentication(client, request);
            else
                InitAuthentication(client, request);                                               
        }
开发者ID:mezandre,项目名称:mooege,代码行数:9,代码来源:AuthManager.cs

示例6: HandleAccept

        public Channel HandleAccept(MooNetClient client, bnet.protocol.channel_invitation.AcceptInvitationRequest request)
        {
            if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return null;

            var invitation = this._onGoingInvitations[request.InvitationId];
            var channel = ChannelManager.GetChannelByEntityId(invitation.GetExtension(bnet.protocol.channel_invitation.ChannelInvitation.ChannelInvitationProp).ChannelDescription.ChannelId);

            var notification = bnet.protocol.channel_invitation.InvitationRemovedNotification.CreateBuilder().SetInvitation(invitation.ToBuilder()).SetReason((uint)InvitationRemoveReason.Accepted);
            this._onGoingInvitations.Remove(invitation.Id);

            // notify invitee and let him remove the handled invitation.
            client.MakeTargetedRPC(this, () =>
                bnet.protocol.channel_invitation.ChannelInvitationNotify.CreateStub(client).NotifyReceivedInvitationRemoved(null, notification.Build(), callback => { }));

            channel.Join(client, request.ObjectId); // add invitee to channel -- so inviter and other members will also be notified too.

            var inviter = GameAccountManager.GetAccountByPersistentID(invitation.InviterIdentity.AccountId.Low);

            var stateNotification = bnet.protocol.channel.UpdateChannelStateNotification.CreateBuilder()
                .SetAgentId(bnet.protocol.EntityId.CreateBuilder().SetHigh(0).SetLow(0).Build())
                .SetStateChange(bnet.protocol.channel.ChannelState.CreateBuilder().AddRangeInvitation(channel.Invitations.Values).SetReason(0).Build())
                .Build();

            foreach (var member in channel.Members.Keys)
            {
                member.MakeTargetedRPC(channel, () =>
                    bnet.protocol.channel.ChannelSubscriber.CreateStub(member).NotifyUpdateChannelState(null, stateNotification, callback => { }));
            }

            return channel;
        }
开发者ID:ReptileZ,项目名称:mooege,代码行数:31,代码来源:ChannelInvitationManager.cs

示例7: BypassAuthentication

        private static void BypassAuthentication(MooNetClient client, bnet.protocol.authentication.LogonRequest request)
        {
            client.Account = AccountManager.GetAccountByEmail(request.Email) ?? AccountManager.CreateAccount(request.Email, request.Email);
            client.Account.LoggedInClient = client;

            client.AuthenticationCompleteSignal.Set(); // signal about completion of authentication processes so we can return the response for AuthenticationService:LogonRequest.
        }
开发者ID:rosebud,项目名称:mooege,代码行数:7,代码来源:AuthManager.cs

示例8: Handle

        public virtual string Handle(string parameters, MooNetClient invokerClient = null)
        {
            // check if the user has enough privileges to access command group.
            // check if the user has enough privileges to invoke the command.
            if (invokerClient != null && this.Attributes.MinUserLevel > invokerClient.Account.UserLevel)
                return "You don't have enough privileges to invoke that command.";

            string[] @params = null;
            CommandAttribute target = null;

            if (parameters == string.Empty)
                target = this.GetDefaultSubcommand();
            else
            {
                @params = parameters.Split(' ');
                target = this.GetSubcommand(@params[0]) ?? this.GetDefaultSubcommand();

                if (target != this.GetDefaultSubcommand())
                    @params = @params.Skip(1).ToArray();
            }

            // check if the user has enough privileges to invoke the command.
            if (invokerClient != null && target.MinUserLevel > invokerClient.Account.UserLevel)
                return "You don't have enough privileges to invoke that command.";

            return (string)this._commands[target].Invoke(this, new object[] { @params, invokerClient });
        }
开发者ID:loonbg,项目名称:mooege,代码行数:27,代码来源:CommandGroup.cs

示例9: Revoke

 public void Revoke(MooNetClient client, bnet.protocol.channel_invitation.RevokeInvitationRequest request)
 {
     if (!this._onGoingInvitations.ContainsKey(request.InvitationId)) return;
     this._onGoingInvitations.Remove(request.InvitationId);
     
     //TODO: We should be also notifying invitee somehow /raist
 }
开发者ID:Jonsevc,项目名称:mooege,代码行数:7,代码来源:ChannelInvitationManager.cs

示例10: CreateGame

 public static GameFactory CreateGame(MooNetClient owner, bnet.protocol.game_master.FindGameRequest request, ulong requestId)
 {
     var gameFactory = new GameFactory(owner, request, requestId);
     GameCreators.Add(gameFactory.DynamicId, gameFactory);
     ChannelManager.AddGameChannel(gameFactory);
     return gameFactory;
 }
开发者ID:God601,项目名称:mooege,代码行数:7,代码来源:GameFactoryManager.cs

示例11: HashNormal

        public string HashNormal(string[] @params, MooNetClient invokerClient)
        {
            if (@params.Count() < 1)
                return "Invalid arguments. Type 'help hash show' to get help.";

            return StringHashHelper.HashNormal(@params[0]).ToString();
        }
开发者ID:loonbg,项目名称:mooege,代码行数:7,代码来源:DebugCommands.cs

示例12: ClientServices

        public string ClientServices(string[] @params, MooNetClient invokerClient)
        {
            var client = invokerClient;

            if (client == null && @params.Count() < 1)
                return "Invalid arguments. Type 'help services client' to get help.";
            var output = "";
            if (client == null)
            {
                var email = @params[0];
                var account = AccountManager.GetAccountByEmail(email);

                if (account == null)
                    return string.Format("No account with email '{0}' exists.", email);

                if (!account.IsOnline)
                    return string.Format("Account '{0}' is not logged in.", email);

                var gameAccounts = GameAccountManager.GetGameAccountsForAccount(account);
                foreach (var gameAccount in gameAccounts)
                {
                    output += this.ClientServices(null, gameAccount.LoggedInClient);
                }
            }
            else
            {
                output = string.Format("Imported service list for account: {0}\n", client.Account.Email);
                output = client.Services.Aggregate(output, (current, pair) =>
                    current + string.Format("Id: 0x{0} Hash: 0x{1}\n", pair.Value.ToString("X2"), pair.Key.ToString("X8")));
            }
            return output;
        }
开发者ID:loonbg,项目名称:mooege,代码行数:32,代码来源:DebugCommands.cs

示例13: SendConnectionInfo

        private void SendConnectionInfo(MooNetClient client)
        {
            if (client == this.Channel.Owner) // we should send a GameFoundNotification to part leader
            {
                var builder = bnet.protocol.game_master.GameFoundNotification.CreateBuilder();
                builder.AddConnectInfo(GetConnectionInfoForClient(client));
                builder.SetRequestId(this.RequestId);
                builder.SetGameHandle(this.GameHandle);

                client.CallMethod(bnet.protocol.game_master.GameFactorySubscriber.Descriptor.FindMethodByName("NotifyGameFound"), builder.Build(), this.DynamicId);
            }
            else // where as other members should get a bnet.protocol.notification.Notification
            {
                var connectionInfo = GetConnectionInfoForClient(client);

                var connectionInfoAttribute =
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("connection_info")
                        .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetMessageValue(connectionInfo.ToByteString()).Build())
                        .Build();

                var gameHandleAttribute =
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("game_handle")
                        .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetMessageValue(this.GameHandle.ToByteString()).Build())
                        .Build();

                var builder = bnet.protocol.notification.Notification.CreateBuilder()
                    .SetSenderId(this.Channel.Owner.CurrentToon.BnetEntityID)
                    .SetTargetId(client.CurrentToon.BnetEntityID)
                    .SetType("GAME_CONNECTION_INFO")
                    .AddAttribute(connectionInfoAttribute)
                    .AddAttribute(gameHandleAttribute);

                client.CallMethod(bnet.protocol.notification.NotificationListener.Descriptor.FindMethodByName("OnNotificationReceived"), builder.Build());
            }
        }
开发者ID:Jonsevc,项目名称:mooege,代码行数:35,代码来源:GameCreator.cs

示例14: InitAuthentication

        private static void InitAuthentication(MooNetClient client, bnet.protocol.authentication.LogonRequest request)
        {
            client.LoginEmail = request.Email;
            var account = AccountManager.GetAccountByEmail(request.Email.ToLower()); // check if account exists.
            
            if (account == null) // we should be returning an error to client /raist.
            {
                client.AuthenticationErrorCode = AuthenticationErrorCodes.NoGameAccount;
                client.AuthenticationComplete();
                return;
            }

            var thumbprintData = "f9513183031b3836103ac3a3bb606c0e06fd3b94ae4a6b6e405844085b794e901b0ebb1db650b85bac4b489a38a1ca9dcef2bbd13445d0cd85accfc62d84bc3a8d960b1a7a65cd8d3f72a172f41dca98459015ffbd25d766b02824a42dacb7c4cd64f4b3b9e316de23ec1dbb0153b73a4fa58ffb39c3f484b4b478a660dc8979e16e52f978a0ca2fc4184fa0f69844d73ef99f47e3ccb02cf6a636b4ae9513404eee7e0ad536dcef50cd1699e38195e6afdd3655a3a3529b4e52b33ac5d04f5fa2b15536a2c782c89c0acf133e14eac15af035abf5e44e9e1124a3397dac8f90a4ccb1717540698869fc1ba9037e099d68698ecf17ffdd36f07013176be24269fda1e5d221708181d95474fc1d74bb901062a9f6a3e24aef79e9d583d9126796d63c153a0f75f02da27ecc0971f39a46ec29087c3ae474e08fdf8f65d1445b293399bc495ff651b7d2d7a36216ba5e4400ea7bbc884dc4cf3ed27f14501b8bb7fc0f86b5089880e6889bcd851153e299a337d6c945f710559595e351995341cbef44abac379cf0f845b362d294eec390d50f1a50089d250eae1b1205cea1aff514de076516f467cd077a1fbb759b415dc6c0ea1617f31f7d764a0d60d5b67aa82b4202b2a9455eb9ca3683955ec45aaf56aba42a2f3ae9be5f3eed093a6601816d00e0569bfcb91fb7843945336c99757812d373d510d25744f9480b6cc87e8a".ToByteArray();

            var srp6a = new SRP6a(account); // create srp6 handler to process the authentication.
            OngoingAuthentications.Add(client, srp6a);

            // request client to load thumbprint.dll for authentication.
            var moduleLoadRequest = bnet.protocol.authentication.ModuleLoadRequest.CreateBuilder()
                .SetModuleHandle(bnet.protocol.ContentHandle.CreateBuilder()
                    .SetRegion(0x00005858) // XX
                    .SetUsage(0x61757468) // auth - thumbprint.dll
                    .SetHash(ByteString.CopyFrom(VersionInfo.MooNet.ThumbprintHashMap[client.Platform])))
                .SetMessage(ByteString.CopyFrom(thumbprintData))
                .Build();

            client.ThumbprintReq = true;
            client.MakeRPC(() => bnet.protocol.authentication.AuthenticationClient.CreateStub(client).ModuleLoad(null, moduleLoadRequest, callback => { }));
        }
开发者ID:rinoa,项目名称:mooege-1,代码行数:29,代码来源:AuthManager.cs

示例15: ParseCommand

        public void ParseCommand(bnet.protocol.notification.Notification request, MooNetClient client)
        {
            if (request.Type != "WHISPER") return;
            if (request.AttributeCount <= 0 || !request.AttributeList[0].HasValue)  return;

            CommandManager.TryParse(request.AttributeList[0].Value.StringValue, client, CommandManager.RespondOver.Whisper);
        }
开发者ID:ncoop23,项目名称:mooege,代码行数:7,代码来源:ServerCommandHandler.cs


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