public Task DoGetData_Multi <T>(OnFinish_FirebaseDB_GetValue_Multi <T> OnFinishGetData) where T : IFirebaseData { string strRootNodeName = GetRootNodeName(typeof(T)); return(FirebaseDatabase.DefaultInstance.GetReference(strRootNodeName) .GetValueAsync().ContinueWith(task => { string strJsonResult = task.Result.GetRawJsonValue(); if (task.IsFaulted || string.IsNullOrEmpty(strJsonResult)) { OnFinishGetData?.Invoke(false, strJsonResult, new Dictionary <string, T>()); } else if (task.IsCompleted) { Dictionary <string, T> mapDBResult = null; bool bSuccessParsing = true; try { mapDBResult = JsonConvert.DeserializeObject <Dictionary <string, T> >(strJsonResult); foreach (var pData in mapDBResult) { pData.Value.IFirebaseData_strDBKey = pData.Key; } } catch (Exception e) { Debug.LogError("Error - " + nameof(DoGetData_Multi) + " strRootName : " + strRootNodeName + " Exception : " + e); bSuccessParsing = false; } OnFinishGetData?.Invoke(bSuccessParsing, strJsonResult, mapDBResult); } })); }
public IEnumerator DoGetData_Multi_Coroutine <T>(OnFinish_FirebaseDB_GetValue_Multi <T> OnFinishGetData) where T : IFirebaseData { var pTask = DoGetData_Multi(OnFinishGetData); while (pTask.IsCompleted == false) { yield return(null); } }