Ejemplo n.º 1
0
        private void Client_ReceiveIntellect(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint        networkUIN = reader.ReadVariableUInt32();
            bool        shouldDeleteAfterDetach = reader.ReadBoolean();
            FactionType ft = null;

            if (GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
            {
                string factionName = reader.ReadString();
                if (factionName != string.Empty)
                {
                    ft = (FactionType)EntityTypes.Instance.GetByName(factionName);
                }
            }
            if (!reader.Complete())
            {
                return;
            }

            Intellect i = null;

            if (networkUIN != 0)
            {
                i = (Intellect)Entities.Instance.GetByNetworkUIN(networkUIN);
                if (ft != null)
                {
                    i.Faction = ft;
                }
            }
            SetIntellect(i, shouldDeleteAfterDetach);
        }
        private bool ReceiveMessage_WorldDestroyToClient(NetworkNode.ConnectedNode sender,
                                                         MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            bool newMapWillBeLoaded = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return(false);
            }

            if (WorldDestroy != null)
            {
                WorldDestroy(this, newMapWillBeLoaded);
            }

            if (EntitySystemWorld.Instance != null && networkingInterface != null)
            {
                if (serverRemoteEntityWorld != null)
                {
                    networkingInterface.DisconnectRemoteEntityWorld(serverRemoteEntityWorld);
                }
            }
            serverRemoteEntityWorld = null;

            return(true);
        }
Ejemplo n.º 3
0
        private bool ReceiveMessage_TextToClient(NetworkNode.ConnectedNode sender,
                                                 MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint   fromUserIdentifier = reader.ReadVariableUInt32();
            string text = reader.ReadString();

            if (!reader.Complete())
            {
                return(false);
            }

            //get user by identifier
            UserManagementClientNetworkService.UserInfo fromUser = userManagementService.GetUser(
                fromUserIdentifier);
            if (fromUser == null)
            {
                //error. no such user.
                return(true);
            }

            if (ReceiveText != null)
            {
                ReceiveText(this, fromUser, text);
            }

            return(true);
        }
Ejemplo n.º 4
0
        private void Client_ReceiveHitCall(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3      hitPosition      = reader.ReadVec3();
            string    hitShapeBodyName = reader.ReadString();
            string    hitShapeName     = reader.ReadString();
            Vec3      hitNormal        = reader.ReadVec3();
            MapObject hitMapObject     = Entities.Instance.GetByNetworkUIN(reader.ReadVariableUInt32()) as MapObject;

            if (!reader.Complete())
            {
                return;
            }

            Position = hitPosition;
            Shape hitShape = null;

            if (PhysicsModel != null)
            {
                Body body = PhysicsModel.GetBody(hitShapeBodyName);
                if (body != null)
                {
                    hitShape = body.GetShape(hitShapeName);
                }
            }
            OnHit(hitShape, hitNormal, hitMapObject);
        }
Ejemplo n.º 5
0
        void Client_ReceiveAddUser(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint   identifier     = reader.ReadVariableUInt32();
            string name           = reader.ReadString();
            bool   bot            = reader.ReadBoolean();
            uint   userIdentifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            //check for already exists
            {
                Client_Player playerForCheck = Client_GetPlayer(identifier);

                if (playerForCheck != null)
                {
                    Log.Fatal("PlayerManager: Client_ReceiveAddUserToClient: Player " +
                              "with identifier \"{0}\" is already exists.", identifier);
                }
            }

            UserManagementClientNetworkService.UserInfo user = null;
            if (userIdentifier != 0)
            {
                user = GameNetworkClient.Instance.UserManagementService.GetUser(userIdentifier);
            }

            Client_Player player = new Client_Player(identifier, name, bot, user);

            client_players.Add(player);
        }
Ejemplo n.º 6
0
        private void Client_ReceiveAKgunUpdates(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            //GunReady = reader.ReadBoolean();
            //GUIreadyTimeRemaining = reader.ReadSingle();

            damaged = reader.ReadBoolean();
        }
        void Server_ReceiveChangeMainControlledUnit(RemoteEntityWorld sender,
                                                    ReceiveDataReader reader)
        {
            //not safe. client can send networkUIN of any unit from any place.

            //check to ensure that other players can not send messages to another player
            if (!Server_CheckRemoteEntityWorldAssociatedWithThisIntellect(sender))
            {
                return;
            }

            uint unitNetworkUIN = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            Unit unit = Entities.Instance.GetByNetworkUIN(unitNetworkUIN) as Unit;

            //unit is not exists
            if (unit == null)
            {
                return;
            }

            ServerOrSingle_ChangeMainControlledUnit(unit);
        }
        void Server_ReceiveControlKeyPress(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            //check to ensure that other players can not send messages to another player
            if (!Server_CheckRemoteEntityWorldAssociatedWithThisIntellect(sender))
            {
                return;
            }

            GameControlKeys controlKey = (GameControlKeys)reader.ReadVariableUInt32();
            float           strength   = reader.ReadSingle();

            if (!reader.Complete())
            {
                return;
            }

            //check for invalid value
            if (!Enum.IsDefined(typeof(GameControlKeys), (int)controlKey))
            {
                return;
            }
            if (strength <= 0)
            {
                return;
            }

            ControlKeyPress(controlKey, strength);
        }
Ejemplo n.º 9
0
 void Client_ReceiveUpdateBulletCount(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     normalMode.BulletCount              = reader.ReadVariableInt32();
     normalMode.BulletMagazineCount      = reader.ReadVariableInt32();
     alternativeMode.BulletCount         = reader.ReadVariableInt32();
     alternativeMode.BulletMagazineCount = reader.ReadVariableInt32();
 }
Ejemplo n.º 10
0
 void Client_ReceiveReloadEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     OnReload();
 }
 private void Client_ReceiveSoundPlayFire(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.NormalMode.SoundFire, .5f, true);
 }
Ejemplo n.º 12
0
 private void Client_ReceiveJumpEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     OnJump();
 }
Ejemplo n.º 13
0
 void Client_ReceiveSoundOpen(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.SoundOpen, .5f, false);
 }
Ejemplo n.º 14
0
 void Client_ReceiveSoundPlayTake(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.SoundTake, .5f, true);
 }
 private void Client_ReceiveSoundPlayBlowKick(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.SoundBlowKick, .5f, false);
 }
Ejemplo n.º 16
0
        void Client_ReceiveNoAmmoEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            if (!reader.Complete())
            {
                return;
            }

            SoundPlay3D(Type.SoundEmpty, .5f, true);
        }
Ejemplo n.º 17
0
 private void Server_ReceiveUseEnd(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     //not safe. every player from any place can to send this message.
     if (!reader.Complete())
     {
         return;
     }
     UseEnd();
 }
Ejemplo n.º 18
0
        void Client_ReceiveWeaponVerticalAngle(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Radian value = reader.ReadRangedSingle(-MathFunctions.PI / 2, MathFunctions.PI / 2, 8);

            if (!reader.Complete())
            {
                return;
            }
            client_weaponVerticalAngle = value;
        }
Ejemplo n.º 19
0
 private void Client_ReceiveNeedReloadEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     needReloadMessageReceived = true;
     readyTime = resetTime = normalMode.typeMode.BetweenFireTime + Type.ReloadTime;
     countdown = true;
 }
Ejemplo n.º 20
0
        void Client_ReceivePieceCount(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec2i value = reader.ReadVec2i();

            if (!reader.Complete())
            {
                return;
            }
            pieceCount = value;
        }
Ejemplo n.º 21
0
        void Client_ReceiveGameType(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            GameTypes value = (GameTypes)reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }
            gameType = value;
        }
Ejemplo n.º 22
0
        void Client_ReceiveTurnToPosition(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 turnToPosition = reader.ReadVec3();

            if (!reader.Complete())
            {
                return;
            }
            SetMomentaryTurnToPosition(turnToPosition);
        }
        void Client_ReceiveContusionTimeRemaining(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            float value = reader.ReadSingle();

            if (!reader.Complete())
            {
                return;
            }
            ContusionTimeRemaining = value;
        }
Ejemplo n.º 24
0
        private void Client_ReceiveAlternativeMode(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool value = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return;
            }
            AlternativeMode = value;
        }
Ejemplo n.º 25
0
        private void Client_ReceiveValue(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            float value = reader.ReadSingle();

            if (!reader.Complete())
            {
                return;
            }
            Value = value;
        }
Ejemplo n.º 26
0
        void Client_ReceiveValue(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool value = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return;
            }
            Value = value;
        }
        private void Client_ReceivePosition(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 value = reader.ReadVec3();

            if (!reader.Complete())
            {
                return;
            }
            Position = value;
        }
Ejemplo n.º 28
0
        void Client_ReceiveVelocityCoefficient(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            float value = reader.ReadSignedSingle(16);

            if (!reader.Complete())
            {
                return;
            }
            client_velocityCoefficient = value;
        }
        private void Client_ReceiveIndex(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec2I value = reader.ReadVec2I();

            if (!reader.Complete())
            {
                return;
            }
            index = value;
        }
Ejemplo n.º 30
0
        private void Client_ReceiveGroundRelativeVelocity(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 value = reader.ReadVec3();

            if (!reader.Complete())
            {
                return;
            }
            groundRelativeVelocity = value;
        }
        private bool ReceiveMessage_TransferMessageToServer(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string error)
        {
            string message = reader.ReadString();
            string data = reader.ReadString();
            if (!reader.Complete())
                return false;

            if (ReceiveMessage != null)
                ReceiveMessage(this, sender, message, data);

            return true;
        }
        bool ReceiveMessage_TransferMessageToClient( NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            string message = reader.ReadString();
            string data = reader.ReadString();
            if( !reader.Complete() )
                return false;

            if( ReceiveMessage != null )
                ReceiveMessage( this, message, data );

            return true;
        }
Ejemplo n.º 33
0
        bool ReceiveMessage_TextToClient( NetworkNode.ConnectedNode sender,
			MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
        {
            //get data from message
            uint fromUserIdentifier = reader.ReadVariableUInt32();
            string text = reader.ReadString();
            if( !reader.Complete() )
                return false;

            //get user by identifier
            UserManagementClientNetworkService.UserInfo fromUser = userManagementService.GetUser(
                fromUserIdentifier );
            if( fromUser == null )
            {
                //error. no such user.
                return true;
            }

            if( ReceiveText != null )
                ReceiveText( this, fromUser, text );

            return true;
        }
        private bool ReceiveMessage_TextToServer(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get source user
            UserManagementServerNetworkService.UserInfo fromUser = userManagementService.
                GetUser(sender);

            //get data of message
            string text = reader.ReadString();
            uint privateToUserIdentifier = reader.ReadVariableUInt32();
            if (!reader.Complete())
                return false;

            //send text to the clients
            if (privateToUserIdentifier != 0)
            {
                //send text to the specific user

                UserManagementServerNetworkService.UserInfo privateToUser = userManagementService.
                    GetUser(privateToUserIdentifier);
                if (privateToUser != null)
                {
                    SendText(fromUser, text, privateToUser);
                }
                else
                {
                    //no user anymore
                }
            }
            else
            {
                SendText(fromUser, text, null);
            }

            return true;
        }
Ejemplo n.º 35
0
Archivo: Gun.cs Proyecto: whztt07/SDK
 void Client_ReceiveUpdateBulletCount( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     normalMode.BulletCount = reader.ReadVariableInt32();
     normalMode.BulletMagazineCount = reader.ReadVariableInt32();
     alternativeMode.BulletCount = reader.ReadVariableInt32();
     alternativeMode.BulletMagazineCount = reader.ReadVariableInt32();
 }
Ejemplo n.º 36
0
 void Server_ReceiveUseStart( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     //not safe. every player from any place can to send this message.
     if( !reader.Complete() )
         return;
     UseStart();
 }
        bool ReceiveMessage_WorldCreateEndToClient( NetworkNode.ConnectedNode sender,
			MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
        {
            if( !reader.Complete() )
                return false;

            if( WorldCreateEnd != null )
                WorldCreateEnd( this );

            return true;
        }
Ejemplo n.º 38
0
 void Client_ReceiveSoundPlayCollision( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     SoundPlay3D( Type.SoundCollision, .5f, false );
 }
Ejemplo n.º 39
0
 void Client_ReceiveLife( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     float value = reader.ReadSingle();
     if( !reader.Complete() )
         return;
     Life = value;
 }
Ejemplo n.º 40
0
        void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            string s = reader.ReadString();
            if (!reader.Complete())
                return;

            text = s;
        }
        bool ReceiveMessage_EntitySystemInternal( NetworkNode.ConnectedNode sender,
			MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
        {
            if( serverRemoteEntityWorld == null )
            {
                Log.Fatal( "EntitySystemClientNetworkService: ReceiveMessage_EntitySystemInternal: " +
                    "serverRemoteEntityWorld == null." );
            }

            int entitySystemMessageIdentifier = messageType.Identifier - 1;

            return networkingInterface.ReceiveEntitySystemMessage( serverRemoteEntityWorld,
                entitySystemMessageIdentifier, reader, ref additionalErrorMessage );
        }
Ejemplo n.º 42
0
        void Server_ReceiveMoveTryToBegin( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            if( !reader.Complete() )
                return;

            //already moving
            if( serverOrSingle_Moving )
                return;

            //get network user by remote entity world
            EntitySystemServerNetworkService.ClientRemoteEntityWorld clientRemoteEntityWorld =
                (EntitySystemServerNetworkService.ClientRemoteEntityWorld)sender;
            UserManagementServerNetworkService.UserInfo user = clientRemoteEntityWorld.User;

            Server_MoveBegin( user );
        }
Ejemplo n.º 43
0
 void Client_ReceivePosition( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec3 value = reader.ReadVec3();
     if( !reader.Complete() )
         return;
     Position = value;
 }
Ejemplo n.º 44
0
        void Client_ReceiveMoveFinish( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            bool putToDestinationPlace = reader.ReadBoolean();
            bool completePuzzle = reader.ReadBoolean();
            if( !reader.Complete() )
                return;

            client_movingByUser = null;

            //play sounds
            if( putToDestinationPlace )
                ClientOrSingle_SoundPlay( "Maps\\JigsawPuzzleGame\\PutToDestinationPlace.ogg" );
            if( completePuzzle )
                ClientOrSingle_SoundPlay( "Maps\\JigsawPuzzleGame\\CompletePuzzle.ogg" );
        }
Ejemplo n.º 45
0
        void Client_ReceiveMoveBegin( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint userId = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            UserManagementClientNetworkService userService = GameNetworkClient.Instance.
                UserManagementService;

            client_movingByUser = userService.GetUser( userId );
        }
Ejemplo n.º 46
0
		void Client_ReceiveWheelsPositionToClient( RemoteEntityWorld sender, ReceiveDataReader reader )
		{
			networkingClient_wheelsRotationAngle = new Radian[ 4 ];
			networkingClient_wheelsSteer = new Radian[ 4 ];
			networkingClient_wheelsSuspensionJounce = new float[ 4 ];
			for( int n = 0; n < 4; n++ )
			{
				networkingClient_wheelsRotationAngle[ n ] = reader.ReadRadian();
				networkingClient_wheelsSteer[ n ] = reader.ReadRadian();
				networkingClient_wheelsSuspensionJounce[ n ] = reader.ReadSingle();
			}
			if( !reader.Complete() )
				return;
		}
Ejemplo n.º 47
0
 void Client_ReceiveSoundPlayTake( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     SoundPlay3D( Type.SoundTake, .5f, true );
 }
 void Client_ReceivePieceCount( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec2i value = reader.ReadVec2i();
     if( !reader.Complete() )
         return;
     pieceCount = value;
 }
Ejemplo n.º 49
0
        void Server_ReceiveMoveTryToFinish( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            if( !reader.Complete() )
                return;

            //get network user by remote entity world
            EntitySystemServerNetworkService.ClientRemoteEntityWorld clientRemoteEntityWorld =
                (EntitySystemServerNetworkService.ClientRemoteEntityWorld)sender;
            UserManagementServerNetworkService.UserInfo user = clientRemoteEntityWorld.User;

            if( user == server_movingByUser )
            {
                ServerOrSingle_MoveFinish();
            }
        }
Ejemplo n.º 50
0
        void Server_ReceiveMoveUpdatePosition( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            Vec2 newPosition = reader.ReadVec2();
            if( !reader.Complete() )
                return;

            //get network user by remote entity world
            EntitySystemServerNetworkService.ClientRemoteEntityWorld clientRemoteEntityWorld =
                (EntitySystemServerNetworkService.ClientRemoteEntityWorld)sender;
            UserManagementServerNetworkService.UserInfo user = clientRemoteEntityWorld.User;

            if( user == server_movingByUser )
            {
                ServerOrSingle_MoveUpdatePosition( newPosition );
            }
        }
Ejemplo n.º 51
0
 private void Client_ReceiveOpenSettings(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     bool value = reader.ReadBoolean();
     float value2 = reader.ReadSingle();
     if (!reader.Complete())
         return;
     opened = value;
     openDoorOffsetCoefficient = value2;
 }
Ejemplo n.º 52
0
Archivo: Gun.cs Proyecto: whztt07/SDK
        void Client_ReceiveCreateBulletEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            bool alternativeModeFlag = reader.ReadBoolean();

            if( !reader.Complete() )
                return;

            Mode mode = alternativeModeFlag ? alternativeMode : normalMode;

            SoundPlay3D( mode.typeMode.SoundFire, .5f, true );
            mode.typeMode.FireObjects.CreateObjectsOfOneRandomSelectedGroup( this );
        }
Ejemplo n.º 53
0
        void Client_ReceiveBodiesPositions( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            //clear snapshots cache if entity is not created
            if( !IsPostCreated )
                client_receivePositionsSnapshots.Clear();

            //check for invalid snapshot cache
            if( client_receivePositionsSnapshots.Count != 0 )
            {
                Client_ReceivePositionsSnapshot lastSnapshot = client_receivePositionsSnapshots[
                    client_receivePositionsSnapshots.Count - 1 ];
                if( lastSnapshot.bodies == null )
                {
                    //remove snapshot cache
                    client_receivePositionsSnapshots.Clear();
                }
            }

            int count = (int)reader.ReadVariableUInt32();

            Client_ReceivePositionsSnapshot snapshot = new Client_ReceivePositionsSnapshot();
            snapshot.networkTickNumber = EntitySystemWorld.Instance.NetworkTickCounter;

            snapshot.bodies = new Client_ReceivePositionsSnapshot.BodyItem[ count ];

            //receive bodies positions and rotations
            for( int n = 0; n < count; n++ )
            {
                Client_ReceivePositionsSnapshot.BodyItem bodyItem = new
                    Client_ReceivePositionsSnapshot.BodyItem();

                //read position
                if( reader.ReadBoolean() )
                {
                    bodyItem.position = reader.ReadVec3();
                }
                else
                {
                    //get position from previous snapshot
                    if( client_receivePositionsSnapshots.Count != 0 )
                    {
                        bodyItem.position = client_receivePositionsSnapshots[
                            client_receivePositionsSnapshots.Count - 1 ].bodies[ n ].position;
                    }
                }

                //read rotation
                if( reader.ReadBoolean() )
                {
                    bodyItem.rotation = reader.ReadQuat( 16 );
                }
                else
                {
                    //get rotation from previous snapshot
                    if( client_receivePositionsSnapshots.Count != 0 )
                    {
                        bodyItem.rotation = client_receivePositionsSnapshots[
                            client_receivePositionsSnapshots.Count - 1 ].bodies[ n ].rotation;
                    }
                }

                snapshot.bodies[ n ] = bodyItem;
            }

            if( !reader.Complete() )
                return;

            client_receivePositionsSnapshots.Add( snapshot );

            if( IsPostCreated )
                Client_UpdatePositionsBySnapshots( false );
        }
Ejemplo n.º 54
0
Archivo: Gun.cs Proyecto: whztt07/SDK
        void Client_ReceiveFireEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            bool alternative = reader.ReadBoolean();
            if( !reader.Complete() )
                return;

            GunType.GunMode typeMode = alternative ? Type.AlternativeMode : Type.NormalMode;
            OnFire( typeMode );
        }
Ejemplo n.º 55
0
        void Client_ReceivePositions( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            //clear snanshots cache if entity is not created
            if( !IsPostCreated )
                client_receivePositionsSnapshots.Clear();

            //check for invalid snapshot cache
            if( client_receivePositionsSnapshots.Count != 0 )
            {
                Client_ReceivePositionsSnapshot lastSnapshot = client_receivePositionsSnapshots[
                    client_receivePositionsSnapshots.Count - 1 ];
                if( lastSnapshot.bodies != null )
                {
                    //remove snapshot cache
                    client_receivePositionsSnapshots.Clear();
                }
            }

            Client_ReceivePositionsSnapshot snapshot = new Client_ReceivePositionsSnapshot();
            snapshot.networkTickNumber = EntitySystemWorld.Instance.NetworkTickCounter;

            //read position
            if( reader.ReadBoolean() )
            {
                snapshot.position = reader.ReadVec3();
            }
            else
            {
                //get position from previous snapshot
                if( client_receivePositionsSnapshots.Count != 0 )
                {
                    snapshot.position = client_receivePositionsSnapshots[
                        client_receivePositionsSnapshots.Count - 1 ].position;
                }
            }

            //read rotation
            if( reader.ReadBoolean() )
            {
                snapshot.rotation = reader.ReadQuat( 16 );
            }
            else
            {
                //get rotation from previous snapshot
                if( client_receivePositionsSnapshots.Count != 0 )
                {
                    snapshot.rotation = client_receivePositionsSnapshots[
                        client_receivePositionsSnapshots.Count - 1 ].rotation;
                }
            }

            //read scale
            if( reader.ReadBoolean() )
            {
                snapshot.scale = reader.ReadVec3();
            }
            else
            {
                //get position from previous snapshot
                if( client_receivePositionsSnapshots.Count != 0 )
                {
                    snapshot.scale = client_receivePositionsSnapshots[
                        client_receivePositionsSnapshots.Count - 1 ].scale;
                }
            }

            if( !reader.Complete() )
                return;

            client_receivePositionsSnapshots.Add( snapshot );

            Client_UpdatePositionsBySnapshots( false );
        }
Ejemplo n.º 56
0
Archivo: Gun.cs Proyecto: whztt07/SDK
        void Client_ReceiveNoAmmoEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            if( !reader.Complete() )
                return;

            SoundPlay3D( Type.SoundEmpty, .5f, true );
        }
        bool ReceiveMessage_EntitySystemInternal( NetworkNode.ConnectedNode sender,
			MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
        {
            RemoteEntityWorld fromRemoteEntityWorld = GetRemoteEntityWorld( sender );
            if( fromRemoteEntityWorld == null )
            {
                //no such world already. as example World has been deleted.
                return true;
            }

            int entitySystemMessageIdentifier = messageType.Identifier - 1;

            return networkingInterface.ReceiveEntitySystemMessage( fromRemoteEntityWorld,
                entitySystemMessageIdentifier, reader, ref additionalErrorMessage );
        }
Ejemplo n.º 58
0
Archivo: Gun.cs Proyecto: whztt07/SDK
 void Client_ReceiveReloadEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     OnReload();
 }
Ejemplo n.º 59
0
 void Client_ReceiveIndex( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec2I value = reader.ReadVec2I();
     if( !reader.Complete() )
         return;
     index = value;
 }
Ejemplo n.º 60
0
 void Client_ReceiveVelocityCoefficient( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     float value = reader.ReadSignedSingle( 16 );
     if( !reader.Complete() )
         return;
     client_velocityCoefficient = value;
 }