public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.GunFireHit);
            return(msg);
        }
示例#2
0
 public ChangeObjectOwnershipMessage(P2PMessage msg)
 {
     objectId    = msg.ReadUShort();
     ownerId     = msg.ReadByte();
     linVelocity = msg.ReadVector3();
     angVelocity = msg.ReadVector3();
 }
        internal SteamTransportConnection(ulong id, P2PMessage initialMessage)
        {
            ConnectedTo = id;
            SendMessage(initialMessage, MessageSendType.Reliable);

            MelonModLogger.Log($"Steam: Sent initial message to {id}");
        }
 public void SendMessage(P2PMessage msg, MessageSendType sendType)
 {
     SteamTransportLayer.messageSendCmds.Enqueue(new SteamTransportLayer.MessageSendCmd()
     {
         msg = msg, sendType = sendType, id = ConnectedTo
     });
 }
示例#5
0
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.SetLocalSmallId);
            msg.WriteByte(smallId);
            return(msg);
        }
示例#6
0
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            //msg.WriteByte();

            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.PlayerName);
            msg.WriteUnicodeString(name);
            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.SceneTransition);
            msg.WriteUnicodeString(sceneName);
            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.SetPartyId);
            msg.WriteUnicodeString(partyId);
            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.IdRequest);
            msg.WriteUnicodeString(namePath);

            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.GunFire);
            msg.WriteVector3(fireOrigin);
            msg.WriteVector3(fireDirection);
            msg.WriteFloat(bulletDamage);
            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.IdAllocation);
            msg.WriteUnicodeString(namePath);
            msg.WriteUShort(allocatedId);

            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.Join);
            msg.WriteByte(playerId);
            msg.WriteUlong(steamId.Value);
            msg.WriteUnicodeString(name);
            return(msg);
        }
示例#14
0
 public GunFireMessage(P2PMessage msg)
 {
     handedness        = msg.ReadByte();
     firepointPos      = msg.ReadVector3();
     firepointRotation = msg.ReadQuaternion();
     ammoDamage        = msg.ReadFloat();
     projectileMass    = msg.ReadFloat();
     exitVelocity      = msg.ReadFloat();
     muzzleVelocity    = msg.ReadFloat();
 }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.EnemyRigTransform);
            msg.WriteByte(poolChildIdx);
            msg.WriteByte((byte)enemyType);
            msg.WriteVector3(posMain);
            msg.WriteVector3(posRoot);

            msg.WriteCompressedVector3(posLHip, posRoot);
            msg.WriteCompressedVector3(posRHip, posRoot);
            msg.WriteCompressedVector3(posLKnee, posRoot);
            msg.WriteCompressedVector3(posRKnee, posRoot);
            msg.WriteCompressedVector3(posLAnkle, posRoot);
            msg.WriteCompressedVector3(posRAnkle, posRoot);

            msg.WriteCompressedVector3(posSpine1, posRoot);
            msg.WriteCompressedVector3(posSpine2, posRoot);
            msg.WriteCompressedVector3(posSpineTop, posRoot);
            msg.WriteCompressedVector3(posLClavicle, posRoot);
            msg.WriteCompressedVector3(posRClavicle, posRoot);
            msg.WriteCompressedVector3(posNeck, posRoot);
            msg.WriteCompressedVector3(posLShoulder, posRoot);
            msg.WriteCompressedVector3(posRShoulder, posRoot);
            msg.WriteCompressedVector3(posLElbow, posRoot);
            msg.WriteCompressedVector3(posRElbow, posRoot);
            msg.WriteCompressedVector3(posLWrist, posRoot);
            msg.WriteCompressedVector3(posRWrist, posRoot);

            msg.WriteSmallerCompressedQuaternion(rotMain);
            msg.WriteSmallerCompressedQuaternion(rotRoot);
            msg.WriteSmallerCompressedQuaternion(rotLHip);
            msg.WriteSmallerCompressedQuaternion(rotRHip);
            msg.WriteSmallerCompressedQuaternion(rotLKnee);
            msg.WriteSmallerCompressedQuaternion(rotRKnee);
            msg.WriteSmallerCompressedQuaternion(rotLAnkle);
            msg.WriteSmallerCompressedQuaternion(rotRAnkle);

            msg.WriteSmallerCompressedQuaternion(rotSpine1);
            msg.WriteSmallerCompressedQuaternion(rotSpine2);
            msg.WriteSmallerCompressedQuaternion(rotSpineTop);
            msg.WriteSmallerCompressedQuaternion(rotLClavicle);
            msg.WriteSmallerCompressedQuaternion(rotRClavicle);
            msg.WriteSmallerCompressedQuaternion(rotNeck);
            msg.WriteSmallerCompressedQuaternion(rotLShoulder);
            msg.WriteSmallerCompressedQuaternion(rotRShoulder);
            msg.WriteSmallerCompressedQuaternion(rotLElbow);
            msg.WriteSmallerCompressedQuaternion(rotRElbow);
            msg.WriteSmallerCompressedQuaternion(rotLWrist);
            msg.WriteSmallerCompressedQuaternion(rotRWrist);

            return(msg);
        }
        public HandGunChangeMessage(P2PMessage msg, bool forOtherPlayer = false)
        {
            isForOtherPlayer = forOtherPlayer;
            if (isForOtherPlayer)
            {
                playerId = msg.ReadByte();
            }

            destroy = Convert.ToBoolean(msg.ReadByte());
            type    = (GunType)msg.ReadByte();
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.ObjectSync);
            msg.WriteUShort(id);
            msg.WriteVector3(position);
            msg.WriteCompressedQuaternion(rotation);

            return(msg);
        }
示例#18
0
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.ChangeObjectOwnership);
            msg.WriteUShort(objectId);
            msg.WriteByte(ownerId);
            msg.WriteVector3(linVelocity);
            msg.WriteVector3(angVelocity);
            return(msg);
        }
示例#19
0
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.GunFire);
            msg.WriteByte(handedness);
            msg.WriteVector3(firepointPos);
            msg.WriteQuaternion(firepointRotation);
            msg.WriteFloat(ammoDamage);
            msg.WriteFloat(projectileMass);
            msg.WriteFloat(exitVelocity);
            msg.WriteFloat(muzzleVelocity);
            return(msg);
        }
        public EnemyRigTransformMessage(P2PMessage msg)
        {
            poolChildIdx = msg.ReadByte();
            enemyType    = (EnemyType)msg.ReadByte();
            posMain      = msg.ReadVector3();
            posRoot      = msg.ReadVector3();
            posLHip      = msg.ReadCompressedVector3(posRoot);
            posRHip      = msg.ReadCompressedVector3(posRoot);

            posLKnee  = msg.ReadCompressedVector3(posRoot);
            posRKnee  = msg.ReadCompressedVector3(posRoot);
            posLAnkle = msg.ReadCompressedVector3(posRoot);
            posRAnkle = msg.ReadCompressedVector3(posRoot);

            posSpine1    = msg.ReadCompressedVector3(posRoot);
            posSpine2    = msg.ReadCompressedVector3(posRoot);
            posSpineTop  = msg.ReadCompressedVector3(posRoot);
            posLClavicle = msg.ReadCompressedVector3(posRoot);
            posRClavicle = msg.ReadCompressedVector3(posRoot);
            posNeck      = msg.ReadCompressedVector3(posRoot);
            posLShoulder = msg.ReadCompressedVector3(posRoot);
            posRShoulder = msg.ReadCompressedVector3(posRoot);
            posLElbow    = msg.ReadCompressedVector3(posRoot);
            posRElbow    = msg.ReadCompressedVector3(posRoot);
            posLWrist    = msg.ReadCompressedVector3(posRoot);
            posRWrist    = msg.ReadCompressedVector3(posRoot);

            rotMain      = msg.ReadSmallerCompressedQuaternion();
            rotRoot      = msg.ReadSmallerCompressedQuaternion();
            rotLHip      = msg.ReadSmallerCompressedQuaternion();
            rotRHip      = msg.ReadSmallerCompressedQuaternion();
            rotLKnee     = msg.ReadSmallerCompressedQuaternion();
            rotRKnee     = msg.ReadSmallerCompressedQuaternion();
            rotLAnkle    = msg.ReadSmallerCompressedQuaternion();
            rotRAnkle    = msg.ReadSmallerCompressedQuaternion();
            rotSpine1    = msg.ReadSmallerCompressedQuaternion();
            rotSpine2    = msg.ReadSmallerCompressedQuaternion();
            rotSpineTop  = msg.ReadSmallerCompressedQuaternion();
            rotLClavicle = msg.ReadSmallerCompressedQuaternion();
            rotRClavicle = msg.ReadSmallerCompressedQuaternion();
            rotNeck      = msg.ReadSmallerCompressedQuaternion();
            rotLShoulder = msg.ReadSmallerCompressedQuaternion();
            rotRShoulder = msg.ReadSmallerCompressedQuaternion();
            rotLElbow    = msg.ReadSmallerCompressedQuaternion();
            rotRElbow    = msg.ReadSmallerCompressedQuaternion();
            rotLWrist    = msg.ReadSmallerCompressedQuaternion();
            rotRWrist    = msg.ReadSmallerCompressedQuaternion();
        }
        public PlayerPositionMessage(P2PMessage msg)
        {
            headPos   = msg.ReadVector3();
            lHandPos  = msg.ReadVector3();
            rHandPos  = msg.ReadVector3();
            pelvisPos = msg.ReadVector3();
            lFootPos  = msg.ReadVector3();
            rFootPos  = msg.ReadVector3();

            headRot   = msg.ReadCompressedQuaternion();
            lHandRot  = msg.ReadCompressedQuaternion();
            rHandRot  = msg.ReadCompressedQuaternion();
            pelvisRot = msg.ReadCompressedQuaternion();
            lFootRot  = msg.ReadCompressedQuaternion();
            rFootRot  = msg.ReadCompressedQuaternion();
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            if (isForOtherPlayer)
            {
                msg.WriteByte((byte)MessageType.OtherHandGunChange);
                msg.WriteByte(playerId);
            }
            else
            {
                msg.WriteByte((byte)MessageType.HandGunChange);
            }

            msg.WriteByte(Convert.ToByte(destroy));
            msg.WriteByte((byte)type);
            return(msg);
        }
        public P2PMessage MakeMsg()
        {
            P2PMessage msg = new P2PMessage();

            msg.WriteByte((byte)MessageType.PlayerPosition);

            msg.WriteVector3(headPos);
            msg.WriteVector3(lHandPos);
            msg.WriteVector3(rHandPos);
            msg.WriteVector3(pelvisPos);
            msg.WriteVector3(lFootPos);
            msg.WriteVector3(rFootPos);

            msg.WriteCompressedQuaternion(headRot);
            msg.WriteCompressedQuaternion(lHandRot);
            msg.WriteCompressedQuaternion(rHandRot);
            msg.WriteCompressedQuaternion(pelvisRot);
            msg.WriteCompressedQuaternion(lFootRot);
            msg.WriteCompressedQuaternion(rFootRot);
            return(msg);
        }
示例#24
0
        public ITransportConnection ConnectTo(ulong id, P2PMessage initialMessage)
        {
            if (connections.ContainsKey(id))
            {
                if (connections[id].IsValid)
                {
                    throw new ArgumentException("Already connected to " + id.ToString());
                }
                else
                {
                    connections.Remove(id);
                }
            }

            SteamTransportConnection connection = new SteamTransportConnection(id, initialMessage);

            connections.Add(id, connection);
            SteamNetworking.OnP2PSessionRequest   = ClientOnP2PSessionRequest;
            SteamNetworking.OnP2PConnectionFailed = ClientOnP2PConnectionFailed;

            return(connection);
        }
示例#25
0
 internal SteamTransportConnection(ulong id, P2PMessage initialMessage)
 {
     ConnectedTo = id;
     SendMessage(initialMessage, MessageSendType.Reliable);
 }
 public ObjectSyncMessage(P2PMessage msg)
 {
     id       = msg.ReadUShort();
     position = msg.ReadVector3();
     rotation = msg.ReadCompressedQuaternion();
 }
 public GunFireMessage(P2PMessage msg)
 {
     fireOrigin    = msg.ReadVector3();
     fireDirection = msg.ReadVector3();
     bulletDamage  = msg.ReadFloat();
 }
 public IDRequestMessage(P2PMessage msg)
 {
     namePath = msg.ReadUnicodeString();
 }
 public IDAllocationMessage(P2PMessage msg)
 {
     namePath    = msg.ReadUnicodeString();
     allocatedId = msg.ReadUShort();
 }
 public SetPartyIdMessage(P2PMessage msg)
 {
     partyId = msg.ReadUnicodeString();
 }