Esempio n. 1
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";
        }