Ejemplo n.º 1
0
    void OnEnable()
    {
        // Get last played platform & Set us as the last played platform
        lastPlayedPlatform = JCloudData.GetString("Last Played Platform", Application.platform.ToString());
        JCloudData.SetString("Last Played Platform", Application.platform.ToString());

        // Get last played time & Set now as the last played time
        lastPlayedTime = JCloudData.GetString("Last Played Time", System.DateTime.Now.ToString());
        JCloudData.SetString("Last Played Time", System.DateTime.Now.ToString());

        // Get play count & Increment play count and save new value
        playCount = JCloudData.GetInt("Play Count");
        playCount++;
        JCloudData.SetInt("Play Count", playCount);

        // Finally save our dictionary
        JCloudData.Save();
    }
Ejemplo n.º 2
0
 public static int GetInt(string key)
 {
     // Get int, if key doesn't exist, will return 0
     return(JCloudData.GetInt(key, 0));
 }
Ejemplo n.º 3
0
 public static string GetString(string key)
 {
     // Get string, if key doesn't exist, will return ""
     return(JCloudData.GetString(key, ""));
 }
Ejemplo n.º 4
0
 public static float GetFloat(string key)
 {
     // Get float, if key doesn't exist, will return 0.0f
     return(JCloudData.GetFloat(key, 0.0f));
 }
Ejemplo n.º 5
0
    // Just an exhaustive list of all usable functions with simple text monitoring for returns
    void OnGUI()
    {
        float width  = Screen.width;
        float height = Screen.height / 19;

        if (GUI.Button(new Rect(0.0f, 0.0f, width * 0.5f, height), "Write All Bytes To Test File"))
        {
            StartCoroutine(FileWriteAllBytes());
        }

        if (GUI.Button(new Rect(0.0f, height, width * 0.5f, height), "Read All Bytes From Test File"))
        {
            StartCoroutine(FileReadAllBytes());
        }

        if (GUI.Button(new Rect(0.0f, height * 2, width * 0.5f, height), "Delete Test File"))
        {
            StartCoroutine(FileDelete());
        }

        if (GUI.Button(new Rect(0.0f, height * 3, width * 0.5f, height), "Get Test File Modification Date"))
        {
            StartCoroutine(FileModificationDate());
        }

        if (GUI.Button(new Rect(0.0f, height * 4, width * 0.5f, height), "Check Test File Exists"))
        {
            StartCoroutine(FileExists());
        }

        if (GUI.Button(new Rect(0.0f, height * 5, width * 0.5f, height), "Copy Test File"))
        {
            StartCoroutine(FileCopy());
        }

        if (GUI.Button(new Rect(0.0f, height * 6, width * 0.5f, height), "Write All Bytes To Test File (Conflict)"))
        {
            StartCoroutine(FileWriteAllBytesConflict());
        }

        if (GUI.Button(new Rect(0.0f, height * 7, width * 0.5f, height), "Check Test File Has Conflict Versions"))
        {
            StartCoroutine(FileHasConflictVersions());
        }

        if (GUI.Button(new Rect(0.0f, height * 8, width * 0.5f, height), "Fetch File Fetch All Versions"))
        {
            StartCoroutine(FileFetchAllVersions());
        }

        if (GUI.Button(new Rect(0.0f, height * 9, width * 0.5f, height), "Read Conflict Version Bytes From Test File"))
        {
            StartCoroutine(FileReadConflictVersionBytes());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 9, width * 0.5f, height), "Pick Conflict Version From Test File"))
        {
            StartCoroutine(FilePickConflictVersion());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 8, width * 0.5f, height), "Pick Current Version From Test File"))
        {
            StartCoroutine(FilePickCurrentVersion());
        }

        if (GUI.Button(new Rect(0.0f, height * 10, width * 0.5f, height), "Poll Cloud Document Availability"))
        {
            bool availability = JCloudDocument.PollCloudDocumentAvailability();
            documentResultString = "cloud document " + (availability ? "available" : "unavailable");
        }

        if (GUI.Button(new Rect(width * 0.5f, 0.0f, width * 0.5f, height), "Create Test Directory"))
        {
            StartCoroutine(DirectoryCreate());
        }

        if (GUI.Button(new Rect(width * 0.5f, height, width * 0.5f, height), "Check Test Directory Exists"))
        {
            StartCoroutine(DirectoryExists());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 2, width * 0.5f, height), "Delete Test Directory"))
        {
            StartCoroutine(DirectoryDelete());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 3, width * 0.5f, height), "Get Test Directory Modification Date"))
        {
            StartCoroutine(DirectoryModificationDate());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 4, width * 0.5f, height), "List Top Directory Files"))
        {
            StartCoroutine(DirectoryGetFiles());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 5, width * 0.5f, height), "List Top Directory Folders"))
        {
            StartCoroutine(DirectoryGetDirectories());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 6, width * 0.5f, height), "Copy Test Directory"))
        {
            StartCoroutine(DirectoryCopy());
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 7, width * 0.5f, height), "Register Cloud Document changes"))
        {
            documentResultString = "now watching cloud document changes";
            JCloudDocument.RegisterCloudDocumentExternalChanges(this);
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 10, width * 0.5f, height), "Clear Resultats"))
        {
            documentResultString = "";
        }

        GUI.Label(new Rect(0.0f, height * 11, width, height * 1.5f), "Document Result : " + documentResultString);

        if (GUI.Button(new Rect(0.0f, height * 11.5f, width * 0.5f, height), "Data Set \"TestKey\" Int"))
        {
            JCloudData.SetInt("TestKey", 15);
            dataResultString = "data set int return is void";
        }

        if (GUI.Button(new Rect(0.0f, height * 12.5f, width * 0.5f, height), "Data Get \"TestKey\" Int"))
        {
            int keyValue = JCloudData.GetInt("TestKey");
            dataResultString = "data get int return is : " + keyValue;
        }

        if (GUI.Button(new Rect(0.0f, height * 13.5f, width * 0.5f, height), "Data Set \"TestKey\" Float"))
        {
            JCloudData.SetFloat("TestKey", 13.37f);
            dataResultString = "data set float return is void";
        }

        if (GUI.Button(new Rect(0.0f, height * 14.5f, width * 0.5f, height), "Data Get \"TestKey\" Float"))
        {
            float keyValue = JCloudData.GetFloat("TestKey");
            dataResultString = "data get float return is : " + keyValue;
        }

        if (GUI.Button(new Rect(0.0f, height * 15.5f, width * 0.5f, height), "Register Cloud Data Changes"))
        {
            dataResultString = "now watching cloud data changes";
            JCloudData.RegisterCloudDataExternalChanges(this);
        }

        if (GUI.Button(new Rect(0.0f, height * 16.5f, width * 0.5f, height), "Poll Cloud Data Availability"))
        {
            bool availability = JCloudData.PollCloudDataAvailability();
            dataResultString = "cloud data " + (availability ? "available" : "unavailable");
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 11.5f, width * 0.5f, height), "Data Set \"TestKey\" String"))
        {
            JCloudData.SetString("TestKey", "this is a test string");
            dataResultString = "data set string return is void";
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 12.5f, width * 0.5f, height), "Data Get \"TestKey\" String"))
        {
            string keyValue = JCloudData.GetString("TestKey");
            dataResultString = "data get string return is : " + keyValue;
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 13.5f, width * 0.5f, height), "Data Has \"TestKey\" Key"))
        {
            bool exists = JCloudData.HasKey("TestKey");
            dataResultString = "data has TestKey key return is : " + (exists ? "yes" : "no");
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 14.5f, width * 0.5f, height), "Data Delete \"TestKey\" Key"))
        {
            JCloudData.DeleteKey("TestKey");
            dataResultString = "data delete TestKey key return is void";
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 15.5f, width * 0.5f, height), "Data Delete All Keys"))
        {
            JCloudData.DeleteAll();
            dataResultString = "data delete all keys return is void";
        }

        if (GUI.Button(new Rect(width * 0.5f, height * 16.5f, width * 0.5f, height), "Data Save"))
        {
            JCloudData.Save();
            dataResultString = "data save return is ok";
        }

        if (GUI.Button(new Rect(0.0f, height * 17.5f, width, height), "Clear Resultats"))
        {
            dataResultString = "";
        }

        GUI.Label(new Rect(0.0f, height * 18.5f, width, height * 1.5f), "Dict/Data Result : " + dataResultString);
    }