Exemplo n.º 1
0
        private void LoadLanguageFont()
        {
            TableLanguage languageTable = TableManager.instance.GetData <TableLanguage>(m_language);
            string        fontPath      = GetFontPath(languageTable.fontName);
            string        fontBoldPath  = GetFontPath(languageTable.fontBoldName);

            if (m_fontDict.ContainsKey(languageTable.fontName) && m_fontDict.ContainsKey(languageTable.fontName))
            {
                m_languageFontLoaded = true;
                return;
            }
            ClearFont();
            List <string> pathList = new List <string>();

            pathList.Add(fontPath);
            if (fontPath != fontBoldPath)
            {
                pathList.Add(fontBoldPath);
            }
            LoadFontAsync(pathList, a =>
            {
                var it = a.GetEnumerator();
                while (it.MoveNext())
                {
                    m_fontDict.Add(it.Current.Key, it.Current.Value);
                }
                m_languageFontLoaded = true;
            });
        }
Exemplo n.º 2
0
        private void LoadLanguageFontSync()
        {
            TableLanguage languageTable = TableManager.instance.GetData <TableLanguage>(m_language);
            List <string> pathList      = new List <string>
            {
                GetFontPath(languageTable.fontName),
                GetFontPath(languageTable.fontBoldName),
            };

            LoadFontSync(pathList, a =>
            {
                var it = a.GetEnumerator();
                while (it.MoveNext())
                {
                    if (m_fontDict.ContainsKey(it.Current.Key))
                    {
                        m_fontDict[it.Current.Key] = it.Current.Value;
                    }
                    else
                    {
                        m_fontDict.Add(it.Current.Key, it.Current.Value);
                    }
                }
            });
        }
Exemplo n.º 3
0
        public Font GetFont(bool isBold)
        {
            TableLanguage languageTable = TableManager.instance.GetData <TableLanguage>(m_language);
            string        fontName      = isBold ? languageTable.fontBoldName : languageTable.fontName;

            if (m_fontDict.ContainsKey(fontName))
            {
                return(m_fontDict[fontName]);
            }
            fontName = isBold ? defaultFontBoldName : defaultFontName;
            if (m_defaultFontDict.ContainsKey(fontName))
            {
                return(m_defaultFontDict[fontName]);
            }
            return(s_systemDefaultFont);
        }