本文整理汇总了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();
}
示例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();
}