예제 #1
0
    public void MakeNewGestureFile()
    {
        //make a new xml file for this gesture
        Debug.Log($"Making new Gesture Lib file {libraryToLoad}");
        TextAsset templateFile = Resources.Load <TextAsset>($"{Const.GESTURE_FOLDER_NAME}/{Const.GESTURE_LIBRARY_TEMPLATE_NAME}");
        string    path         = Path.Combine(Path.Combine(Application.dataPath, $"Resources/{Const.GESTURE_V4_FOLDER_NAME}"), $"{libraryToLoad}.xml");

        FileTools.Write(path, templateFile.text);
        gl = new DrawDotLibrary(libraryToLoad, forceCopy);
    }
예제 #2
0
    // Load the library.
    public void Setup(string id)
    {
        libraryToLoad = id;
        string resPath = $"{DrawDotLibrary.GetResourcesPathV4(libraryToLoad)}.xml";

        if (!File.Exists(resPath))
        {
            TextAsset textAsset = Resources.Load <TextAsset>($"{Const.GESTURE_V4_FOLDER_NAME}/{libraryToLoad}");
            if (textAsset == null)
            {
                Debug.Log($"Gesture file doesn't exist, making new gesture file {libraryToLoad} (only work in editor)");
#if UNITY_EDITOR
                MakeNewGestureFile();
#endif
            }
        }
        else
        {
            gl = new DrawDotLibrary(libraryToLoad, forceCopy, true);
        }
    }