public void CloseEditor(Asset asset) { var view = _openEditors[asset.Key]; _regionManager.Regions[RegionName.Content.ToString()].Remove(view); _openEditors.Remove(asset.Key); }
public override void MoveModelToView(ArchetypeData model) { base.MoveModelToView(model); var m = model as RetractableSpikeButtonWorldObjectArchetypeData; this.AlternateSprite = Sprites.Where(x => x.Key == m.AlernateSprite).FirstOrDefault(); }
public override void MoveModelToView(ArchetypeData model) { base.MoveModelToView(model); var m = model as BombWorldObjectArchetypeData; this.Timer = m.Timer; this.ActiveAnimation = Animations.Where(x => x.Key == m.ActiveAnimation).FirstOrDefault(); ; }
public override void MoveModelToView(ArchetypeData model) { base.MoveModelToView(model); var m = model as RetractableSpikeWorldObjectArchetypeData; this.SpikePosition = m.SpikePosition; this.SpikeUpSprite = Sprites.Where(x => x.Key == m.SpikeUpSprite).FirstOrDefault(); this.SpikeDownSprite = Sprites.Where(x => x.Key == m.SpikeDownSprite).FirstOrDefault(); }
public void OpenEditor(String editorViewName, Asset asset) { if (!_openEditors.ContainsKey(asset.Key)) { var view = this._viewFactory.GetView(editorViewName); var editor = ((IEditor)view.DataContext); editor.Asset = asset; _regionManager.Regions[RegionName.Content.ToString()].Add(view, asset.Key); _openEditors[asset.Key] = view; } _regionManager.Regions[RegionName.Content.ToString()].Activate(_openEditors[asset.Key]); }
public override void MoveModelToView(ArchetypeData model) { base.MoveModelToView(model); var m = model as RotatingArrowWorldObjectArchetypeData; this.UpSprite = Sprites.Where(x => x.Key == m.UpSprite).FirstOrDefault(); this.DownSprite = Sprites.Where(x => x.Key == m.DownSprite).FirstOrDefault(); this.LeftSprite = Sprites.Where(x => x.Key == m.LeftSprite).FirstOrDefault(); this.RightSprite = Sprites.Where(x => x.Key == m.RightSprite).FirstOrDefault(); }
public AssetCreatedEvent(Asset newAsset) { this.NewAsset = newAsset; }
public void OkExecute() { Asset a = new Asset(); a.PackageId = this.Package.Id; a.Type = EditorAssetTypes.FrameSet; a.Key = this.AssetName; a.Id = Guid.NewGuid(); this._packageRepository.Assets.Add(a); _packageRepository.SaveAssetData(a.Id, new FrameSetResource() { Key = this.AssetName }); this._packageRepository.Save(); if (Completed != null) this.Completed(this, new EventArgs()); this._eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Publish(new AssetCreatedEvent(a)); }
public RetractableSpikeWorldObjectArchetypeDataViewModel(IPackageRepository repository, BehaviorRegistry behaviorRegistry) : base(repository, behaviorRegistry) { this.SpikeUpSprite = this.Sprites.FirstOrDefault(); this.SpikeDownSprite = this.Sprites.FirstOrDefault(); }
public void OkExecute() { Asset a = new Asset(); a.PackageId = this.Package.Id; a.Type = EditorAssetTypes.Level; a.Key = this.AssetName; a.Id = Guid.NewGuid(); this._packageRepository.Assets.Add(a); _packageRepository.SaveAssetData(a.Id, new LevelResource() { Key = this.AssetName, Bombs= 0, DownArrows=0, LeftArrows=0, Name=String.Empty, RightArrows=0, UpArrows = 0 }); this._packageRepository.Save(); if (Completed != null) this.Completed(this, new EventArgs()); this._eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Publish(new AssetCreatedEvent(a)); }
public void OkExecute() { Asset a = new Asset(); a.PackageId = this.Package.Id; a.Type = EditorAssetTypes.Sprite; a.Key = this.AssetName; a.Id = Guid.NewGuid(); this._packageRepository.Assets.Add(a); _packageRepository.SaveAssetData(a.Id, new SpriteResource() { Key = this.AssetName, TextureKey = String.Empty, Width=25, Height=24 }); this._packageRepository.Save(); if (Completed != null) this.Completed(this, new EventArgs()); this._eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Publish(new AssetCreatedEvent(a)); }
public void OkExecute() { Asset a = new Asset(); a.PackageId = this.Package.Id; a.Type = EditorAssetTypes.TerrainTileDefinition; a.Key = this.AssetName; a.Id = Guid.NewGuid(); this._packageRepository.Assets.Add(a); _packageRepository.SaveAssetData(a.Id, new TerrainTileDefinitionResource() { Key = this.AssetName, SpriteKey = String.Empty, CollisionHullKey = String.Empty, CollisionData = String.Empty }); this._packageRepository.Save(); if (Completed != null) this.Completed(this, new EventArgs()); this._eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Publish(new AssetCreatedEvent(a)); }
public AssetNodeViewModel(Asset asset, PackageDatabaseTreeViewModel parent, CompositionContainer container) : base(asset, parent, container, asset.Type) { this.Name = asset.Key; this.Model = asset; }
public void Execute() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Xml files (*.xml)|*.xml"; var result = ofd.ShowDialog(); if (!result.Value) return; ResourceModel[] importedResources; using (var reader = XmlReader.Create(ofd.FileName)) { importedResources = IntermediateSerializer.Deserialize<ResourceModel[]>(reader, null); } var packageName = importedResources.First().Key.Split('.').First(); var existingPackage = _packageRepository.Packages.Where(x => x.Name == packageName).FirstOrDefault(); // delete old package if it exists. if (existingPackage != null) { foreach (var asset in _packageRepository.Assets.Where(x => x.PackageId == existingPackage.Id).ToArray()) { _packageRepository.Assets.Remove(asset); _packageRepository.DeleteAssetData(asset.Id); } _packageRepository.Packages.Remove(existingPackage); _packageRepository.Save(); this._eventAggregator.GetEvent<CompositePresentationEvent<PackageDeletedEvent>>().Publish(new PackageDeletedEvent(existingPackage.Id)); } Package p = new Package(); p.Name = packageName; p.Id = Guid.NewGuid(); this._packageRepository.Packages.Add(p); this._eventAggregator.GetEvent<CompositePresentationEvent<PackageCreatedEvent>>().Publish(new PackageCreatedEvent(p)); List<ResourceModel> packageResources = new List<ResourceModel>(); foreach (var resource in importedResources) { Asset a = new Asset(); a.PackageId = p.Id; if (resource is LevelResource) a.Type = "Editors.Level"; else if (resource is WorldResource) a.Type = "Editors.World"; else if (resource is ArchetypeResource) a.Type = "Editors.Archetype"; else if (resource is FrameSetResource) a.Type = "Editors.FrameSet"; else if (resource is SpriteResource) a.Type = "Editors.Sprite"; else if (resource is Storyboard) a.Type = "Editors.Storyboard"; else if (resource is TerrainTileDefinitionResource) a.Type = "Editors.TerrainTileDefinition"; else if (resource is Texture2DResource) a.Type = "Editors.Texture2D"; a.Key = resource.Key; a.Id = Guid.NewGuid(); this._packageRepository.Assets.Add(a); _packageRepository.SaveAssetData(a.Id, resource); this._eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Publish(new AssetCreatedEvent(a)); } _packageRepository.Save(); }