Пример #1
0
    public int LoadGestureTemplates()
    {
        m_gestures = new List <GestureDetector>();
        using (StreamReader reader = new StreamReader(ConstDef.tmplRootPath + ConstDef.gestureTemplateListName))
        {
            while (reader.Peek() >= 0)
            {
                string filename = reader.ReadLine();
                if (filename[0] == '#')
                {
                    continue;
                }
                if (!filename.EndsWith(ConstDef.tmplFileSuffix))
                {
                    filename += ConstDef.tmplFileSuffix;
                }
                try
                {
                    GestureDetector gd = GestureDetector.LoadFromFile(filename);
                    gd.Init(m_postFeature);
                    gd.m_frameIntv = 0;
                    m_gestures.Add(gd);
                    Debug.Log("Gesture " + gd.m_name + " in " + filename + " loaded.");
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
        }

        return(GestureCount);
    }