當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseGameResponse.BinaryWrite方法代碼示例

本文整理匯總了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());
 }
開發者ID:juneman,項目名稱:Scut,代碼行數:7,代碼來源:ActionDispatcher.cs

示例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)));
 }
開發者ID:daneric,項目名稱:Scut-samples,代碼行數:13,代碼來源:WebSocketActionDispatcher.cs

示例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);
 }
開發者ID:guccang,項目名稱:scutlogic,代碼行數:15,代碼來源:CustomActionDispatcher.cs

示例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);
        }
開發者ID:daneric,項目名稱:Scut-samples,代碼行數:21,代碼來源:BaseAction.cs

示例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);
     }
 }
開發者ID:LeeWangyeol,項目名稱:Scut,代碼行數:16,代碼來源:DataStruct.cs

示例6: WriteResponse

 /// <summary>
 /// 
 /// </summary>
 /// <param name="response"></param>
 public override void WriteResponse(BaseGameResponse response)
 {
     byte[] buffer = BuildResponsePack();
     response.BinaryWrite(buffer);
 }
開發者ID:GamesDesignArt,項目名稱:UniversalCommon,代碼行數:9,代碼來源:BinaryAction.cs

示例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());
 }
開發者ID:LeeWangyeol,項目名稱:Scut,代碼行數:20,代碼來源:ActionDispatcher.cs


注:本文中的ZyGames.Framework.Game.Service.BaseGameResponse.BinaryWrite方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。