本文整理汇总了C#中RequestType.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# RequestType.GetHashCode方法的具体用法?C# RequestType.GetHashCode怎么用?C# RequestType.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestType
的用法示例。
在下文中一共展示了RequestType.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
//.........这里部分代码省略.........
var Cardlist = GameServer.DrawCard(int.Parse(Request.Substring(3, 5)), Request.Substring(8, 1) == CardUtility.strTrue, int.Parse(Request.Substring(9, 1)));
Response = string.Join(CardUtility.strSplitArrayMark, Cardlist.ToArray());
break;
case RequestType.回合结束:
if (SystemManager.游戏类型 == SystemManager.GameType.HTML版)
{
GameId = int.Parse(Request.Substring(3, 5));
IsHost = Request.Substring(8, 1) == CardUtility.strTrue;
GameServer.GameRunning_BS[GameId].TurnEnd(IsHost);
Response = IsHost ? CardUtility.strTrue : CardUtility.strFalse;
}
else
{
GameServer.WriteAction(int.Parse(Request.Substring(3, 5)), Request.Substring(8));
}
break;
case RequestType.写入行动:
GameServer.WriteAction(int.Parse(Request.Substring(3, 5)), Request.Substring(8));
break;
case RequestType.读取行动:
Response = GameServer.ReadAction(int.Parse(Request.Substring(3, 5)));
break;
case RequestType.奥秘判定:
Response = GameServer.SecretHit(int.Parse(Request.Substring(3, 5)), Request.Substring(8, 1) == CardUtility.strTrue, Request.Substring(9));
break;
case RequestType.使用手牌:
GameId = int.Parse(Request.Substring(3, 5));
IsHost = Request.Substring(8, 1) == CardUtility.strTrue;
//这里可能产生中断
var interrput = GameServer.UseHandCard(GameId, IsHost, Request.Substring(9), 1, string.Empty);
Response = interrput.ToJson();
if (interrput.ActionName == CardUtility.strOK)
{
Response = GetOkResponse(Request.Substring(9), interrput);
}
else
{
Response = interrput.ToJson();
}
break;
case RequestType.战场状态:
GameId = int.Parse(Request.Substring(3, 5));
IsHost = Request.Substring(8, 1) == CardUtility.strTrue;
//WebSocket将会同时将信息发送给双方,所以这里发送以HOST为主视角的战场信息
info.Init(GameServer.GameRunning_BS[GameId].gameStatus(IsHost));
Response = info.ToJson();
break;
case RequestType.中断续行:
GameId = int.Parse(Request.Substring(3, 5));
IsHost = Request.Substring(8, 1) == CardUtility.strTrue;
RequestType ResumeType = (RequestType)Enum.Parse(typeof(RequestType), Request.Substring(9, 3));
int Step = int.Parse(Request.Substring(12, 1));
string CardSN = Request.Substring(13, 7);
if (ResumeType == RequestType.使用手牌)
{
var resume = GameServer.UseHandCard(GameId, IsHost, CardSN, Step, Request.Substring(20));
if (resume.ActionName == CardUtility.strOK)
{
Response = GetOkResponse(CardSN, resume);
}
else
{
Response = resume.ToJson();
}
}
requestType = ResumeType;
break;
case RequestType.攻击行为:
GameId = int.Parse(Request.Substring(3, 5));
IsHost = Request.Substring(8, 1) == CardUtility.strTrue;
//017000010ME#1|YOU#2|
int MyPos = int.Parse(Request.Substring(12, 1));
int YourPos = int.Parse(Request.Substring(18, 1));
GameServer.Fight(GameId, IsHost, MyPos, YourPos);
Response = Request.Substring(12, 1) + Request.Substring(18, 1);
break;
case RequestType.可攻击对象:
GameId = int.Parse(Request.Substring(3, 5));
IsHost = Request.Substring(8, 1) == CardUtility.strTrue;
Response = GameServer.GetFightTargetList(GameId, IsHost);
break;
case RequestType.获得AI行动:
GameId = int.Parse(Request.Substring(3, 5));
interrput = GameServer.GetAIAction(GameId);
Response = interrput.ToJson();
if (interrput.ActionName == ActionCode.strEndTurn)
{
GameServer.GameRunning_BS[GameId].TurnEnd(false);
}
break;
default:
//结束游戏
break;
}
if (SystemManager.游戏类型 == SystemManager.GameType.HTML版)
{
Response = requestType.GetHashCode().ToString("D3") + Response;
}
return Response;
}