Exemplo n.º 1
0
 private static void LoadFileGame(string fileName, Game game)
 {
     try {
         Image[] lightmaps;
         var     map = MapProvider.GetMapFromFile(fileName, Directories.ModelDirs, out lightmaps);
         if (MapProvider.warnings != "")
         {
             MessageBox.Show(MapProvider.warnings, "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         Document doc = new Document(fileName, map, game);
         DocumentManager.AddAndSwitch(doc);
         if (lightmaps != null)
         {
             lock (doc.TextureCollection.Lightmaps) {
                 for (int i = 0; i < lightmaps.Length; i++)
                 {
                     doc.TextureCollection.Lightmaps[i]?.Dispose();
                     doc.TextureCollection.Lightmaps[i] = new Bitmap(lightmaps[i]);
                     lightmaps[i].Dispose();
                 }
                 doc.TextureCollection.LightmapTextureOutdated = true;
             }
             foreach (var viewport in ViewportManager.Viewports.Where(vp => vp is Viewport3D).Select(vp => vp as Viewport3D))
             {
                 viewport.Type = Viewport3D.ViewType.Lightmapped;
                 var listener = viewport.Listeners.Find(l => l is ViewportLabelListener) as ViewportLabelListener;
                 listener?.Rebuild();
             }
         }
     } catch (ProviderException e) {
         Error.Warning("The map file could not be opened:\n" + e.Message);
     }
 }
Exemplo n.º 2
0
 private static void LoadFileGame(string fileName, Game game)
 {
     try
     {
         var map = MapProvider.GetMapFromFile(fileName);
         DocumentManager.AddAndSwitch(new Document(fileName, map, game));
     }
     catch (ProviderException e)
     {
         Error.Warning("The map file could not be opened:\n" + e.Message);
     }
 }
Exemplo n.º 3
0
 public static void FileNew()
 {
     using (var gsd = new GameSelectionForm())
     {
         gsd.ShowDialog();
         if (gsd.SelectedGameID < 0)
         {
             return;
         }
         var game = SettingsManager.Games.Single(g => g.ID == gsd.SelectedGameID);
         DocumentManager.AddAndSwitch(new Document(null, new Map(), game));
     }
 }
Exemplo n.º 4
0
 public static void PostStart(Editor.Editor editor)
 {
     if (File.Exists(MapFile) && Game != null)
     {
         var map = MapProvider.GetMapFromFile(MapFile);
         DocumentManager.AddAndSwitch(new Document(MapFile, map, Game));
     }
     // Texture panel
     //using (var tlp = new TextureListPanel())
     //{
     //    tlp.ImageSize = 128;
     //    tlp.Dock = DockStyle.Fill;
     //    tlp.AddTextures(TexturePackage.GetLoadedItems());
     //    using (var dialog = new Form())
     //    {
     //        dialog.Controls.Add(tlp);
     //        dialog.ShowDialog();
     //    }
     //}
     // Texture tool
     editor.SelectTool(ToolManager.Tools[0]);
 }
Exemplo n.º 5
0
 public static void FileNew()
 {
     DocumentManager.AddAndSwitch(new Document(null, new Map(), SettingsManager.Game));
 }