Exemplo n.º 1
0
    public static string SaveGestures(Gesture ng, string fileName, bool drySave = false)
    {
        string gestureFolder  = Path.Combine(Application.persistentDataPath, gestureFolderName);
        string txtFile        = string.Format("{0}.txt", fileName);
        string gestureFileLoc = Path.Combine(gestureFolder, txtFile);

        if (!Directory.Exists(gestureFolder))
        {
            Directory.CreateDirectory(gestureFolder);
            if (showDebugMsg)
            {
                Debug.Log("Directory not found, making one...");
            }
        }

        string gestureString = GestureJSON.ToJsonString(ng);

        if (drySave)
        {
            if (showDebugMsg)
            {
                Debug.Log("Gesture! (Stimulate Only)");
            }
        }
        else
        {
            File.WriteAllText(gestureFileLoc, gestureString);
            if (showDebugMsg)
            {
                Debug.Log("Saved gesture!");
            }
        }

        return(gestureFileLoc);
    }