Esempio n. 1
0
        public GameAsset Load(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            GameAsset result = null;

            if (assets.TryGetValue(name, out result))
            {
                return(result);
            }
            else
            {
                foreach (AssetProvider item in providers)
                {
                    result = item.Load(name);
                    if (result != null)
                    {
                        return(result);
                    }
                }

                return(null);
            }
        }
Esempio n. 2
0
        public void Store(string name, GameAsset asset)
        {
            if (string.IsNullOrEmpty(name) || asset == null)
            {
                return;
            }

            assets[name] = asset;
        }
Esempio n. 3
0
        public void Write(GameAsset asset)
        {
            string name = Storage.FindName(asset);

            if (string.IsNullOrEmpty(name) == false)
            {
                this.WriteURI(name);
            }
            else
            {
                this.WriteURI(string.Empty);
            }
        }
Esempio n. 4
0
        public string FindName(GameAsset asset)
        {
            if (asset == null)
            {
                return(null);
            }

            foreach (var item in assets)
            {
                if (item.Value == asset)
                {
                    return(item.Key);
                }
            }

            return(null);
        }
Esempio n. 5
0
 public abstract GameAsset Read(AssetStreamReader reader, GameAsset existingInstance);