예제 #1
0
 public BitmapRef GetImage(TextureItem item)
 {
     lock (PlaceholderImage)
     {
         return(new BitmapRef(PlaceholderImage));
     }
 }
예제 #2
0
        public TextureCollection(List <TexturePackage> packages)
        {
            _packages = packages;
            _items    = new Dictionary <string, TextureItem>();
            foreach (var item in packages.SelectMany(x => x.Items))
            {
                var k = item.Key.ToLowerInvariant();
                if (!_items.ContainsKey(k))
                {
                    _items.Add(k, item.Value);
                }
            }
            _recentTextures = new List <TextureItem>();
            SelectedTexture = GetDefaultSelection();

            Bitmap bmp = new Bitmap(64, 64);

            for (int i = 0; i < 64; i++)
            {
                for (int j = 0; j < 64; j++)
                {
                    bmp.SetPixel(i, j, Color.White);
                }
            }
            LastTextureCollectionID++;
            LightmapTexture = TextureHelper.Create("__lightmap" + LastTextureCollectionID.ToString(), bmp, 64, 64, TextureFlags.None);
            bmp.Dispose();
        }
예제 #3
0
 public void AddTexture(TextureItem item)
 {
     if (Items.ContainsKey(item.Name.ToLowerInvariant()))
     {
         return;
     }
     Items.Add(item.Name.ToLowerInvariant(), item);
 }
예제 #4
0
 public static void LoadTextureItem(TextureItem item)
 {
     if (item == null || item.Package == null)
     {
         return;
     }
     item.Package.Provider.LoadTextures(new[] { item });
 }
예제 #5
0
 public BitmapRef GetImage(TextureItem item)
 {
     foreach (var ss in _streams)
     {
         if (ss.HasImage(item))
         {
             return(ss.GetImage(item));
         }
     }
     return(null);
 }
예제 #6
0
 public BitmapRef GetImage(TextureItem item)
 {
     foreach (var root in item.Package.PackageRoot.Split(';'))
     {
         var file = Path.Combine(root, item.Name);
         if (File.Exists(file))
         {
             return(Parse(file));
         }
     }
     return(null);
 }
예제 #7
0
 public BitmapRef GetImage(TextureItem item)
 {
     foreach (var root in item.Package.PackageRoot.Split(';'))
     {
         string name = item.Name.Substring("sprites/".Length);
         var    file = Path.Combine(root, name);
         if (File.Exists(file))
         {
             return(Parse(file));
         }
     }
     return(null);
 }
예제 #8
0
 public bool HasImage(TextureItem item)
 {
     return(item.Flags.HasFlag(TextureFlags.Missing));
 }
예제 #9
0
 public BitmapRef GetImage(TextureItem item) {
     foreach (var ss in _streams) {
         if (ss.HasImage(item)) return ss.GetImage(item);
     }
     return null;
 }
예제 #10
0
 public bool HasImage(TextureItem item) {
     return _streams.Any(x => x.HasImage(item));
 }
예제 #11
0
 public bool HasImage(TextureItem item)
 {
     return(_packages.Any(x => x.Items.ContainsValue(item)));
 }
예제 #12
0
 public BitmapRef GetImage(TextureItem item)
 {
     return(Parse(item.Name));
 }