private void ReceivedGameSettings(Message message)
        {
            if (GetGameSettingsCompleted != null)
            {
                var args = new GameSettingsEventArgs();

                // Read the message
                client.Reader.ReadNewMessage(message);
                client.Reader.ReadByte();
                args.ClientId = client.Reader.ReadUInt16();
                args.Seed = client.Reader.ReadInt32();

                // Assign the client id
                ClientId = args.ClientId;

                // World gravity (skip for now)
                client.Reader.ReadFloat();
                client.Reader.ReadFloat();
                client.Reader.ReadFloat();

                byte totalClients = client.Reader.ReadByte();

                for (int i = 0; i < totalClients; i++)
                {
                    ushort currentClientId = client.Reader.ReadUInt16();
                    UpdateServerEntities(currentClientId, EntityType.Client, true);
                }

                GetGameSettingsCompleted(this, args);
            }
        }
Example #2
0
        private void InitializeGameSettings(GameSettingsEventArgs e)
        {
            // Initialize the settings
            globalSettings.World.Seed = e.Seed;

            // Initialize the world
            gameClient.World = new WorldContext();
            gameClient.World.Initialize(Context, globalSettings.World.ViewDistance, globalSettings.World.Gravity, globalSettings.World.Seed);

            ExitScene();
        }
Example #3
0
        private void InitializeGameSettings(GameSettingsEventArgs e)
        {
            // Initialize the settings
            var settings = ServiceLocator.Get<GlobalSettings>();
            settings.World.Seed = e.Seed;

            // Initialize the world
            gameClient.World = new WorldContext();
            gameClient.World.Initialize(Context, settings.World.ViewDistance, settings.World.Gravity, settings.World.Seed);

            ExitScene();
        }
Example #4
0
 private void client_GetGameSettingsCompleted(object sender, GameSettingsEventArgs e)
 {
 }