コード例 #1
0
ファイル: HotFontImporter.cs プロジェクト: klenin/Citrus
        FontPair ParseFontCharPair()
        {
            string type = lexer.ParseQuotedString();

            if (type != "Hot::FontCharPair")
            {
                throw new Exception("Unknown type of object '{0}'", type);
            }
            var fontCharPair = new FontPair();

            lexer.ParseToken('{');
            while (lexer.PeekChar() != '}')
            {
                ParseFontCharPairProperty(ref fontCharPair, lexer.ParseWord());
            }
            lexer.ParseToken('}');
            return(fontCharPair);
        }
コード例 #2
0
        public void Load(Action callback)
        {
            int count = 0;

            for (int i = 0; i < fonts.Length; ++i)
            {
                FontPair pair = fonts[i];
                pair.asset.LoadAsset <GameObject>(o => {
                    UnityEngine.Object.DontDestroyOnLoad(o);
                    UIFont f                   = o.GetComponent <UIFont>();
                    pair.dst.replacement       = f;
                    fontsLoaded[pair.dst.name] = f;
                    count++;
                    if (count == fonts.Length)
                    {
                        callback.Call();
                    }
                });
            }
        }
コード例 #3
0
ファイル: HotFontImporter.cs プロジェクト: klenin/Citrus
        void ParseFontCharPairProperty(ref FontPair fontCharPair, string name)
        {
            switch (name)
            {
            case "CharCodeL":
                fontCharPair.A = (char)lexer.ParseInt();
                break;

            case "CharCodeR":
                fontCharPair.B = (char)lexer.ParseInt();
                break;

            case "Delta":
                fontCharPair.Kerning = lexer.ParseFloat();
                break;

            default:
                throw new Exception("Unknown property '{0}'. Parsing: {1}", name, fontCharPair);
            }
        }