UIFont.MatchSymbol C# (CSharp) Méthode

MatchSymbol() private méthode

Retrieve the symbol at the beginning of the specified sequence, if a match is found.
private MatchSymbol ( string text, int offset, int textLength ) : BMSymbol,
text string
offset int
textLength int
Résultat BMSymbol,
    BMSymbol MatchSymbol(string text, int offset, int textLength)
    {
        // No symbols present
        int count = mSymbols.Count;
        if (count == 0) return null;
        textLength -= offset;

        // Run through all symbols
        for (int i = 0; i < count; ++i)
        {
            BMSymbol sym = mSymbols[i];

            // If the symbol's length is longer, move on
            int symbolLength = sym.length;
            if (symbolLength == 0 || textLength < symbolLength) continue;

            bool match = true;

            // Match the characters
            for (int c = 0; c < symbolLength; ++c)
            {
                if (text[offset + c] != sym.sequence[c])
                {
                    match = false;
                    break;
                }
            }

            // Match found
            if (match && sym.Validate(atlas)) return sym;
        }
        return null;
    }

Usage Example

Exemple #1
0
 static int MatchSymbol(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         UIFont   obj  = (UIFont)ToLua.CheckObject <UIFont>(L, 1);
         string   arg0 = ToLua.CheckString(L, 2);
         int      arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         int      arg2 = (int)LuaDLL.luaL_checknumber(L, 4);
         BMSymbol o    = obj.MatchSymbol(arg0, arg1, arg2);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
All Usage Examples Of UIFont::MatchSymbol