Beispiel #1
0
        private void commonShowScene(AnomalyController anomalyController)
        {
            if (!shown)
            {
                if (editInterface != null)
                {
                    editInterface.IconReferenceTag = AnomalyIcons.ProjectBuilt;
                }

                shown = true;

                anomalyController.ResourceController.addResources(resourceFileInterface.getFileObject());

                instanceGroup.showInstances(anomalyController.SimObjectController);

                foreach (ProjectReference reference in projectData.ProjectReferences.ReferencedProjectNames)
                {
                    Project subProject = solution.getProject(reference.ProjectName);
                    if (subProject != null)
                    {
                        subProject.commonShowScene(anomalyController);
                    }
                    else
                    {
                        Log.Error("Could not find referenced project {0} for project {1}. Project could not be shown.", reference.ProjectName, Name);
                    }
                }
            }
        }
Beispiel #2
0
 public ResourceController(AnomalyController controller)
 {
     this.controller    = controller;
     secondaryResources = controller.PluginManager.createScratchResourceManager();
     sceneResources     = controller.PluginManager.createLiveResourceManager("Scene");
     globalResources    = controller.PluginManager.createLiveResourceManager("Global");
 }
Beispiel #3
0
        public void unloadScene(AnomalyController anomalyController)
        {
            if (shown)
            {
                if (editInterface != null)
                {
                    editInterface.IconReferenceTag = AnomalyIcons.Project;
                }

                shown = false;
                instanceGroup.destroyInstances(anomalyController.SimObjectController);

                foreach (ProjectReference reference in projectData.ProjectReferences.ReferencedProjectNames)
                {
                    Project subProject = solution.getProject(reference.ProjectName);
                    if (subProject != null)
                    {
                        subProject.unloadScene(anomalyController);
                    }
                    else
                    {
                        Log.Error("Could not find referenced project {0} for project {1}. Project could not be destroyed.", reference.ProjectName, Name);
                    }
                }
            }
        }
Beispiel #4
0
 static void AnomalyController_FullyLoaded(AnomalyController controller)
 {
     if (publishMode != null)
     {
         publishMode.publishResources(controller);
     }
 }
Beispiel #5
0
 public SolutionController(Solution solution, SolutionWindow solutionWindow, AnomalyController controller, PropertiesEditor objectEditor)
 {
     this.controller     = controller;
     this.solution       = solution;
     this.solutionWindow = solutionWindow;
     solutionWindow.setSolution(solution);
     this.objectEditor = objectEditor;
     solutionWindow.InterfaceChosen += solutionWindow_InterfaceChosen;
     controller.SelectionController.OnSelectionChanged += SelectionController_OnSelectionChanged;
 }
Beispiel #6
0
        public void showScene(AnomalyController anomalyController)
        {
            if (!shown)
            {
                anomalyController.SceneController.setSceneDefinition(sceneFileInterface.getFileObject());

                SimObjectManagerDefinition simObjectManager = new SimObjectManagerDefinition();
                anomalyController.SimObjectController.setSceneManagerDefintion(simObjectManager);

                commonShowScene(anomalyController);
            }
        }
        public VirtualTextureSceneViewLink(AnomalyController controller)
        {
            this.controller = controller;
            controller.SceneController.OnSceneLoaded    += SceneController_OnSceneLoaded;
            controller.SceneController.OnSceneUnloading += SceneController_OnSceneUnloading;

            cameraLink = new CameraLink(controller.SceneViewController);

            CompressedTextureSupport textureFormat = OgreInterface.Instance.SelectedTextureFormat;

            virtualTextureManager = new VirtualTextureManager(UnifiedMaterialBuilder.GetNumCompressedTexturesNeeded(textureFormat), new IntSize2(4096, 4096), 128, 4096, textureFormat, 10, new IntSize2(256, 128), 100 * 1024 * 1024, UnifiedMaterialBuilder.AreTexturesPagedOnDisk(textureFormat));

            materialBuilder = new UnifiedMaterialBuilder(virtualTextureManager, OgreInterface.Instance.SelectedTextureFormat, controller.PluginManager.createLiveResourceManager("UnifiedShaders"));
            OgreInterface.Instance.MaterialParser.addMaterialBuilder(materialBuilder);
        }
Beispiel #8
0
        public void loadExternalFiles(AnomalyController controller)
        {
            if (File.Exists(solutionFile))
            {
                try
                {
                    using (var stream = File.Open(solutionFile, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
                    {
                        solutionData = saver.restoreObject <SolutionData>(stream);
                    }
                }
                catch (Exception e)
                {
                    Log.Error("Could not load solution data file {0} because:\n{1}", solutionFile, e.Message);
                }
            }
            if (solutionData == null)
            {
                solutionData = new SolutionData();
            }

            this.anomalyController = controller;
            String globalResourcesFile = Path.Combine(workingDirectory, "Resources.xml");

            if (!File.Exists(globalResourcesFile))
            {
                ResourceManager globalResources = controller.PluginManager.createScratchResourceManager();
                using (var stream = File.Open(globalResourcesFile, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite, System.IO.FileShare.None))
                {
                    saver.saveObject(globalResources, stream);
                }
            }

            resourceFileInterface = new ResourceManagerFileInterface("Global Resources", EngineIcons.Resource, globalResourcesFile, anomalyController.ResourceController.GlobalResources);
            anomalyController.ResourceController.GlobalResources.addResources(resourceFileInterface.getFileObject());
            anomalyController.ResourceController.GlobalResources.initializeResources();

            foreach (String projectFile in Directory.GetFiles(workingDirectory, "*.prj", SearchOption.AllDirectories))
            {
                Project project = new Project(this, Path.GetFileNameWithoutExtension(projectFile), Path.GetDirectoryName(projectFile));
                addProject(project);
                if (currentProject == null)
                {
                    currentProject = project;
                }
            }
        }
Beispiel #9
0
        public void publishResources(AnomalyController controller)
        {
            MessageBox.show("Publishing, please wait.", "Publishing", MessageBoxStyle.IconInfo);
            Task task = new Task(() =>
            {
                Log.Info("Publishing resources for solution {0} to {1}.", SolutionFile, Destination);
                if (Archive)
                {
                    Log.Info("An archive named {0} will be created.", ArchiveName);
                }
                if (Obfuscate)
                {
                    Log.Info("The archive will be obfuscated.");
                }

                PublishController publisher = new PublishController(controller.Solution);

                if (!String.IsNullOrEmpty(Profile))
                {
                    Log.Info("Using profile {0}", Profile);
                }

                publisher.scanResources(Profile);

                publisher.copyResources(Destination, ArchiveName, Archive, Obfuscate);

                Log.Info("Finished publishing resources to {0}.", Destination);

                ThreadManager.invoke(() =>
                {
                    controller.shutdown();
                });
            });

            task.Start();
        }
 public SimObjectController(AnomalyController controller)
 {
     this.controller = controller;
     controller.SceneController.OnSceneLoading   += SceneController_OnSceneLoading;
     controller.SceneController.OnSceneUnloading += SceneController_OnSceneUnloading;
 }
Beispiel #11
0
 public void initialize(AnomalyController controller)
 {
     this.controller = controller;
 }
Beispiel #12
0
 public AnomalyApp(String projectFileName, IAnomalyImplementation implementation)
 {
     this.projectFileName = projectFileName;
     anomalyController    = new AnomalyController(this, new Solution(projectFileName), implementation);
 }