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


C# Service.BaseGameResponse类代码示例

本文整理汇总了C#中ZyGames.Framework.Game.Service.BaseGameResponse的典型用法代码示例。如果您正苦于以下问题:C# BaseGameResponse类的具体用法?C# BaseGameResponse怎么用?C# BaseGameResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BaseGameResponse类属于ZyGames.Framework.Game.Service命名空间,在下文中一共展示了BaseGameResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DoAction

 /// <summary>
 /// 
 /// </summary>
 /// <param name="actionGetter"></param>
 /// <param name="response"></param>
 protected void DoAction(ActionGetter actionGetter, BaseGameResponse response)
 {
     if (GameEnvironment.IsRunning)
     {
         OnRequested(actionGetter, response);
         ActionFactory.Request(actionGetter, response);
     }
     else
     {
         response.WriteError(actionGetter, Language.Instance.ErrorCode, Language.Instance.ServerMaintain);
     }
 }
开发者ID:houguohua,项目名称:Scut,代码行数:17,代码来源:GameBaseHost.cs

示例3: 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

示例4: 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

示例5: OnRequested

        protected override void OnRequested(ActionGetter actionGetter, BaseGameResponse response)
        {
            try
            {
                var actionId = actionGetter.GetActionId();
                var uid = actionGetter.GetUserId();
                Console.WriteLine("Action{0} from {1}", actionId, uid);
                ActionFactory.Request(actionGetter, response, GetUser);

            }
            catch (Exception ex)
            {
                TraceLog.WriteError("{0}", ex);
            }
        }
开发者ID:JohnnyXq,项目名称:Scut,代码行数:15,代码来源:GameHostApp.cs

示例6: 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

示例7: WriteDateTime

 /// <summary>
 /// 
 /// </summary>
 /// <param name="response"></param>
 /// <param name="value"></param>
 protected static void WriteDateTime(BaseGameResponse response, DateTime value)
 {
     long ts = (value.ToUniversalTime() - MathUtils.UnixEpochDateTime).TotalSeconds.ToLong();
     byte[] outputStream = BitConverter.GetBytes(ts);
     response.Write(outputStream);
 }
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:11,代码来源:DataStruct.cs

示例8: WriteLong

 /// <summary>
 /// 
 /// </summary>
 /// <param name="response"></param>
 /// <param name="aValue"></param>
 protected static void WriteLong(BaseGameResponse response, Int64 aValue)
 {
     byte[] outputStream = BitConverter.GetBytes(aValue);
     response.Write(outputStream);
 }
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:10,代码来源:DataStruct.cs

示例9: 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

示例10: WriteHead

        /// <summary>
        /// 输出当前协议
        /// </summary>
        protected void WriteHead(BaseGameResponse response, int aAction, int errorCode, string errorInfo, int msgId, string st)
        {
            PushIntoStackObj(errorCode, 0);//int errorCode
            PushIntoStackObj(msgId, 1);//int msgid
            PushIntoStackObj(errorInfo, 2); //string info
            PushIntoStackObj(aAction, 3); //int actionId
            PushIntoStackObj(st, 4); //int St timespan
            //extent head
            if (_propertyStruct != null)
            {
                if (_propertyStruct.IsEmpty)
                {
                    PushIntoStackObj(0, 5);
                }
                else
                {
                    PushIntoStackObj(1, 5); //int property head length=1
                    PushIntoStackObj(_propertyStruct, 6);
                }
            }

            WriteActionNum(response); //total package length
            InternalWriteAction(response);
        }
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:27,代码来源:DataStruct.cs

示例11: InternalWriteAction

 /// <summary>
 /// 内部输出Action的值
 /// </summary>
 /// <returns>无</returns>
 protected void InternalWriteAction(BaseGameResponse response)
 {
     foreach (object obj in arrayList)
     {
         Type type = obj.GetType();
         if (type == typeof(String))
         {
             WriteString(response, Convert.ToString(obj));
         }
         else if (type == typeof(double))
         {
             WriteDouble(response, Convert.ToDouble(obj));
         }
         else if (type == typeof(float))
         {
             WriteFloat(response, Convert.ToSingle(obj));
         }
         else if (type == typeof(Int64))
         {
             WriteLong(response, Convert.ToInt64(obj));
         }
         else if (type == typeof(Int32) || type.IsEnum)
         {
             WriteInt(response, Convert.ToInt32(obj));
         }
         else if (type == typeof(Int16))
         {
             WriteShort(response, Convert.ToInt16(obj));
         }
         else if (type == typeof(UInt64))
         {
             WriteULong(response, Convert.ToUInt64(obj));
         }
         else if (type == typeof(UInt32))
         {
             WriteUInt(response, Convert.ToUInt32(obj));
         }
         else if (type == typeof(UInt16))
         {
             WriteUShort(response, Convert.ToUInt16(obj));
         }
         else if (type == typeof(Byte))
         {
             WriteByte(response, Convert.ToByte(obj));
         }
         else if (type == typeof(bool))
         {
             WriteBool(response, Convert.ToBoolean(obj));
         }
         else if (type == typeof(DateTime))
         {
             WriteDateTime(response, Convert.ToDateTime(obj));
         }
         else if (type == typeof(DataStruct))
         {
             DataStruct ds = ((DataStruct)obj);
             ds.WriteActionNum(response);
             ds.InternalWriteAction(response);
         }
         else if (type == typeof(byte[]))
         {
             //By Seamoon已序列化好的内容,直接写入
             var bytes = (byte[])(obj);
             WriteInt(response, bytes.Length);
             response.Write(bytes);
         }
     }
 }
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:72,代码来源:DataStruct.cs

示例12: WriteHead

 /// <summary>
 /// 输出当前协议
 /// </summary>
 protected void WriteHead(BaseGameResponse response, int aAction, int errorCode, string errorInfo, int msgId, string st)
 {
     PushIntoStackObj(errorCode, 0);
     PushIntoStackObj(msgId, 1);
     //结果String
     PushIntoStackObj(errorInfo, 2);
     PushIntoStackObj(aAction, 3);
     //St
     PushIntoStackObj(st, 4);
     WriteActionNum(response);
     InternalWriteAction(response);
 }
开发者ID:kehaoran74,项目名称:Scut,代码行数:15,代码来源:DataStruct.cs

示例13: OnRequested

 protected override void OnRequested(ActionGetter actionGetter, BaseGameResponse response)
 {
     Console.WriteLine("Client {0} request action {1}", actionGetter.GetSessionId(), actionGetter.GetActionId());
 }
开发者ID:Menq,项目名称:ScutServer_MQ,代码行数:4,代码来源:MainClass.cs

示例14: OnRequested

 protected override void OnRequested(ActionGetter actionGetter, BaseGameResponse response)
 {
     Console.WriteLine("url:{0}", actionGetter.ToParamString());
     base.OnRequested(actionGetter, response);
 }
开发者ID:daneric,项目名称:Scut-samples,代码行数:5,代码来源:MainClass.cs

示例15: 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


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