Beispiel #1
0
        private void ReloadSheet()
        {
            foreach (var sprite in _sheet.Sprites)
            {
                var info = FindByRTSprite(sprite);
                if (info != null)
                {
                    info.UpdateSprite();
                }
                else
                {
                    info        = new SpritePreview();
                    info.Sprite = sprite;
                    info.UpdateSprite();
                    info.OnSpritePropertyChanged += (a, e) =>
                    {
                        _hasChanges = true;
                    };
                    info.OnDeleteCalled += (a, e) =>
                    {
                        _hasChanges = true;
                        var sp = _activePreviews.First(b => b == info);
                        SpritesList.Children.Remove(sp);
                        _activePreviews.Remove(sp);
                        _sheet.Sprites.Remove(sp.Sprite);
                        ReloadSheet();
                    };
                    info.OnResizeCalled += (a, e) =>
                    {
                        _hasChanges = true;
                    };
                    _activePreviews.Add(info);
                    SpritesList.Children.Add(info);
                }
            }

            var removables = new List <SpritePreview>();

            foreach (var sprite in _activePreviews)
            {
                if (!_sheet.Sprites.Contains(sprite.Sprite))
                {
                    removables.Add(sprite);
                }
            }

            foreach (var rem in removables)
            {
                _activePreviews.Remove(rem);
                SpritesList.Children.Remove(rem);
            }
        }
Beispiel #2
0
        private void SelectSprite(SpritePreview prev = null)
        {
            foreach (var child in SpritesList.Children)
            {
                if (child as SpritePreview != null)
                {
                    (child as SpritePreview).Enabled = false;
                }
            }

            if (prev != null)
            {
                prev.Enabled = true;
            }
        }
Beispiel #3
0
 private void DoResize(SpritePreview prev)
 {
 }