void OnGUI() { if (!GooglePlayDownloader.RunningOnAndroid()) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Use GooglePlayDownloader only on Android device!"); return; } string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); GUI.Label(new Rect(10, 25, Screen.width - 10, 20), "Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); if (mainPath == null || patchPath == null) { if (GUI.Button(new Rect(10, 100, 100, 100), "Fetch OBBs")) { GooglePlayDownloader.FetchOBB(); } } } }
private void CheckObb() { #if !UNITY_EDITOR && UNITY_ANDROID bool install = true; if (!GooglePlayDownloader.RunningOnAndroid()) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Use GooglePlayDownloader only on Android device!"); return; } string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); //GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Main = ..." + ( mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); //GUI.Label(new Rect(10, 25, Screen.width-10, 20), "Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); if ((mainPath == null || patchPath == null) && install) { //if (GUI.Button(new Rect(10, 100, 100, 100), "Fetch OBBs")) install = false; } GooglePlayDownloader.FetchOBB(); } #endif }
void OnGUI() { if (!GooglePlayDownloader.RunningOnAndroid()) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Use GooglePlayDownloader only on Android device!"); return; } expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); if (mainPath == null) { Debug.LogWarning("DownloadObbExample==>FetchOBB-------1"); GooglePlayDownloader.FetchOBB(); Debug.LogWarning("DownloadObbExample==>FetchOBB-------2"); } StartCoroutine(loadLevel()); // GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Main = ..." + ( mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); // GUI.Label(new Rect(10, 25, Screen.width-10, 20), "Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); // if (mainPath == null || patchPath == null) // if (GUI.Button(new Rect(10, 100, 100, 100), "Fetch OBBs")) // GooglePlayDownloader.FetchOBB(); } }
IEnumerator AndroidHandleOBBDownload() { if (GooglePlayDownloader.RunningOnAndroid()) { string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath != null) { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); if (mainPath == null || patchPath == null) { message = "Downloading OBB file from the server. May take couple of minutes. Please wait!"; yield return(new WaitForSeconds(0)); // skip some frames to show the message yield return(new WaitForSeconds(0)); yield return(new WaitForSeconds(0)); GooglePlayDownloader.FetchOBB(); message = ""; } } } yield return(new WaitForSeconds(0)); }
void Start() { expPath = GooglePlayDownloader.GetExpansionFilePath(); string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); StartCoroutine(loadLevel()); }
void OnGUI() { #if UNITY_ANDROID if (!GooglePlayDownloader.RunningOnAndroid()) { GUI.Label(new Rect(10, 10, Screen.width - 10, 40), "Use GooglePlayDownloader only on Android device!"); return; } string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { GUI.Label(new Rect(10, 10, Screen.width - 10, 40), "External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); // must be called before calling FetchOBB. string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); GUI.Label(new Rect(10, 10, Screen.width - 10, 40), "Main: " + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); GUI.Label(new Rect(10, 55, Screen.width - 10, 40), "Patch: " + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); // GooglePlayDownloader.FetchOBB(); // fetchingStarted = true; // StartCoroutine(Load()); if (mainPath == null || patchPath == null) { if (GUI.Button(new Rect(10, 100, 150, 150), "Fetch OBBs")) { GooglePlayDownloader.FetchOBB(); fetchingStarted = true; StartCoroutine(Load()); Debug.Log("Started from button pressed"); } } else { GooglePlayDownloader.FetchOBB(); fetchingStarted = true; StartCoroutine(Load()); Debug.Log("Started from paths being set"); } } #endif }
void OnGUI() { GUI.skin = mySkin; GUI.DrawTexture(new Rect(0, 0, background.width, background.height), background); if (!GooglePlayDownloader.RunningOnAndroid()) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Use GooglePlayDownloader only on Android device!"); return; } expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); if (alreadyLogged == false) { alreadyLogged = true; Debug.Log("expPath = " + expPath); Debug.Log("Main = " + mainPath); Debug.Log("Main = " + mainPath.Substring(expPath.Length)); if (mainPath != null) { StartCoroutine(loadLevel()); } } if (mainPath == null) { GUI.Label(new Rect(Screen.width - 600, Screen.height - 230, 430, 60), "There seems ato be Problem while Downloading Files Click on Fetch File to do it Mannually"); if (GUI.Button(new Rect(10, 100, 100, 100), "Fetch Files")) { GooglePlayDownloader.FetchOBB(); StartCoroutine(loadLevel()); } } } }
void LoadResource() { Debug.Log("LoadResource"); if (!GooglePlayDownloader.RunningOnAndroid()) { //GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Use GooglePlayDownloader only on Android device!"); Debug.Log("Use GooglePlayDownloader only on Android device!"); return; } string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { //GUI.Label(new Rect(10, 10, Screen.width-10, 20), "External storage is not available!"); Debug.Log("External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); Debug.Log("mainPath:" + mainPath); Debug.Log("patchPath:" + patchPath); //GUI.Label(new Rect(10, 10, Screen.width-10, 20), "Main = ..." + ( mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); //GUI.Label(new Rect(10, 25, Screen.width-10, 20), "Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); if (mainPath == null) //if (GUI.Button(new Rect(10, 100, 100, 100), "Fetch OBBs")) { GooglePlayDownloader.SetMainOBBInfo(ClientConfigure.getResourceURL()); //GooglePlayDownloader.SetMainOBBFileName("file name"); GooglePlayDownloader.FetchOBB(); StartCoroutine(WaitForObbDownLoadOver()); } else { //SDKManager.GetInstance(); Application.LoadLevel(Utils.UI_NAME_Login); } } }
void Start() { #if !UNITY_EDITOR && UNITY_ANDROID string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { Debug.LogWarning("External storage is not available!"); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); string patchPath = GooglePlayDownloader.GetPatchOBBPath(expPath); Debug.LogWarning("Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); Debug.LogWarning("Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); if (mainPath == null || patchPath == null) { GooglePlayDownloader.FetchOBB(); } } #endif }