コード例 #1
0
        public GameGlobal Get(string filename)
        {
            lock (Cache)
            {
                if (Cache.ContainsKey(filename))
                {
                    return(Cache[filename]);
                }

                //if we can't load this let it throw an exception...
                //probably sanity check this when we add user objects.
                var iff = new Iff(Path.Combine(Content.Get().BasePath, "objectdata\\globals\\" + filename + ".iff"));
                OTF otf = null;
                try
                {
                    otf = new OTF(Path.Combine(Content.Get().BasePath, "objectdata\\globals\\" + filename + ".otf"));
                }
                catch (IOException e)
                {
                    //if we can't load an otf, it probably doesn't exist.
                }
                var resource = new GameGlobalResource(iff, otf);

                var item = new GameGlobal
                {
                    Resource = resource
                };

                Cache.Add(filename, item);

                return(item);
            }
        }