示例#1
0
    public void SetLastUserCollectionUpdateToJson(long uctCreatedUnix)
    {
        //if (debugOn) Debug.Log("LAST USER UPDATE TO JSON " + uctCreatedUnix);

        LastUpdateAuxiliar dateAux = new LastUpdateAuxiliar(uctCreatedUnix);

        CheckAndSave(CreateJsonStringFromObject(dateAux), lastCollectionUpdateFile);
    }
示例#2
0
    public long GetLastUserCollectionUpdateFromJsonLong()
    {
        long lastUpd = 0;

        if (SaveLoadDirectoryExist() && FileExist(lastCollectionUpdateFile))
        {
            string             json     = ReadStringFromJson(lastCollectionUpdateFile);
            LastUpdateAuxiliar dateAux2 = new LastUpdateAuxiliar();
            JsonUtility.FromJsonOverwrite(json, dateAux2);
            lastUpd = dateAux2.uctCreatedUnix;

            if (debugOn)
            {
                Debug.Log("LAST COLLECTION UPDATE LOADED FROM JSON");
            }
        }
        return(lastUpd);
    }
    public async Task <long> GetLastGameCardCollectionUpdateTimestamp()
    {
        if (DatosFirebaseRTHelper.Instance.isInit == false)
        {
            return(0);
        }
        DataSnapshot dtSnapshot = null;

        DatosFirebaseRTHelper.Instance.reference.Child(DatosFirebaseRTHelper.Instance.GameCardCollectionLastUpdateTable)
        .Child("uctCreatedUnix").KeepSynced(true);
        await DatosFirebaseRTHelper.Instance.reference.Child(DatosFirebaseRTHelper.Instance.GameCardCollectionLastUpdateTable).GetValueAsync().ContinueWith(task =>
        {
            if (task.IsFaulted)
            {
                //Debug.Log("NoChild");
                // Handle the error...
            }
            else if (task.IsCompleted)
            {
                dtSnapshot = task.Result;
            }
        });

        LastUpdateAuxiliar utcLastGCCDownload = new LastUpdateAuxiliar();

        if (dtSnapshot != null)
        {
            if (dtSnapshot.Exists)
            {
                utcLastGCCDownload = JsonUtility.FromJson <LastUpdateAuxiliar>(dtSnapshot.GetRawJsonValue());
                if (debugOn)
                {
                    Debug.Log("LAST GAME UPDATE " + utcLastGCCDownload.uctCreatedUnix);
                }
            }
        }

        return(utcLastGCCDownload.uctCreatedUnix);
    }