IEnumerator loadLevel() { do { yield return(new WaitForSeconds(0.5f)); mainPath = DownloadOBBController.GetMainOBBPath(expPath); }while(mainPath == null); NGUIDebug.Log(" load level find path "+ mainPath); lblDesp.gameObject.SetActive(true); slider.gameObject.SetActive(true); slider.value = 0; BtnDownLoad.gameObject.SetActive(false); if (downloadStarted == false) { downloadStarted = true; uri = "file://" + mainPath; www = WWW.LoadFromCacheOrDownload(uri, 0); NGUIDebug.Log(" load level in { } " + www.error); yield return(www); if (www.error == null) { Application.LoadLevel(0); Core.Data.usrManager.isDownOBB = 1; } } }
void Start() { #if Google && UNITY_ANDROID && !UNITY_EDITOR if (!DownloadOBBController.RunningOnAndroid() || Core.Data.usrManager.isDownOBB == 1) { Destroy(gameObject); return; } else { gameObject.SetActive(true); } expPath = DownloadOBBController.GetExpansionFilePath(); NGUIDebug.Log(" show in start : " + expPath); if (expPath == null) { lblContent.text = "External storage is not available!"; BtnDownLoad.isEnabled = false; return; } else { lblContent.text = "the path is available!! "; BtnDownLoad.isEnabled = true; StartCoroutine(loadLevel()); } #elif UNITY_EDITOR Destroy(gameObject); #endif }
public void FindOBBFilePath() { string mainPath = DownloadOBBController.GetMainOBBPath(expPath); string patchPath = DownloadOBBController.GetPatchOBBPath(expPath); NGUIDebug.Log("Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); NGUIDebug.Log("Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); if (mainPath == null || patchPath == null) { DownloadOBBController.FetchOBB(); } }