コード例 #1
0
        /// <summary>
        /// This create method is left in the project because this class is loaded
        /// by the ContentManager. This create factory is a legitimate use of the
        /// self factory pattern.
        /// </summary>
        /// <param name="fntFile"></param>
        /// <returns></returns>
        public static CCBMFontConfiguration Create(string fntFile)
        {
            try
            {
                return(CCApplication.SharedApplication.Content.Load <CCBMFontConfiguration>(fntFile));
            }
            catch (InvalidCastException)
            {
                // Legacy check
                try
                {
                    return(new CCBMFontConfiguration(CCApplication.SharedApplication.Content.Load <cocos2d.CCBMFontConfiguration>(fntFile)));
                }
                catch (Exception ex)
                {
                    CCLog.Log("Failed to load FNT file at " + fntFile);
                    CCLog.Log(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                CCLog.Log("Failed to load FNT file at " + fntFile);
                CCLog.Log(ex.ToString());
            }
            var pRet = new CCBMFontConfiguration();

            if (pRet.InitWithFNTFile(fntFile))
            {
                return(pRet);
            }
            return(null);
        }
コード例 #2
0
 /// <summary>
 /// This create method is left in the project because this class is loaded
 /// by the ContentManager. This create factory is a legitimate use of the
 /// self factory pattern.
 /// </summary>
 /// <param name="fntFile"></param>
 /// <returns></returns>
 public static CCBMFontConfiguration Create(string fntFile)
 {
     try
     {
         return(CCContentManager.SharedContentManager.Load <CCBMFontConfiguration>(fntFile));
     }
     catch (ContentLoadException)
     {
         var pRet = new CCBMFontConfiguration();
         if (pRet.InitWithFNTFile(fntFile))
         {
             return(pRet);
         }
     }
     return(null);
 }
コード例 #3
0
 /// <summary>
 /// This create method is left in the project because this class is loaded
 /// by the ContentManager. This create factory is a legitimate use of the
 /// self factory pattern.
 /// </summary>
 /// <param name="fntFile"></param>
 /// <returns></returns>
 public static CCBMFontConfiguration Create(string fntFile)
 {
     try
     {
         return CCApplication.SharedApplication.Content.Load<CCBMFontConfiguration>(fntFile);
     }
     catch (ContentLoadException)
     {
         var pRet = new CCBMFontConfiguration();
         if (pRet.InitWithFNTFile(fntFile))
         {
             return pRet;
         }
     }
     return null;
 }
コード例 #4
0
 /// <summary>
 /// This create method is left in the project because this class is loaded
 /// by the ContentManager. This create factory is a legitimate use of the
 /// self factory pattern.
 /// </summary>
 /// <param name="fntFile"></param>
 /// <returns></returns>
 public static CCBMFontConfiguration Create(string fntFile)
 {
     try
     {
         return CCApplication.SharedApplication.Content.Load<CCBMFontConfiguration>(fntFile);
     }
     catch (InvalidCastException)
     {
         // Legacy check
         try
         {
             return new CCBMFontConfiguration(CCApplication.SharedApplication.Content.Load<cocos2d.CCBMFontConfiguration>(fntFile));
         }
         catch (Exception ex)
         {
             CCLog.Log("Failed to load FNT file at " + fntFile);
             CCLog.Log(ex.ToString());
         }
     }
     catch (Exception ex)
     {
         CCLog.Log("Failed to load FNT file at " + fntFile);
         CCLog.Log(ex.ToString());
     }
     var pRet = new CCBMFontConfiguration();
     if (pRet.InitWithFNTFile(fntFile))
     {
         return pRet;
     }
     return null;
 }