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


C# NetworkClient.Login方法代码示例

本文整理汇总了C#中Hypercube.Client.NetworkClient.Login方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkClient.Login方法的具体用法?C# NetworkClient.Login怎么用?C# NetworkClient.Login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hypercube.Client.NetworkClient的用法示例。


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

示例1: Handle

        public void Handle(NetworkClient client)
        {
            client.CS.LoginName = Name;
            client.CS.MpPass = Motd;

            if (ProtocolVersion != 7) {
                ServerCore.Logger.Log("Handshake", "Disconnecting client '" + Name + "'. Unsupported protocol verison (" + ProtocolVersion + ")", LogType.Info);
                client.KickPlayer("Unsupported protocol version.");
                return;
            }

            if (!ServerCore.Hb.VerifyClientName(client)) {
                ServerCore.Logger.Log("Handshake", "Disconnecting client '" + Name + "'. Failed to verify name.", LogType.Info);
                client.KickPlayer("Name verification incorrect.");
                return;
            }

            if (Text.StringMatches(Name)) {
                ServerCore.Logger.Log("Handshake", "Disconnecting Client '" + Name + "'. Invalid characters in name.", LogType.Info);
                client.KickPlayer("Invalid characters in name.");
                return;
            }

            if (Name == "") {
                ServerCore.Logger.Log("Handshake", "Disconnecting Client '" + Name + "'. Invalid name.", LogType.Info);
                client.KickPlayer("Invalid name.");
                return;
            }

            if (ServerCore.OnlinePlayers > ServerCore.Nh.MaxPlayers) {
                client.KickNow("The server is full.");
                return;
            }

            client.CS.MpPass = Motd;

            if (Usertype == 66) {
                // -- CPE Client
                ServerCore.Logger.Log("Handshake", "CPE Client Detected.", LogType.Info);
                client.CS.CPE = true;
                CPE.CPEHandshake(client);
                return;
            }

            // -- Normal Client.
            client.CS.CPE = false;
            client.Login();
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:48,代码来源:Packets.cs

示例2: CPEPackets

        /// <summary>
        /// Sends additional pre-login packets after receiving a client's supported extensions.
        /// </summary>
        /// <param name="client"></param>
        public static void CPEPackets(NetworkClient client)
        {
            if (client.CS.CPEExtensions.ContainsKey("ClickDistance")) {
                var distance = new SetClickDistance {Distance = (short) ServerCore.ClickDistance};
                client.SendQueue.Enqueue(distance);
            }

            if (client.CS.CPEExtensions.ContainsKey("CustomBlocks")) {
                var cbsl = new CustomBlockSupportLevel {SupportLevel = CustomBlocksSupportLevel};
                client.SendQueue.Enqueue(cbsl);
            } else
                client.Login();
        }
开发者ID:umby24,项目名称:Hypercube,代码行数:17,代码来源:CPE.cs


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