• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Service.BaseGameResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnRequested

 protected override void OnRequested(ActionGetter actionGetter, BaseGameResponse response)
 {
     base.OnRequested(actionGetter, response);
 }
开发者ID:houguohua,项目名称:Scut,代码行数:4,代码来源:MainClass.cs


示例17: OnRequested

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


示例18: BinaryWriteResponse

 /// <summary>
 /// 
 /// </summary>
 /// <param name="response"></param>
 protected void BinaryWriteResponse(BaseGameResponse response) {
     if (!isNotRespond) {
         WriteHeadProperty();
         BuildPacket();
     }
     WriteAction(response);
     WriteEnd();
 }
开发者ID:daneric,项目名称:Scut,代码行数:12,代码来源:GameStruct.cs


示例19: OnRequested

 /// <summary>
 /// Raises the requested event.
 /// </summary>
 /// <param name="actionGetter">Http get.</param>
 /// <param name="response">Response.</param>
 protected virtual void OnRequested(ActionGetter actionGetter, BaseGameResponse response)
 {
 }
开发者ID:yunjoker,项目名称:Scut,代码行数:8,代码来源:GameBaseHost.cs


示例20: WriteResponse

 /// <summary>
 /// Write response
 /// </summary>
 public virtual void WriteResponse(BaseGameResponse response)
 {
     BuildPacket();
     WriteAction(response);
     WriteEnd();
 }
开发者ID:juneman,项目名称:Scut,代码行数:9,代码来源:GameStruct.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Service.DataStruct类代码示例发布时间:2022-05-26
下一篇:
C# Model.TableData类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap