本文整理匯總了C#中ZyGames.Framework.Game.Service.BaseGameResponse.BinaryWrite方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseGameResponse.BinaryWrite方法的具體用法?C# BaseGameResponse.BinaryWrite怎麽用?C# BaseGameResponse.BinaryWrite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ZyGames.Framework.Game.Service.BaseGameResponse
的用法示例。
在下文中一共展示了BaseGameResponse.BinaryWrite方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ResponseError
public virtual void ResponseError(BaseGameResponse response, ActionGetter actionGetter, int errorCode, string errorInfo)
{
MessageHead head = new MessageHead(actionGetter.GetMsgId(), actionGetter.GetActionId(), errorCode, errorInfo);
MessageStructure sb = new MessageStructure();
sb.WriteBuffer(head);
response.BinaryWrite(sb.PopBuffer());
}
示例2: ResponseError
public override void ResponseError(BaseGameResponse response, ActionGetter actionGetter, int errorCode, string errorInfo)
{
var result = new ResultData()
{
MsgId = actionGetter.GetMsgId(),
ActionId = actionGetter.GetActionId(),
ErrorCode = errorCode,
ErrorInfo = errorInfo,
Data = null
};
//實現出錯處理下發
response.BinaryWrite(Encoding.UTF8.GetBytes(MathUtils.ToJson(result)));
}
示例3: ResponseError
public void ResponseError(BaseGameResponse response, ActionGetter actionGetter, int errorCode, string errorInfo)
{
//實現出錯處理下發
ResponsePack head = new ResponsePack()
{
MsgId = actionGetter.GetMsgId(),
ActionId = actionGetter.GetActionId(),
ErrorCode = errorCode,
ErrorInfo = errorInfo,
St = actionGetter.GetSt()
};
byte[] headBytes = ProtoBufUtils.Serialize(head);
byte[] buffer = BufferUtils.AppendHeadBytes(headBytes);
response.BinaryWrite(buffer);
}
示例4: WriteResponse
public override void WriteResponse(BaseGameResponse response)
{
SetResponseHead();
byte[] headBytes = ProtoBufUtils.Serialize(_responseHead);
byte[] contentBytes = BuildResponsePack();
byte[] buffer = null;
if (contentBytes == null || contentBytes.Length == 0)
{
buffer = BufferUtils.AppendHeadBytes(headBytes);
}
else
{
buffer = BufferUtils.MergeBytes(
BufferUtils.AppendHeadBytes(headBytes),
contentBytes
);
}
//需要對字節數據加密處理,這裏跳過
response.BinaryWrite(buffer);
}
示例5: WriteString
/// <summary>
/// 寫入字節流
/// </summary>
/// <param name="aValue"></param>
/// <param name="response"></param>
protected static void WriteString(BaseGameResponse response, string aValue)
{
byte[] outputStream = System.Text.Encoding.UTF8.GetBytes(aValue);
int iLen = outputStream.Length;
byte[] outputStreamForLen = BitConverter.GetBytes(iLen);
response.BinaryWrite(outputStreamForLen);
if (outputStream.Length > 0)
{
response.BinaryWrite(outputStream);
}
}
示例6: WriteResponse
/// <summary>
///
/// </summary>
/// <param name="response"></param>
public override void WriteResponse(BaseGameResponse response)
{
byte[] buffer = BuildResponsePack();
response.BinaryWrite(buffer);
}
示例7: ResponseError
/// <summary>
///
/// </summary>
/// <param name="response"></param>
/// <param name="actionGetter"></param>
/// <param name="errorCode"></param>
/// <param name="errorInfo"></param>
public virtual void ResponseError(BaseGameResponse response, ActionGetter actionGetter, int errorCode, string errorInfo)
{
string st = actionGetter.GetSt();
ProtocolVersion prtcl = actionGetter.GetPtcl();
MessageHead head = new MessageHead(actionGetter.GetMsgId(), actionGetter.GetActionId(), st, errorCode, errorInfo);
MessageStructure sb = new MessageStructure();
if (prtcl >= ProtocolVersion.ExtendHead)
{
sb.PushIntoStack(0); //不輸出擴展頭屬性
}
sb.WriteBuffer(head);
response.BinaryWrite(sb.PopBuffer());
}