예제 #1
0
        public unsafe INetworkMessage Begin(MsgDest msg_dest, int msg_type, Edict ed = null)
        {
            if (CurrentMessage != null)
            {
                throw new InvalidOperationException("Cannot start a network message while another message is active");
            }

            EngineFuncs.pfnMessageBegin(msg_dest, msg_type, IntPtr.Zero, ed.Data);

            CurrentMessage = new NetworkMessage(EngineFuncs, this);

            return(CurrentMessage);
        }
예제 #2
0
        public unsafe INetworkMessage Begin(MsgDest msg_dest, int msg_type, Vector pOrigin, Edict ed = null)
        {
            if (CurrentMessage != null)
            {
                throw new InvalidOperationException("Cannot start a network message while another message is active");
            }

            var originAddress = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Vector)));

            try
            {
                Marshal.StructureToPtr(pOrigin, originAddress, false);
                EngineFuncs.pfnMessageBegin(msg_dest, msg_type, originAddress, ed.Data);
            }
            finally
            {
                Marshal.FreeHGlobal(originAddress);
            }

            CurrentMessage = new NetworkMessage(EngineFuncs, this);

            return(CurrentMessage);
        }
예제 #3
0
 public static INetworkMessage Begin(MsgDest msg_dest, ServerCommand msg_type, in Vector pOrigin, Edict ed = null)