當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。