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);
        }
        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);
        }
Пример #3
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);
        }
        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);
        }
Пример #5
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);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
0
 private void Client_ReceiveJumpEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     OnJump();
 }
Пример #9
0
 void Client_ReceiveReloadEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     OnReload();
 }
Пример #10
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);
 }
Пример #12
0
 void Client_ReceiveSoundOpen(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.SoundOpen, .5f, false);
 }
 private void Client_ReceiveSoundPlayFire(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.NormalMode.SoundFire, .5f, true);
 }
Пример #14
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();
 }
Пример #15
0
        void Client_ReceiveNoAmmoEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            if (!reader.Complete())
            {
                return;
            }

            SoundPlay3D(Type.SoundEmpty, .5f, true);
        }
Пример #16
0
        private void Client_ReceiveGroundRelativeVelocity(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 value = reader.ReadVec3();

            if (!reader.Complete())
            {
                return;
            }
            groundRelativeVelocity = value;
        }
Пример #17
0
        void Client_ReceivePieceCount(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec2i value = reader.ReadVec2i();

            if (!reader.Complete())
            {
                return;
            }
            pieceCount = value;
        }
Пример #18
0
        void Client_ReceiveGameType(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            GameTypes value = (GameTypes)reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }
            gameType = value;
        }
Пример #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;
 }
Пример #20
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;
        }
Пример #22
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;
        }
Пример #23
0
        private void Client_ReceiveValue(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            float value = reader.ReadSingle();

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

            if (!reader.Complete())
            {
                return;
            }
            Value = value;
        }
Пример #25
0
        private void Client_ReceiveAlternativeMode(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool value = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return;
            }
            AlternativeMode = value;
        }
Пример #26
0
        void Client_ReceiveWeaponVerticalAngle(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 value = reader.ReadVec3();

            if (!reader.Complete())
            {
                return;
            }
            groundRelativeVelocity = value;
        }
Пример #27
0
        private void Client_ReceiveSpawnId(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            int spawnId = reader.ReadVariableInt32();

            if (!reader.Complete())
            {
                return;
            }
            spawnid = (SpawnId)spawnId;// EntityTypes.Instance.GetByName(s);
        }
Пример #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;
        }
        private void Client_ReceivePosition(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 value = reader.ReadVec3();

            if (!reader.Complete())
            {
                return;
            }
            Position = 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;
        }
Пример #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;
        }
Пример #35
0
Файл: Gun.cs Проект: whztt07/SDK
 void Client_ReceiveReloadEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     OnReload();
 }
Пример #36
0
Файл: Gun.cs Проект: whztt07/SDK
        void Client_ReceiveNoAmmoEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            if( !reader.Complete() )
                return;

            SoundPlay3D( Type.SoundEmpty, .5f, true );
        }
Пример #37
0
 void Client_ReceiveVelocityCoefficient( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     float value = reader.ReadSignedSingle( 16 );
     if( !reader.Complete() )
         return;
     client_velocityCoefficient = value;
 }
Пример #38
0
 void Client_ReceiveSoundPlayCollision( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     SoundPlay3D( Type.SoundCollision, .5f, false );
 }
Пример #39
0
 void Client_ReceiveLife( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     float value = reader.ReadSingle();
     if( !reader.Complete() )
         return;
     Life = value;
 }
Пример #40
0
        void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            string s = reader.ReadString();
            if (!reader.Complete())
                return;

            text = s;
        }
        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;
        }
Пример #42
0
 void Client_ReceivePosition( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec3 value = reader.ReadVec3();
     if( !reader.Complete() )
         return;
     Position = value;
 }
Пример #43
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" );
        }
Пример #44
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 );
        }
Пример #45
0
 void Client_ReceiveIndex( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec2I value = reader.ReadVec2I();
     if( !reader.Complete() )
         return;
     index = value;
 }
Пример #46
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;
 }
Пример #48
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();
 }
        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;
        }
Пример #50
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 );
        }
Пример #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;
 }
        bool ReceiveMessage_WorldCreateBeginToClient( NetworkNode.ConnectedNode sender,
			MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
        {
            string worldTypeName = reader.ReadString();
            string mapVirtualFileName = reader.ReadString();
            if( !reader.Complete() )
                return false;

            bool remoteWorldAlreadyExists = EntitySystemWorld.Instance.RemoteEntityWorlds.Contains(
                serverRemoteEntityWorld );

            if( !remoteWorldAlreadyExists )
            {
                serverRemoteEntityWorld = new RemoteEntityWorld( "Server remote entity world" );
                networkingInterface.ConnectRemoteEntityWorld( serverRemoteEntityWorld );
            }

            WorldType worldType = EntityTypes.Instance.GetByName( worldTypeName ) as WorldType;
            if( worldType == null )
            {
                Log.Fatal( "EntitySystemClientNetworkService: " +
                    "ReceiveMessage_WorldCreateBeginToClient: World type \"{0}\" is not exists.",
                    worldTypeName );
            }

            if( WorldCreateBegin != null )
                WorldCreateBegin( this, worldType, mapVirtualFileName );

            return true;
        }
Пример #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 );
        }
Пример #54
0
Файл: Gun.cs Проект: 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 );
        }
Пример #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 );
        }
Пример #56
0
Файл: Gun.cs Проект: 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 );
        }
Пример #57
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();
            }
        }
Пример #58
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;
		}
Пример #59
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 );
            }
        }
Пример #60
0
		void Client_ReceiveGroundRelativeVelocity( RemoteEntityWorld sender, ReceiveDataReader reader )
		{
			Vec3 value = reader.ReadVec3();
			if( !reader.Complete() )
				return;
			groundRelativeVelocity = value;
		}