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


C# GameServer.AppendMessage方法代码示例

本文整理汇总了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:
//.........这里部分代码省略.........
开发者ID:viticm,项目名称:pap2,代码行数:101,代码来源:GameServerControl.cs


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