示例#1
0
 public UIFont this[UIFontType t]
 {
     get
     {
         if (mFontList.ContainsKey((byte)t))
         {
             return(mFontList[(byte)t]);
         }
         return(null);
     }
 }
示例#2
0
 public static bool RemoveFont(string fontName)
 {
     if (!FindManager())
     {
         return(false);
     }
     fontName = fontName.Replace("font/", "");
     if (System.Enum.IsDefined(typeof(UIFontType), fontName))
     {
         UIFontType ft = (UIFontType)System.Enum.Parse(typeof(UIFontType), fontName, true);
         if (Inst.mFontList.ContainsKey((byte)ft))
         {
             Inst.mFontList.Remove((byte)ft);
             return(true);
         }
     }
     return(false);
 }
示例#3
0
        public static UIFont LoadFont(UIFontType t)
        {
            if (!FindManager())
            {
                return(null);
            }
            UIFont font = Inst[t];

            if (null != font)
            {
                return(font);
            }
            GameObject obj = Resources.Load("Font/" + t.ToString(), typeof(GameObject)) as GameObject;

            font = obj.GetComponent <UIFont>();
            obj  = null;
            Resources.UnloadUnusedAssets();
            Inst.mFontList.Add((byte)t, font);
            return(font);
        }