本文整理汇总了C#中RealmPacketOut.InsertIntAt方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.InsertIntAt方法的具体用法?C# RealmPacketOut.InsertIntAt怎么用?C# RealmPacketOut.InsertIntAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketOut
的用法示例。
在下文中一共展示了RealmPacketOut.InsertIntAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessQueuedClients
/// <summary>
/// Goes through the queue, pulling out clients for the number of slots available at the time.
/// </summary>
/// <param name="state">the timer object</param>
private static void ProcessQueuedClients(object state)
{
var acceptedClients = new List<IRealmClient>();
try
{
var clientAccepts = RealmServerConfiguration.MaxClientCount - RealmServer.Instance.AcceptedClients;
IRealmClient client;
while (clientAccepts != 0)
{
if (s_queuedClients.TryDequeue(out client))
{
acceptedClients.Add(client);
clientAccepts--;
}
else
{
break;
}
}
int clientPosition = 0;
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_RESPONSE))
{
packet.Write((byte)LoginErrorCode.AUTH_WAIT_QUEUE);
packet.Write(0);
foreach (var waitingClient in s_queuedClients)
{
packet.InsertIntAt(clientPosition++, 5, false);
waitingClient.Send(packet);
}
}
}
catch (Exception e)
{
LogUtil.ErrorException(e, "AuthQueue raised an Exception.");
}
finally
{
PerformanceCounters.NumbersOfClientsInAuthQueue.RawValue = s_queuedClients.Count;
foreach (var acceptedClient in acceptedClients)
{
acceptedClient.Account.IsEnqueued = false;
LoginHandler.InviteToRealm(acceptedClient);
}
}
}