Пример #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);
        }
Пример #2
0
        private void Client_ReceiveAKgunUpdates(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            //GunReady = reader.ReadBoolean();
            //GUIreadyTimeRemaining = reader.ReadSingle();

            damaged = reader.ReadBoolean();
        }
Пример #3
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);
        }
        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);
        }
Пример #5
0
        private void Client_ReceiveAlternativeMode(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool value = reader.ReadBoolean();

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

            if (!reader.Complete())
            {
                return;
            }
            Value = value;
        }
Пример #7
0
        void Client_ReceiveOpenSettings(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool  value  = reader.ReadBoolean();
            float value2 = reader.ReadSingle();

            if (!reader.Complete())
            {
                return;
            }
            opened = value;
            openDoorOffsetCoefficient = value2;
        }
Пример #8
0
        void Client_ReceiveSoundPlayKick(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool alternative = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return;
            }
            MeleeWeaponType.MeleeWeaponMode typeMode = alternative ?
                                                       Type.AlternativeMode : Type.NormalMode;
            SoundPlay3D(typeMode.SoundKick, .5f, false);
        }
Пример #9
0
        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);
        }
        private 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");
            }
        }
Пример #11
0
        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);
        }
        bool ReceiveMessage_AddUserToClient(NetworkNode.ConnectedNode sender,
                                            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint   identifier   = reader.ReadVariableUInt32();
            string name         = reader.ReadString();
            bool   thisUserFlag = reader.ReadBoolean();

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

            AddUser(identifier, name, thisUserFlag);

            return(true);
        }
Пример #13
0
        void Client_ReceiveIntellect(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();
            bool shouldDeleteAfterDetach = reader.ReadBoolean();

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

            Intellect i = null;

            if (networkUIN != 0)
            {
                i = (Intellect)Entities.Instance.GetByNetworkUIN(networkUIN);
            }
            SetIntellect(i, shouldDeleteAfterDetach);
        }
Пример #14
0
Файл: Door.cs Проект: Eneth/GAO
 void Client_ReceiveOpened( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     bool value = reader.ReadBoolean();
     if( !reader.Complete() )
         return;
     opened = value;
 }
Пример #15
0
 private void Client_ReceiveAlternativeMode(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     bool value = reader.ReadBoolean();
     if (!reader.Complete())
         return;
     AlternativeMode = value;
 }
Пример #16
0
 void Client_ReceiveDieCall( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     MapObject prejudicial = Entities.Instance.GetByNetworkUIN( reader.ReadVariableUInt32() ) as MapObject;
     bool allowLatencyTime = reader.ReadBoolean();
     if( !reader.Complete() )
         return;
     Die( prejudicial, allowLatencyTime );
 }
Пример #17
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 );
        }
        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;
        }
Пример #19
0
        private void Client_ReceiveUpdateMasc(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            bool value = reader.ReadBoolean();
            if (!reader.Complete())
                return;
            mascOn = value;

            if (mascOn)
            {
                mascSpeed = Type.MaxForwardSpeed * 2;
                mascForce = Type.DriveForwardForce * 2;
            }
            else
            {
                mascSpeed = 0;
                mascForce = 0;
            }
        }
Пример #20
0
 private void Client_ReceiveUpdateMechBoster(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     bool value = reader.ReadBoolean();
     if (!reader.Complete())
         return;
     boosted = value;
 }
Пример #21
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);
        }
Пример #22
0
 void Client_ReceiveSoundPlayKick( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     bool alternative = reader.ReadBoolean();
     if( !reader.Complete() )
         return;
     MeleeWeaponType.MeleeWeaponMode typeMode = alternative ?
         Type.AlternativeMode : Type.NormalMode;
     SoundPlay3D( typeMode.SoundKick, .5f, false );
 }
        private bool ReceiveMessage_AddUserToClient(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint identifier = reader.ReadVariableUInt32();
            string name = reader.ReadString();
            bool thisUserFlag = reader.ReadBoolean();
            if (!reader.Complete())
                return false;

            AddUser(identifier, name, thisUserFlag);

            return true;
        }
Пример #24
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 );
        }
Пример #25
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" );
        }
Пример #26
0
		void Client_ReceivePropertiesToClient( RemoteEntityWorld sender, ReceiveDataReader reader )
		{
			Size = reader.ReadVec2();
			Position = reader.ReadVec3();
			Segments = reader.ReadVec2I();
			CustomMesh = reader.ReadString();
			RenderQueueGroup = (RenderQueueGroups)reader.ReadVariableUInt32();
			ReflectionLevel = (ReflectionLevels)reader.ReadVariableUInt32();
			PhysicsHeight = reader.ReadSingle();
			DeepColor = reader.ReadColorValue();
			ShallowColor = reader.ReadColorValue();
			ReflectionColor = reader.ReadColorValue();
			ReflectionTextureSize = (ReflectionTextureSizes)reader.ReadVariableUInt32();
			FixedPipelineMap = reader.ReadString();
			FixedPipelineMapTiling = reader.ReadSingle();
			FixedPipelineColor = reader.ReadColorValue();
			UseHDRTexture = reader.ReadBoolean();
			AllowFog = reader.ReadBoolean();
		}
Пример #27
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 );
        }
Пример #28
0
        void Client_ReceiveIntellect( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint networkUIN = reader.ReadVariableUInt32();
            bool shouldDeleteAfterDetach = reader.ReadBoolean();
            if( !reader.Complete() )
                return;

            Intellect i = null;
            if( networkUIN != 0 )
                i = (Intellect)Entities.Instance.GetByNetworkUIN( networkUIN );
            SetIntellect( i, shouldDeleteAfterDetach );
        }
Пример #29
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;
 }
Пример #30
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 );
        }
Пример #31
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 );
        }
Пример #32
0
        private void Client_ReceiveAKgunUpdates(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            //GunReady = reader.ReadBoolean();
            //GUIreadyTimeRemaining = reader.ReadSingle();

            damaged = reader.ReadBoolean();
        }