示例#1
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendControlledObjectToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendOpenSettingsToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
        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);
        }
        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);
        }
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendMainNotActiveUnitToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
示例#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();
 }
示例#10
0
        private void Client_ReceiveAKgunUpdates(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            //GunReady = reader.ReadBoolean();
            //GUIreadyTimeRemaining = reader.ReadSingle();

            damaged = reader.ReadBoolean();
        }
示例#11
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);
        }
示例#12
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendPositionToNewClient(remoteEntityWorld);
        }
示例#13
0
        protected override void Server_OnClientConnectedAfterPostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate(remoteEntityWorld);

            Server_SendIntellectToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
示例#14
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendUpdateBulletCountToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
示例#15
0
 void Client_ReceiveSoundPlayTake(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.SoundTake, .5f, true);
 }
示例#16
0
        protected override void Server_OnClientConnectedAfterPostCreate(RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate(remoteEntityWorld);

            IList <RemoteEntityWorld> worlds = new RemoteEntityWorld[] { remoteEntityWorld };

            Server_SendSupportedUnitsToClient(worlds);
        }
示例#17
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            //send PieceCount to the connected remote world
            Server_SendPieceCountToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
示例#18
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            //send gameType value to the connected world
            Server_SendGameTypeToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
 private void Client_ReceiveSoundPlayBlowKick(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     SoundPlay3D(Type.SoundBlowKick, .5f, false);
 }
示例#20
0
        void Server_SendPositionToNewClient(RemoteEntityWorld remoteEntityWorld)
        {
            SendDataWriter writer = BeginNetworkMessage(remoteEntityWorld, typeof(Item),
                                                        (ushort)NetworkMessages.PositionToClient);

            writer.Write(Position);
            EndNetworkMessage();
        }
示例#21
0
        protected override void Server_OnClientConnectedAfterPostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate(remoteEntityWorld);

            RemoteEntityWorld[] worlds = new RemoteEntityWorld[] { remoteEntityWorld };
            Server_SendTracksSpeedToClients(worlds);
        }
示例#22
0
        protected override void Server_OnClientConnectedAfterPostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate(remoteEntityWorld);

            Server_SendTurnToPositionToClients(new RemoteEntityWorld[] { remoteEntityWorld },
                                               server_sentTurnToPosition);
        }
示例#23
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendVelocityCoefficientToClients(new RemoteEntityWorld[] { remoteEntityWorld },
                                                    server_sentVelocityCoefficient);
        }
示例#24
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);
 }
示例#26
0
 void Client_ReceiveReloadEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     OnReload();
 }
示例#27
0
 private void Client_ReceiveJumpEvent(RemoteEntityWorld sender, ReceiveDataReader reader)
 {
     if (!reader.Complete())
     {
         return;
     }
     OnJump();
 }
        public void Server_SendSetInstanceToClient(RemoteEntityWorld remoteEntityWorld)
        {
            SendDataWriter writer = BeginNetworkMessage(remoteEntityWorld,
                                                        typeof(PlayerIntellect), (ushort)NetworkMessages.SetInstanceToClient);

            writer.WriteVariableUInt32(NetworkUIN);
            EndNetworkMessage();
        }
示例#29
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();
 }
示例#30
0
        protected override void Server_OnClientConnectedAfterPostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate(remoteEntityWorld);

            IList <RemoteEntityWorld> worlds = new RemoteEntityWorld[] { remoteEntityWorld };

            Server_SendGroundRelativeVelocityToClients(worlds, server_sentGroundRelativeVelocity);
        }
示例#31
0
        protected override void Server_OnClientConnectedAfterPostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate( remoteEntityWorld );

            if( Life != Type.LifeMax )
                Server_SendLifeToClients( new RemoteEntityWorld[] { remoteEntityWorld } );
        }
示例#32
0
        void Server_SendBodiesPositionsToNewClient( RemoteEntityWorld remoteEntityWorld )
        {
            SendDataWriter writer = BeginNetworkMessage( remoteEntityWorld, typeof( Dynamic ),
                (ushort)NetworkMessages.BodiesPositionsToClient );

            //write body count
            writer.WriteVariableUInt32( (uint)PhysicsModel.Bodies.Length );

            //write bodies positions and rotations
            foreach( Body body in PhysicsModel.Bodies )
            {
                writer.Write( true );
                writer.Write( body.Position );
                writer.Write( true );
                writer.Write( body.Rotation, 16 );
            }

            EndNetworkMessage();
        }
示例#33
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 );
        }
示例#34
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 );
        }
        void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            string s = reader.ReadString();
            if (!reader.Complete())
                return;

            text = s;
        }
示例#36
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);

            Server_SendOpenSettingsToClients(new RemoteEntityWorld[] { remoteEntityWorld });
        }
示例#37
0
 void Client_ReceivePosition( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec3 value = reader.ReadVec3();
     if( !reader.Complete() )
         return;
     Position = value;
 }
示例#38
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" );
        }
示例#39
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 );
        }
示例#40
0
 void Client_ReceiveIndex( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Vec2I value = reader.ReadVec2I();
     if( !reader.Complete() )
         return;
     index = value;
 }
示例#41
0
        protected override void Server_OnClientConnectedBeforePostCreate(
			RemoteEntityWorld remoteEntityWorld )
        {
            base.Server_OnClientConnectedBeforePostCreate( remoteEntityWorld );

            Server_SendPositionToNewClient( remoteEntityWorld );
        }
示例#42
0
        ///////////////////////////////////////////
        // Server side
        ///////////////////////////////////////////
        protected override void Server_OnClientConnectedBeforePostCreate(
			RemoteEntityWorld remoteEntityWorld )
        {
            base.Server_OnClientConnectedBeforePostCreate( remoteEntityWorld );

            RemoteEntityWorld[] array = new RemoteEntityWorld[] { remoteEntityWorld };
            //send Index to the connected remote world
            Server_SendIndexToClients( array );
            //send Position to the connected remote world
            Server_SendPositionToClients( array );
        }
示例#43
0
 void Server_SendPositionToNewClient( RemoteEntityWorld remoteEntityWorld )
 {
     SendDataWriter writer = BeginNetworkMessage( remoteEntityWorld, typeof( Item ),
         (ushort)NetworkMessages.PositionToClient );
     writer.Write( Position );
     EndNetworkMessage();
 }
示例#44
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 );
        }
示例#45
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;
 }
示例#46
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();
            }
        }
        protected override void Server_OnClientConnectedAfterPostCreate(RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedAfterPostCreate(remoteEntityWorld);

            IList<RemoteEntityWorld> worlds = new RemoteEntityWorld[] { remoteEntityWorld };

            if (!string.IsNullOrEmpty(text))
                Server_SendTextToClients(worlds);
        }
示例#48
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 );
            }
        }
示例#49
0
 void Client_ReceiveLife( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     float value = reader.ReadSingle();
     if( !reader.Complete() )
         return;
     Life = value;
 }
示例#50
0
文件: Gun.cs 项目: whztt07/SDK
        protected override void Server_OnClientConnectedBeforePostCreate(
			RemoteEntityWorld remoteEntityWorld )
        {
            base.Server_OnClientConnectedBeforePostCreate( remoteEntityWorld );

            Server_SendUpdateBulletCountToClients( new RemoteEntityWorld[] { remoteEntityWorld } );
        }
示例#51
0
 void Client_ReceiveSoundPlayCollision( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     SoundPlay3D( Type.SoundCollision, .5f, false );
 }
示例#52
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 );
        }
示例#53
0
        void Server_SendPositionsToNewClient( RemoteEntityWorld remoteEntityWorld )
        {
            SendDataWriter writer = BeginNetworkMessage( remoteEntityWorld, typeof( Dynamic ),
                (ushort)NetworkMessages.PositionsToClient );

            writer.Write( true );
            writer.Write( Position );
            writer.Write( true );
            writer.Write( Rotation, 16 );
            writer.Write( true );
            writer.Write( Scale );

            EndNetworkMessage();
        }
示例#54
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 );
        }
示例#55
0
        protected override void Server_OnClientConnectedBeforePostCreate(
            RemoteEntityWorld remoteEntityWorld)
        {
            base.Server_OnClientConnectedBeforePostCreate( remoteEntityWorld );

            //send entity position, rotation and scale
            if( Server_EnableSynchronizationPositionsToClients )
            {
                if( AttachedMapObjectParent == null )//no update for attached MapObjects
                {
                    if( PhysicsModel != null )
                        Server_SendBodiesPositionsToNewClient( remoteEntityWorld );
                    else
                        Server_SendPositionsToNewClient( remoteEntityWorld );
                }
            }
        }
示例#56
0
文件: Gun.cs 项目: whztt07/SDK
        void Client_ReceiveNoAmmoEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            if( !reader.Complete() )
                return;

            SoundPlay3D( Type.SoundEmpty, .5f, true );
        }
示例#57
0
文件: Gun.cs 项目: whztt07/SDK
 void Client_ReceiveReloadEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     OnReload();
 }
示例#58
0
文件: Gun.cs 项目: 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();
 }
示例#59
0
        protected override void Server_OnClientDisconnected( RemoteEntityWorld remoteEntityWorld )
        {
            base.Server_OnClientDisconnected( remoteEntityWorld );

            //finish moving when user disconnected
            if( serverOrSingle_Moving )
            {
                EntitySystemServerNetworkService.ClientRemoteEntityWorld clientRemoteEntityWorld =
                    (EntitySystemServerNetworkService.ClientRemoteEntityWorld)remoteEntityWorld;
                UserManagementServerNetworkService.UserInfo user = clientRemoteEntityWorld.User;

                if( user == server_movingByUser )
                {
                    ServerOrSingle_MoveFinish();
                }
            }
        }
示例#60
0
 void Client_ReceiveSoundPlayTake( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     if( !reader.Complete() )
         return;
     SoundPlay3D( Type.SoundTake, .5f, true );
 }