Пример #1
0
        public static int AquireFont(string filename)
        {
            foreach (int id in audios.Keys)
            {
                if (audios[id].Filename == filename)
                {
                    return(id);
                }
            }

            FontAsset asset = new FontAsset(filename);

            try
            {
                asset.Load();
                fonts.Add(asset.ID, asset);
                return((int)asset.ID);
            }
            catch (FileNotFoundException e)
            {
                Debug.LogError("Asset couldn't be loaded. Exception thrown:");
                Debug.LogError(e.Message);
                return(-1);
            }
        }
Пример #2
0
        public override Asset <Font> Clone()
        {
            FontAsset clone = (FontAsset)MemberwiseClone();

            clone.resource = new Font(resource);
            clone.family   = family;
            return(clone);
        }
Пример #3
0
 public static void Initialize()
 {
     textures       = new Dictionary <long, TextureAsset>();
     audios         = new Dictionary <long, AudioAsset>();
     fonts          = new Dictionary <long, FontAsset>();
     defaultTexture = new TextureAsset("Resources/default/default.png");
     defaultAudio   = new AudioAsset("Resources/default/default.ogg");
     defaultFont    = new FontAsset("Resources/default/default.ttf");
     try
     {
         defaultTexture.Load();
         defaultAudio.Load();
         defaultFont.Load();
         Debug.Log("Default resources loaded.");
     }
     catch (FileNotFoundException e)
     {
         Debug.LogError(e.Message);
         throw new NotInitializedException("The default resources couldn't be found. They are required to run the application. Assetmanager initialization cancelled.");
     }
 }