void OnGUI() { if (!GooglePlayDownloader.RunningOnAndroid()) { return; } else if (PlayerPrefs.GetInt("obbLoaded", 0) == 0) { 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); if (mainPath == null) { GooglePlayDownloader.FetchOBB(); } PlayerPrefs.SetInt("obbLoaded", 1); PlayerPrefs.Save(); } } }
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(); } } } }
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(); } }
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 }
public bool CheckGoogleResource() { if (Application.isEditor) { return(true); } if (GameDefines.OutputVerDefs == OutputVersionDefs.WPay) { if (!GooglePlayDownloader.RunningOnAndroid()) { Debug.Log("Use GooglePlayDownloader only on Android device!"); return(false); } string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath == null) { Debug.Log("External storage is not available!"); return(false); } else { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); Debug.Log("Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); if (mainPath == null /*|| patchPath == null*/) { GooglePlayDownloader.FetchOBB(); return(false); } } } return(true); }
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 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 }
public void Start() { GooglePlayDownloader.Init(PublicKeyFromGooglePlay); if (GooglePlayDownloader.RunningOnAndroid()) { string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (expPath != null) { string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); if (mainPath == null) { GooglePlayDownloader.DeleteAllOldOBBs(expPath); GooglePlayDownloader.FetchOBB(); } } } }
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); } } }
public void Init() { #if !RC_BUILD || SKU_CHINA OnObbComplete(true); return; #else // see if obb is already downloaded expansionFilePath = GooglePlayDownloader.GetExpansionFilePath(); if (GooglePlayDownloader.GetMainOBBPath(expansionFilePath) != null) { OnObbComplete(true); } else { Log.Debug("expansionFilePath = " + expansionFilePath); isDownloadingObb = true; GooglePlayDownloader.FetchOBB(); StartCoroutine(WaitForObb()); } #endif }
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 }
//============================================================================= void OnGUI() { #if UNITY_ANDROID #if ANDROID_GOOGLE if (!isOkToLoadLevel) { 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); if (mainPath == null) // || patchPath == null) { if (!isFetchingOBBs) { Debug.Log("Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); //Debug.Log("Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); Debug.Log("Fetching OBB ..."); //Camera.main.backgroundColor = new Color( 0.0f , 0.0f , 0.0f , 1.0f ); //Camera.main.clearFlags = CameraClearFlags.SolidColor; GooglePlayDownloader.FetchOBB(); isFetchingOBBs = true; } } else { Debug.Log("Main = ..." + (mainPath == null ? " NOT AVAILABLE" : mainPath.Substring(expPath.Length))); //Debug.Log("Patch = ..." + (patchPath == null ? " NOT AVAILABLE" : patchPath.Substring(expPath.Length))); isOkToLoadLevel = true; } } } #else isOkToLoadLevel = true; #endif #else isOkToLoadLevel = true; #endif if (isOkToLoadLevel && !isLoadingLevel) { if ((string.Empty != Application.dataPath) && ("" != Application.dataPath)) { Debug.Log(Application.dataPath); Debug.Log("Loading level: OpeningCreditsRoom"); Application.LoadLevel("OpeningCreditsRoom"); //isLoadingLevel = true; //DummyActivity(); } else { Debug.Log("App datapath is empty!"); } isLoadingLevel = true; } }
IEnumerator DoCheck() { Error = string.Empty; IsMounted = false; Notify(Localizer.GetString("ID_SPARX_CONTENT_CHECKING")); yield return(null); if (!GooglePlayDownloader.RunningOnAndroid()) { yield break; } string expPath = GooglePlayDownloader.GetExpansionFilePath(); if (string.IsNullOrEmpty(expPath)) { Error = "ID_SPARX_OBB_ERROR"; yield break; } EB.Debug.Log("Ext Folder: " + expPath); string mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); if (string.IsNullOrEmpty(mainPath)) { // moko: verify we have enough disk-space for the OBB at the destinated OBB path var size = EB.FileSystem.GetAvailableSpaceInBytes(expPath); if (size > this.ExpectedObbSize) { EB.Debug.Log("ObbManager > disk space availbity: " + expPath + ", size: " + size + "/" + this.ExpectedObbSize); } else { EB.Debug.LogError("ObbManager > Not Enough disk space: " + expPath + ", size: " + size + "/" + this.ExpectedObbSize); Error = "ID_SPARX_CONTENT_FAILED_EXTRACT"; yield break; } EB.Debug.Log("Fetching main OBB "); GooglePlayDownloader.FetchOBB(); yield return(new WaitForSeconds(3.0f)); } mainPath = GooglePlayDownloader.GetMainOBBPath(expPath); EB.Debug.Log("Main OBB Path: " + mainPath); if (string.IsNullOrEmpty(mainPath)) { EB.Debug.Log("Failed to download OBB"); Error = "ID_SPARX_CONTENT_FAILED"; yield break; } // cleanup old content folder try { if (Directory.Exists(BasePath)) { Directory.Delete(BasePath, true); } } catch { } IsMounted = true; EB.Debug.Log("Main Path: " + mainPath); Loader.OverridePath("jar:file://" + mainPath + "!/"); }