protected IEnumerator CoLoadDataFromServer <T>(string hID, string strPHPName, delDBRequest_Generic <T> OnFinishLoad, params StringPair[] arrParameter) { T pData = default(T); string strTableName = typeof(T).ToString(); if (p_Event_DB_OnRequest_Start != null) { p_Event_DB_OnRequest_Start(strTableName, arrParameter); } int iRequestCount = 0; WWW www; bool bSuccess = true; while (true) { bSuccess = true; www = GetWWW(hID, strPHPName, strTableName, arrParameter); yield return(www); //Debug.Log(strPHPName + " result : " + www.text); List <T> listOutData = new List <T>(); bSuccess = www.error == null; try { bSuccess = SCManagerParserJson.DoReadJsonArray <T>(www, ref listOutData); pData = listOutData[0]; } catch { bSuccess = false; } if (OnFinishLoad == null) { break; } else if (OnFinishLoad(bSuccess, ++iRequestCount, pData)) { break; } } if (bSuccess == false) { Debug.LogWarning("[DBParser Error] RequestCount : " + iRequestCount + " php : " + strPHPName + " TableName : " + strTableName + " Error : " + www.text); for (int i = 0; i < arrParameter.Length; i++) { Debug.LogWarning(string.Format("Key{0} : {1}, Value{2} : {3} ", i, arrParameter[i].strKey, i, arrParameter[i].strValue)); } } if (p_Event_DB_OnRequest_Finish != null) { p_Event_DB_OnRequest_Finish(strTableName, arrParameter); } yield break; }
public IEnumerator CoLoadDataFromServer_Json <ENUM_PHP_NAME, T>(string hID, ENUM_PHP_NAME ePHPName, delDBRequest_Generic <T> OnFinishLoad, params StringPair[] arrParameter) where ENUM_PHP_NAME : System.IFormattable, System.IConvertible, System.IComparable { yield return(CoLoadDataFromServer(hID, ePHPName.ToString(), OnFinishLoad, arrParameter)); }
/// <summary> /// DB에 Generic에 있는 필드 값을 덮어 씌운다. /// </summary> /// <typeparam name="StructDB"></typeparam> /// <param name="strFieldName">Generic에 있는 필드 명</param> /// <param name="strSetFieldValue">Generic에 있는 필드에 덮어씌울 값</param> /// <param name="OnResult">결과 함수</param> static public void DoNetworkDB_Update_Set <StructDB>(string strFieldName, object strSetFieldValue, delDBRequest_Generic <StructDB> OnResult = null) { CheckIsContainField <StructDB>(strFieldName); instance.StartCoroutine(p_pNetworkDB.CoLoadDataFromServer_Json(instance._strID, EPHPName.Update_Set_ID, OnResult, new StringPair(strFieldName, strSetFieldValue))); }
static public void DoNetworkDB_Insert_Get_InsertData <StructDB>(delDBRequest_Generic <StructDB> OnResult, StructDB pStructDB) where StructDB : IDB_Insert { instance.StartCoroutine(p_pNetworkDB.CoLoadDataFromServer_Json(instance._strID, EPHPName.Insert, OnResult, pStructDB.IDB_Insert_GetField())); }
static public void DoNetworkDB_GetOrInsert_Single <StructDB>(delDBRequest_Generic <StructDB> OnFinishLoad = null, params StringPair[] arrParams) { instance.StartCoroutine(p_pNetworkDB.CoLoadDataFromServer_Json(instance._strID, EPHPName.Get_OrInsert, OnFinishLoad, arrParams)); }