Beispiel #1
0
    /// <summary>
    ///
    /// </summary>
    void Start()
    {
        Text text = GetComponent <Text>();

        if (text)
        {
            luaTextLocalizeFunc = LuaState.main.getFunction("resmng.LangText");
            if (luaTextLocalizeFunc != null)
            {
                text.text = (string)luaTextLocalizeFunc.call(langTextID);
            }

            FontOverride fo = fontOverride[(int)XRegion.GetLanguageType()];
            if (fo.size > 0)
            {
                text.fontSize = fo.size;

                XTextStyleComponent textStyle = GetComponent <XTextStyleComponent>();
                if (textStyle)
                {
                    textStyle.applySize = false;
                }
            }
        }
    }
Beispiel #2
0
        public IEnumerable <FontOverride> GetFontOverrides(MediaCenterLibraryCache cache, MediaCenterTheme theme)
        {
            XDocument           xdocument  = XDocument.Load(MediaCenterUtil.GetXml(cache["Microsoft.MediaCenter.Shell.dll"].GetResource("FONTS.MCML", (object)this.DocumentResourceType)));
            string              str1       = string.Format("global://{0}:", (object)"me");
            List <FontOverride> list       = new List <FontOverride>();
            XNamespace          xnamespace = (XNamespace)"http://schemas.microsoft.com/2006/mcml";

            foreach (XElement element in xdocument.Root.Elements(xnamespace + "Font"))
            {
                FontOverride fontOverride = new FontOverride();
                fontOverride.Name = MediaCenterUtil.AttributeValue(element, (XName)"Name");
                string font = MediaCenterUtil.AttributeValue(element, (XName)"FontName");
                if (font.StartsWith(str1))
                {
                    fontOverride.FontClass = font.Substring(str1.Length);
                }
                else
                {
                    fontOverride.FontFace = FontUtilities.GetFontFaceInfo(font, theme);
                }
                if (!string.IsNullOrEmpty(fontOverride.FontClass) || fontOverride.FontFace != null)
                {
                    int result;
                    if (int.TryParse(MediaCenterUtil.AttributeValue(element, (XName)"FontSize"), out result))
                    {
                        fontOverride.Size = result;
                    }
                    string str2 = MediaCenterUtil.AttributeValue(element, (XName)"FontStyle");
                    if (str2 != null)
                    {
                        fontOverride.IsBold   = str2.Contains("Bold");
                        fontOverride.IsItalic = str2.Contains("Italic");
                    }
                    list.Add(fontOverride);
                }
            }
            return((IEnumerable <FontOverride>)list);
        }