示例#1
0
        public static int RRecv(int argc, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeConst = SharpC.maxArgs)] SharpC.CSObject[] argv)
        {
            UnityEngine.Debug.Assert(argv[1].type == SharpC.CSType.SHARPOBJECT);
            Rudp   u      = (Rudp)SharpC.cache.Get(argv[1].v32);
            IntPtr buffer = argv[2].ptr;
            int    len    = argv[3].v32;

            if (u.OnRecv != null)
            {
                Marshal.Copy(buffer, _recvBuffer, 0, len);
                u.OnRecv(_recvBuffer, 0, len);
            }
            return(0);
        }
示例#2
0
文件: Rudp.cs 项目: wy182000/mahjong
        public static int RSend(int argc, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 8)] SharpC.CSObject[] argv, int args, int res)
        {
            UnityEngine.Debug.Assert(args >= 3);
            UnityEngine.Debug.Assert(argv[1].type == SharpC.CSType.SHARPOBJECT);
            Rudp   u      = (Rudp)SharpC.cache.Get(argv[1].v32);
            IntPtr buffer = argv[2].ptr;
            int    len    = argv[3].v32;

            if (u.OnSend != null)
            {
                Marshal.Copy(buffer, _sendBuffer, 0, len);
                u.OnSend(_sendBuffer, 0, len);
            }
            return(0);
        }