Esempio n. 1
0
    void ReturnPassengerFlow(SocketMessage sm)
    {
        STOC_PASSENGER_FLOW info = SocketDataTool.GetStruct <STOC_PASSENGER_FLOW>(sm.realMsg, Marshal.SizeOf(sm.realHeader));

        if (sm.realHeader.nError == (UInt16)GAMESERVER_ERROR.ERR_GAMESERVER_SUCCESS)
        {
            if (PassengerFlowCallback != null)
            {
                PassengerFlowCallback(info.channel, info.RuleId, info.count, System.Text.Encoding.Default.GetString(Trim(info.ipFrom)));
            }
        }
    }
Esempio n. 2
0
    void ReturnGotoPresetPosition(SocketMessage sm)
    {
        STOC_GOTOPREPOSITION info = SocketDataTool.GetStruct <STOC_GOTOPREPOSITION>(sm.realMsg, Marshal.SizeOf(sm.realHeader));

        if (sm.realHeader.nError == (UInt16)GAMESERVER_ERROR.ERR_GAMESERVER_SUCCESS)
        {
            GotoPresetPosCallback(info.cameraId, info.camareGuid, true);
        }
        else
        {
            GotoPresetPosCallback(info.cameraId, info.camareGuid, false);
        }
    }
Esempio n. 3
0
    void ReturnSetPTZCtrl(SocketMessage sm)
    {
        STOC_SETPTZCTRL info = SocketDataTool.GetStruct <STOC_SETPTZCTRL>(sm.realMsg, Marshal.SizeOf(sm.realHeader));

        if (sm.realHeader.nError == (UInt16)GAMESERVER_ERROR.ERR_GAMESERVER_SUCCESS)
        {
            SetPTZCtrlCallback(info.cameraId, info.camareGuid, true);
        }
        else
        {
            SetPTZCtrlCallback(info.cameraId, info.camareGuid, false);
        }
    }
Esempio n. 4
0
    void ReturnCloseCamera(SocketMessage sm)
    {
        STOC_CLOSECAMERA info = SocketDataTool.GetStruct <STOC_CLOSECAMERA>(sm.realMsg, Marshal.SizeOf(sm.realHeader));

        if (sm.realHeader.nError == (UInt16)GAMESERVER_ERROR.ERR_GAMESERVER_SUCCESS)
        {
            CloseCameraCallback(info.cameraId, info.camareGuid, true);
        }
        else
        {
            CloseCameraCallback(info.cameraId, info.camareGuid, false);
        }
    }
Esempio n. 5
0
 void ReturnCameraList(SocketMessage sm)
 {
     if (sm.realHeader.nError == (UInt16)GAMESERVER_ERROR.ERR_GAMESERVER_SUCCESS)
     {
         NetworkClient.Instance.cameraList = new List <CAMARE_INFO>();
         int sum = BitConverter.ToInt32(sm.realMsg, Marshal.SizeOf(sm.realHeader));
         for (int i = 0; i < sum; i++)
         {
             CAMARE_INFO info = SocketDataTool.GetStruct <CAMARE_INFO>(sm.realMsg, Marshal.SizeOf(sm.realHeader) + Marshal.SizeOf(typeof(int)) + i * Marshal.SizeOf(typeof(CAMARE_INFO)));
             NetworkClient.Instance.cameraList.Add(info);
         }
     }
 }
Esempio n. 6
0
 static public T Parse <T>(byte[] bytes, int offset) where T : ISocketData, new()
 {
     return(SocketDataTool.GetSocketData <T>(bytes, offset));
 }
Esempio n. 7
0
 /// <summary>
 /// 序列化结构化数据
 /// 即:将结构化数据转化为byte[]
 /// 如果包含动态(不定长)数组,需要重写
 /// </summary>
 /// <returns></returns>
 public virtual byte[] Serialize()
 {
     return(SocketDataTool.GetBytes(this));
 }