Example #1
0
 public Action1000(ActionGetter actionGetter)
     : base(1000, actionGetter)
 {
     responsePack = new ResponsePack();
     _watch = new Stopwatch();
     _versionsNotSupport = new List<string>();
 }
Example #2
0
 private void SetResponseHead()
 {
     _responseHead = new ResponsePack()
     {
         MsgId = actionGetter.GetMsgId(),
         ActionId = actionGetter.GetActionId(),
         ErrorCode = ErrorCode,
         ErrorInfo = ErrorInfo,
         St = St
     };
 }
 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);
 }
Example #4
0
 protected override bool DecodePacket(MessageStructure reader, MessageHead head)
 {
     responsePack = ProtoBufUtils.Deserialize<ResponsePack>(netReader.Buffer);
      string responseDataInfo = "";
      responseDataInfo  = "request :" + Game.Utils.JsonHelper.prettyJson<Request1000Pack>(req) + "\n";
      responseDataInfo += "response:" + Game.Utils.JsonHelper.prettyJson<ResponsePack>(responsePack) + "\n";
      DecodePacketInfo = responseDataInfo;
      int childStepId = getChild(1000);
      if(childStepId>0)
      {
         System.Collections.Generic.Dictionary<string,string> dic = new System.Collections.Generic.Dictionary<string,string>();
         dic.Add("UserID",responsePack.UserID.ToString()) ;
         SetChildStep(childStepId.ToString(),_setting,dic);
      }
      return true;
 }
Example #5
0
 protected override bool DecodePacket(MessageStructure reader, MessageHead head)
 {
     responsePack = ProtoBufUtils.Deserialize<ResponsePack>(netReader.Buffer);
     string responseDataInfo = "";
     responseDataInfo = "request :" + Game.Utils.JsonHelper.prettyJson<Request2000Pack>(req) + "\n";
     responseDataInfo += "response:" + Game.Utils.JsonHelper.prettyJson<ResponsePack>(responsePack) + "\n";
     DecodePacketInfo = responseDataInfo;
     int childStepId = getChild(2000);
     System.Console.WriteLine("childStepID:"+childStepId);
     if (childStepId > 0)
     {
         System.Collections.Generic.Dictionary<string, string> dic = new System.Collections.Generic.Dictionary<string, string>();
         /*
            req.token = GetParamsData("token",req.token);
                   req.typeUser = GetParamsData("typeUser",req.typeUser);
                   req.version = GetParamsData("version", req.version);
                   req.UserID = GetParamsData("UserID", req.UserID);
          */
         SetChildStep(childStepId.ToString(),_setting,dic);
     }
     return true;
 }