public bool LoadScene() { if (!ContentLoader.Exists(UIName, ContentType.Scene)) { return(true); //ncrunch: no coverage } editorService.Viewport.DestroyRenderedEntities(); Messenger.Default.Send("ClearScene", "ClearScene"); var scene = new Scene(); Scene = new Scene(); try { scene = ContentLoader.Load <Scene>(UIName); foreach (var control in scene.Controls) { ActivateControl((Control)control); } } catch { foreach (var control in EntitiesRunner.Current.GetEntitiesOfType <Control>()) { ActivateControl((Control)control); } } UISceneGrid.DrawGrid(); uiSceneGrid.UpdateGridOutline(SceneResolution); controlTransformer = new ControlTransformer(editorService); return(false); }
private void LoadMusic() { if (!ContentLoader.Exists(GameMusic.GameMusic.ToString(), ContentType.Music)) { return; } music = ContentLoader.Load <Music>(GameMusic.GameMusic.ToString()); music.Loop = true; }
private static bool MaySaveRegardingExistingAndOverwrite(string name, ContentType type, bool overwrite) { if (ContentLoader.Exists(name, type)) { return(overwrite); } return(true); }
private void LoadLevel() { if (!ContentLoader.Exists(contentName, ContentType.Level)) { return; } DestroyEntitiesAndSetCommands(); Level = ContentLoader.Load <Level>(contentName); levelCommands.Level = Level; renderer.RemoveCommands(); Level.InitializeData(); renderer = new LevelDebugRenderer(Level); levelCommands.Renderer = renderer; levelObjectHandler.LevelSize = (int)(Level.Size.Width * Level.Size.Height); }
public bool TryLoadParticleEffect(string effectName) { if (!ContentLoader.Exists(effectName, ContentType.ParticleSystem)) { return(false); } var effectData = ContentLoader.Load <ParticleSystemData>(effectName); DestroyAllEmitters(); currentEffect = new ParticleSystem(effectData); currentEmitterInEffect = 0; RefreshAllEffectProperties(); RaisePropertyChanged("AvailableEmitterIndices"); CenterViewOnCurrentEffect(); return(true); }
public void ConnectToOnlineContentServiceWithoutExistingContent() { if (Directory.Exists("Content")) { Directory.Delete("Content", true); } bool ready = false; var connection = new OnlineServiceConnection(new MockSettings(), () => { throw new ConnectionTimedOut(); }); connection.ServerErrorHappened += error => { throw new ServerErrorReceived(error); }; connection.ContentReady += () => ready = true; ContentLoaderResolver.CreationParameterForContentLoader = connection; ContentLoader.Use <DeveloperOnlineContentLoader>(); Assert.IsTrue(ContentLoader.Exists("DeltaEngineLogo")); Assert.IsTrue(Directory.Exists("Content")); Assert.IsTrue(ready); ContentLoader.DisposeIfInitialized(); }
public void PlaceLevelObject(Vector2D position, string selectedLevelObject, int levelObjectIndex) { if (selectedLevelObject == "None") { return; } if (ContentLoader.Exists(selectedLevelObject, ContentType.Model)) { PlaceModel(position, selectedLevelObject, levelObjectIndex); } else if (ContentLoader.Exists(selectedLevelObject, ContentType.ParticleEmitter)) { PlaceParticle(position, selectedLevelObject, levelObjectIndex); } else if (ContentLoader.Exists(selectedLevelObject, ContentType.Material)) { PlaceMaterial(position, selectedLevelObject, levelObjectIndex); } }
public void SetBackgroundImage(string selectedImage) { if (backgroundImage != null) { backgroundImage.Dispose(); } if (selectedImage == "") { return; } if (ContentLoader.Exists(selectedImage, ContentType.Image)) { backgroundImage = new Sprite(new Material(ShaderFlags.Position2DColoredTextured, selectedImage), new Rectangle(GetBackgroundPosition(), GetBackgroundSize())) { RenderLayer = -10 } } ; }
public void LoadMaterial() { if (service.Viewport != null) { service.Viewport.DestroyRenderedEntities(); //ncrunch: no coverage } if (renderExample != null) { renderExample.IsActive = false; } if (ContentLoader.Exists(materialName, ContentType.Material)) { try { SetComboboxes(); CreateNewMaterial(); } catch //ncrunch: no coverage start { CreateDefaultMaterial(); } //ncrunch: no coverage end } UpdateIfCanSave(); }
public void TryCreatingAnimationFromFiles() { File.Delete(Path.Combine("Content", "ContentMetaData.xml")); ContentLoader.Use <DiskContentLoader>(); Assert.IsTrue(ContentLoader.Exists("ImageAnimation", ContentType.ImageAnimation)); }
public void ThrowExceptionIfSecondContentLoaderInstanceIsUsed() { ContentLoader.Exists("abc"); Assert.Throws <ContentLoader.ContentLoaderAlreadyExistsItIsOnlyAllowedToSetBeforeTheAppStarts>( ContentLoader.Use <FakeContentLoader>); }
public void CheckIfContentExists() { Assert.IsTrue(ContentLoader.Exists(TestXmlContentName)); Assert.IsTrue(ContentLoader.Exists(TestXmlContentName, ContentType.Xml)); Assert.IsFalse(ContentLoader.Exists(TestXmlContentName, ContentType.Camera)); }
private static void InvokeNonEditorContentLoaderToMakeSureCommandsInitializationHappened() { ContentLoader.Exists("DefaultCommands"); }