本文整理汇总了C#中GameServer.AppendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# GameServer.AppendMessage方法的具体用法?C# GameServer.AppendMessage怎么用?C# GameServer.AppendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameServer
的用法示例。
在下文中一共展示了GameServer.AppendMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageReceived
private void MessageReceived(GameServer server, IProtocol message)
{
switch ((ProtocolDef)message.ProtocolId)
{
case ProtocolDef.g2e_exesyscmd_def:
{
g2e_exesyscmd protocol = message as g2e_exesyscmd;
FSEyeResult returnCode = (FSEyeResult)protocol.ReturnCode;
switch (_guardTask)
{
case GuardTask.Unknown:
case GuardTask.Idle:
//设置时间服务器断连后的回包处理
//if (returnCode == FSEyeResult.g2e_ExeSysCmd_done) break;
//throw new Exception("State Exception");
case GuardTask.StartGameServer:
switch (returnCode)
{
case FSEyeResult.g2e_ExeSysCmd_done:
_guardTask = GuardTask.Idle;
break;
case FSEyeResult.g2e_ExeSysCmd_busy:
break;
case FSEyeResult.g2e_ExeSysCmd_result:
AppendSysCmdOutput(protocol.OutputBuff);
break;
}
break;
case GuardTask.DoNormalSysCmd:
switch (returnCode)
{
case FSEyeResult.g2e_ExeSysCmd_done:
_guardTask = GuardTask.Idle;
break;
case FSEyeResult.g2e_ExeSysCmd_busy:
break;
case FSEyeResult.g2e_ExeSysCmd_result:
AppendSysCmdOutput(protocol.OutputBuff);
break;
}
break;
case GuardTask.UpdateGameServer:
switch (returnCode)
{
case FSEyeResult.g2e_ExeSysCmd_done:
{
_guardTask = GuardTask.Idle;
if (_updateGameResult.ToString().Contains("fail"))
{
server.AppendMessage(string.Format("UpdateGameFail\nFailureMessage:\"{0}\"", _updateGameResult.ToString()), GameServer.MessageInfo.Type.Failure);
//触发UpdateGameFail事件
AutomationContext context = new AutomationContext();
context.Message = string.Format("{0} UpdateGameFail\nFailureMessage:\"{1}\"", server.ToString(), _updateGameResult.ToString()); ;
context.Server = server;
AdminServer.TheInstance.StrategyManager.OnEvent(FSEyeEvent.UpdateGameFail, context);
}
else
{
server.AppendMessage("UpdateGameSucceed", GameServer.MessageInfo.Type.Success);
//触发UpdateGameSucceed事件
AutomationContext context = new AutomationContext();
context.Message = string.Format("{0} UpdateGameSucceed", server.ToString());
context.Server = server;
AdminServer.TheInstance.StrategyManager.OnEvent(FSEyeEvent.UpdateGameSucceed, context);
}
}
break;
case FSEyeResult.g2e_ExeSysCmd_busy:
break;
case FSEyeResult.g2e_ExeSysCmd_result:
_updateGameResult.Append(protocol.OutputBuff);
break;
}
break;
case GuardTask.RefreshUploadDirFileInfo:
switch (returnCode)
{
case FSEyeResult.g2e_ExeSysCmd_done:
_guardTask = GuardTask.Idle;
break;
case FSEyeResult.g2e_ExeSysCmd_busy:
break;
case FSEyeResult.g2e_ExeSysCmd_result:
_uploadDirInfo += protocol.OutputBuff;
break;
}
break;
case GuardTask.CheckGame:
switch (returnCode)
{
case FSEyeResult.g2e_ExeSysCmd_done:
_guardTask = GuardTask.Idle;
_GameProcessState = (protocol.OutputBuff.Length > 0) ? GameProcessState.Exist : GameProcessState.NotExist;
break;
case FSEyeResult.g2e_ExeSysCmd_busy:
break;
case FSEyeResult.g2e_ExeSysCmd_result:
//.........这里部分代码省略.........