示例#1
0
        public static LibraryX.TileBrushGroupX ToXProxy(TileBrushManager manager)
        {
            if (manager == null)
            {
                return(null);
            }

            return(new LibraryX.TileBrushGroupX()
            {
                StaticBrushes = TileBrushCollection <StaticTileBrush> .ToXProxy <LibraryX.StaticTileBrushX>(manager.StaticBrushes, StaticTileBrush.ToXProxy),
                DynamicBrushes = TileBrushCollection <DynamicTileBrush> .ToXProxy <LibraryX.DynamicTileBrushX>(manager.DynamicBrushes, DynamicTileBrush.ToXProxy),
            });
        }
示例#2
0
        public Library()
            : this(Guid.NewGuid(), "Default")
        {
            Extra = new List <XmlElement>();

            TexturePool = new TexturePool();

            ObjectPoolManager = new ObjectPoolManager(TexturePool);
            ObjectPoolManager.PoolModified += (s, e) => OnModified(EventArgs.Empty);

            TilePoolManager = new TilePoolManager(TexturePool);
            TilePoolManager.PoolModified += (s, e) => OnModified(EventArgs.Empty);

            TileBrushManager = new TileBrushManager();
            TileBrushManager.PoolModified += (s, e) => OnModified(EventArgs.Empty);
        }
示例#3
0
        private void Initialize(LibraryX proxy)
        {
            if (proxy.PropertyGroup != null)
            {
                Extra = new List <XmlElement>(proxy.PropertyGroup.Extra ?? new XmlElement[0]);
            }

            TexturePool = TexturePool.FromXmlProxy(proxy.TextureGroup) ?? new TexturePool();

            ObjectPoolManager = ObjectPoolManager.FromXmlProxy(proxy.ObjectGroup, TexturePool) ?? new ObjectPoolManager(TexturePool);
            ObjectPoolManager.PoolModified += (s, e) => OnModified(EventArgs.Empty);

            TilePoolManager = TilePoolManager.FromXmlProxy(proxy.TileGroup, TexturePool) ?? new TilePoolManager(TexturePool);
            TilePoolManager.PoolModified += (s, e) => OnModified(EventArgs.Empty);

            TileBrushManager = TileBrushManager.FromXProxy(proxy.TileBrushGroup, TilePoolManager, Project.DynamicBrushClassRegistry) ?? new TileBrushManager();
            TileBrushManager.PoolModified += (s, e) => OnModified(EventArgs.Empty);
        }
示例#4
0
        public static LibraryX ToXProxy(Library library)
        {
            if (library == null)
            {
                return(null);
            }

            return(new LibraryX()
            {
                TextureGroup = TexturePool.ToXmlProxyX(library.TexturePool),
                ObjectGroup = ObjectPoolManager.ToXmlProxyX(library.ObjectPoolManager),
                TileGroup = TilePoolManager.ToXmlProxyX(library.TilePoolManager),
                TileBrushGroup = TileBrushManager.ToXProxy(library.TileBrushManager),
                PropertyGroup = new LibraryX.PropertyGroupX()
                {
                    LibraryGuid = library.Uid,
                    LibraryName = library.Name,
                    Extra = (library.Extra != null && library.Extra.Count > 0) ? library.Extra.ToArray() : null,
                },
            });
        }