public void LoadRegions(Client.Game.Map.Map map)
 {
     regionsListBox.Items.Clear();
     foreach (var v in map.Regions)
     {
         regionsListBox.Items.Add(v);
     }
 }
        public void InitMap(Client.Game.Map.Map map)
        {
            Scene.Root.ClearChildren();
            if (sceneQuadtreeAutoSyncer != null)
            {
                sceneQuadtreeAutoSyncer.Disconnect();
            }

            Renderer.Settings.WaterLevel = map.Settings.WaterHeight;

            sceneQuadtree           = new Common.Quadtree <Entity>(10);
            sceneQuadtreeAutoSyncer = new SceneBVHAutoSyncer(Scene, sceneQuadtree);

            PlacementBoundings       = new Common.Quadtree <Entity>(10);
            placementBoundingsSyncer = new SceneBVHAutoSyncer(Scene, PlacementBoundings);
            placementBoundingsSyncer.GetLocalBounding =
                (e) => e is Client.Game.Map.GameEntity ? ((Client.Game.Map.GameEntity)e).EditorPlacementLocalBounding : null;
            placementBoundingsSyncer.GetWorldBounding =
                (e) => e is Client.Game.Map.GameEntity ? ((Client.Game.Map.GameEntity)e).EditorPlacementWorldBounding : null;
            placementBoundingsSyncer.RegisterLocalBoundingChangedEvent   = (e, eh) => { };
            placementBoundingsSyncer.UnregisterLocalBoundingChangedEvent = (e, eh) => { };

            Scene.Root.AddChild(map.Ground);
            Scene.Root.AddChild(map.StaticsRoot);
            Scene.Root.AddChild(map.DynamicsRoot);
            Scene.Root.AddChild(new Client.Game.Water(map));
            ((Graphics.LookatSphericalCamera)Scene.Camera).Lookat = map.MainCharacter.Translation;
            //cameraInputHandler.UpdateCamera();

            GroundProbe = new WorldViewProbe(this, Scene.Camera)
            {
                WorldProbe = new Client.Game.GroundProbe(map)
            };

            foreach (var v in Scene.AllEntities)
            {
                var ge = v as Client.Game.Map.GameEntity;
                if (ge != null)
                {
                    var   ray = new Ray(ge.Translation + Vector3.UnitZ * 1000, -Vector3.UnitZ);
                    float d;
                    if (GroundProbe.Intersect(ray, this, out d))
                    {
                        var p = ray.Position + ray.Direction * d;
                        ge.EditorHeight = (ge.Translation - p).Z;
                    }
                }
            }

            StartDefaultMode();
        }
Example #3
0
 void New(Client.Game.Map.MapSettings settings)
 {
     Text = "Leditor | Untitled";
     if (CurrentMap != null)
     {
         CurrentMap.Ground.SplatMap1.Resource9.Data.Dispose();
     }
     if (CurrentMap != null)
     {
         CurrentMap.Ground.SplatMap2.Resource9.Data.Dispose();
     }
     CurrentMap = Client.Game.Map.Map.New(settings, worldView.Device9);
     InitMap();
 }
Example #4
0
        void Open(String filename)
        {
            if (CurrentMap != null)
            {
                CurrentMap.Ground.SplatMap1.Resource9.Data.Dispose();
            }
            if (CurrentMap != null)
            {
                CurrentMap.Ground.SplatMap2.Resource9.Data.Dispose();
            }
            fileName = filename;
            Text     = "Leditor | " + System.IO.Path.GetFileNameWithoutExtension(filename);

            MapLoadingScreen mls = new MapLoadingScreen {
                Dock = DockStyle.Fill
            };
            Form f = new Form
            {
                Size            = mls.Size,
                TopMost         = false,
                FormBorderStyle = FormBorderStyle.FixedDialog,
                StartPosition   = FormStartPosition.CenterScreen,
                ControlBox      = false
            };

            f.Controls.Add(mls);
            f.Show();

            Client.Game.Map.Map map;
            var ls = Client.Game.Map.MapPersistence.Instance.GetLoadSteps(filename, Instance.worldView.Device9, out map);

            CurrentMap = map;
            foreach (var l in ls)
            {
                mls.AppendLoadingString(l.First);
                Application.DoEvents();
                l.Second();
            }

            mls.AppendLoadingString("Initializing map..");
            Application.DoEvents();
            InitMap();
            mls.AppendLoadingString("Done!");
            Application.DoEvents();
            f.Close();
            tipsLabel.Text = "Loading took " + ((int)mls.Time.TotalSeconds) + "s";
        }
        void Open(String filename)
        {
            if (CurrentMap != null)
                CurrentMap.Ground.SplatMap1.Resource9.Data.Dispose();
            if (CurrentMap != null)
                CurrentMap.Ground.SplatMap2.Resource9.Data.Dispose();
            fileName = filename;
            Text = "Leditor | " + System.IO.Path.GetFileNameWithoutExtension(filename);

            MapLoadingScreen mls = new MapLoadingScreen { Dock = DockStyle.Fill };
            Form f = new Form
            {
                Size = mls.Size,
                TopMost = false,
                FormBorderStyle = FormBorderStyle.FixedDialog,
                StartPosition = FormStartPosition.CenterScreen,
                ControlBox = false
            };
            f.Controls.Add(mls);
            f.Show();

            Client.Game.Map.Map map;
            var ls = Client.Game.Map.MapPersistence.Instance.GetLoadSteps(filename, Instance.worldView.Device9, out map);
            CurrentMap = map;
            foreach (var l in ls)
            {
                mls.AppendLoadingString(l.First);
                Application.DoEvents();
                l.Second();
            }

            mls.AppendLoadingString("Initializing map..");
            Application.DoEvents();
            InitMap();
            mls.AppendLoadingString("Done!");
            Application.DoEvents();
            f.Close();
            tipsLabel.Text = "Loading took " + ((int)mls.Time.TotalSeconds) + "s";
        }
 void New(Client.Game.Map.MapSettings settings)
 {
     Text = "Leditor | Untitled";
     if (CurrentMap != null)
         CurrentMap.Ground.SplatMap1.Resource9.Data.Dispose();
     if (CurrentMap != null)
         CurrentMap.Ground.SplatMap2.Resource9.Data.Dispose();
     CurrentMap = Client.Game.Map.Map.New(settings, worldView.Device9);
     InitMap();
 }