Exemplo n.º 1
0
        public override void Load(string path)
        {
            base.Load(path);

            string dir = System.IO.Path.GetDirectoryName(path);

            if (System.IO.File.Exists(dir + @"\landscape.xml"))
            {
                EditorLandscape temp = Serializer.Deserialize <EditorLandscape>(System.IO.Path.GetDirectoryName(path) + @"\landscape.xml");

                if (temp != null)
                {
                    CurrentLandscape = new EditorLandscape(Host.Game, temp.BlockSize, temp.Width, temp.Height, Host.Camera);

                    CurrentLandscape.Host = Host;

                    CurrentLandscape.FillMode = temp.FillMode;
                    CurrentLandscape.CullMode = temp.CullMode;
                    CurrentLandscape.Enabled  = temp.Enabled;
                    CurrentLandscape.Visible  = temp.Visible;

                    CurrentLandscape.AmbientLightColor     = temp.AmbientLightColor;
                    CurrentLandscape.AmbientLightIntensity = temp.AmbientLightIntensity;
                    CurrentLandscape.DiffuseLightColor     = temp.DiffuseLightColor;
                    CurrentLandscape.DiffuseLightDirection = temp.DiffuseLightDirection;
                    CurrentLandscape.DiffuseLightIntensity = temp.DiffuseLightIntensity;

                    CurrentLandscape.Position = temp.Position;
                    CurrentLandscape.Scale    = temp.Scale;

                    CurrentLandscape.Smoothness = temp.Smoothness;

                    CurrentLandscape.PaintMaskAssetName = temp.PaintMaskAssetName;

                    CurrentLandscape.Layer1Path = temp.Layer1Path;
                    CurrentLandscape.Layer2Path = temp.Layer2Path;
                    CurrentLandscape.Layer3Path = temp.Layer3Path;
                    CurrentLandscape.Layer4Path = temp.Layer4Path;

                    conBrushSettings.CurrentLandscape = CurrentLandscape;

                    if (!string.IsNullOrEmpty(temp.Layer1Path))
                    {
                        conBrushSettings.cbBrushTexture.Items.Add(temp.Layer1Path);
                        conBrushSettings.cbBrushTexture.SelectedIndex = 0;
                    }

                    if (!string.IsNullOrEmpty(temp.Layer2Path))
                    {
                        conBrushSettings.cbBrushTexture.Items.Add(temp.Layer2Path);
                    }

                    if (!string.IsNullOrEmpty(temp.Layer3Path))
                    {
                        conBrushSettings.cbBrushTexture.Items.Add(temp.Layer3Path);
                    }

                    if (!string.IsNullOrEmpty(temp.Layer4Path))
                    {
                        conBrushSettings.cbBrushTexture.Items.Add(temp.Layer4Path);
                    }

                    Host.SceneManager.CurrentScreen.AddVisualObject(CurrentLandscape);
                }
            }
        }
Exemplo n.º 2
0
 private void OnLandscapeAdded(EditorLandscape landscape)
 {
     CurrentLandscape = landscape;
     conBrushSettings.CurrentLandscape = landscape;
 }