public override void Refresh() { base.Refresh(); this.Steps.CollectionChanged -= this.Steps_CollectionChanged; this.Steps.Clear(); if (this.SavableValue.Steps.Any()) { var root = this.GetRootFolder(); var sprites = root.GetAssetsOfType <SpriteWrapper>(); foreach (var step in this.SavableValue.Steps) { SpriteWrapper spriteWrapper = null; if (step.Sprite != null) { spriteWrapper = sprites.FirstOrDefault(x => x.Sprite.Id == step.Sprite.Id); } var wrapper = new SpriteAnimationStepWrapper(this, step, spriteWrapper); this.Steps.Add(wrapper); wrapper.PropertyChanged += this.Step_PropertyChanged; } } this.Steps.CollectionChanged += this.Steps_CollectionChanged; }
public SpriteAnimationStepWrapper AddStep() { var step = new SpriteAnimationStepWrapper(this, new SpriteAnimationStep()); this.Steps.Add(step); return(step); }
private void AddStep() { SpriteAnimationStepWrapper newValue = null; var index = 0; var undoCommand = new UndoCommand(() => { if (newValue == null) { newValue = this.Asset.AddStep(); index = this.Asset.SavableValue.Steps.Count; } else { if (index > 0) { this.Asset.AddStep(newValue, index); } else { this.Asset.AddStep(newValue, this.Asset.SavableValue.Steps.Count); } } }, () => { this.Asset.RemoveStep(newValue); this.SelectedStep = this.Asset.Steps.FirstOrDefault(); }); this._undoService.Do(undoCommand); }
private void SelectSprite(SpriteAnimationStepWrapper step) { var asset = this._dialogService.ShowSelectAssetDialog(this._projectService.CurrentProject, AssetType.Image | AssetType.Sprite, AssetType.Sprite); if (asset is SpriteWrapper spriteWrapper) { step.Sprite = spriteWrapper; } }
private void MoveUp(SpriteAnimationStepWrapper step) { this.SelectedStep = null; var index = this.Asset.Steps.IndexOf(step); this.Asset.RemoveStep(step); this.Asset.AddStep(step, index - 1); this.SelectedStep = step; }
public void AddStep(SpriteAnimationStepWrapper step, int index) { if (index >= this.Steps.Count) { this.AddStep(step); } else { this.Steps.Insert(index, step); } }
public bool RemoveStep(SpriteAnimationStepWrapper step) { return(this.Steps.Remove(step)); }
public void AddStep(SpriteAnimationStepWrapper step) { this.Steps.Add(step); }
private void ClearSprite(SpriteAnimationStepWrapper step) { step.Sprite = null; }