本文整理汇总了C#中GameServer.DoPlugInAction方法的典型用法代码示例。如果您正苦于以下问题:C# GameServer.DoPlugInAction方法的具体用法?C# GameServer.DoPlugInAction怎么用?C# GameServer.DoPlugInAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameServer
的用法示例。
在下文中一共展示了GameServer.DoPlugInAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tick
private void Tick(GameServer server)
{
if (server != null)
{
lock (server)
{
lock (this)
{
if (server.IsConnected)
{
_checkPingTickCurrent++;
if (_checkPingTickCurrent >= _checkPingTickDo)
{
_checkPingTickCurrent = 0;
if (_lastPing == DateTime.MinValue)
{
_lastPing = DateTime.Now;
}
DoPing(server);
if (server.GameServiceState != GameServer.ServiceState.ErrorStopped)
{
//如果服务器正在启动,则重置一次_lastPing,以免被认为是启动失败
if (server.GameServiceState == GameServer.ServiceState.Starting)
{
_lastPing = DateTime.Now;
}
if (((TimeSpan)(DateTime.Now - _lastPing)).TotalSeconds > _pingTimeOutTick)
{
if (server.GameServiceState == GameServer.ServiceState.Stopping || server.GameServiceState == GameServer.ServiceState.OKStopped)
{
if (server.PID > 0 || server.PID == -2)
{
string[] para = new string[1] { server.Id.ToString() };
server.DoPlugInAction(1, E2gServerPID.PlugInGuid, E2gServerPID.actionKey, para);
}
else
server.GameServiceState = GameServer.ServiceState.OKStopped;
}
else
{
server.GameServiceState = GameServer.ServiceState.ErrorStopped;
}
// server.Disconnect();
_lastPing = DateTime.MinValue;
}
}
}
}
else
{
_checkPingTickCurrent = 0;
_lastPing = DateTime.MinValue;
}
}
}
}
}