void OnGUI()
    {
        if (!GooglePlayObbDownloadManager.IsDownloaderAvailable())
        {
            GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "Use GooglePlayDownloader only on Android device!");
            return;
        }

        string expPath = m_obbDownloader.GetExpansionFilePath();

        if (expPath == null)
        {
            GUI.Label(new Rect(10, 10, Screen.width - 10, 20), "External storage is not available!");
        }
        else
        {
            var mainPath  = m_obbDownloader.GetMainOBBPath();
            var patchPath = m_obbDownloader.GetPatchOBBPath();

            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"))
                {
                    m_obbDownloader.FetchOBB();
                }
            }
        }
    }
예제 #2
0
        public static bool Check()
        {
            string content       = "odd touched";
            bool   need_download = false;

            IGooglePlayObbDownloader googlePlayObbDownloader = GooglePlayObbDownloadManager.GetGooglePlayObbDownloader();

            if (googlePlayObbDownloader == null)
            {
                content = "Use GooglePlayDownloader only on Android device!";
                return(false);
            }

            string expPath = googlePlayObbDownloader.GetExpansionFilePath();

            if (string.IsNullOrEmpty(expPath))
            {
                content = "External storage is not available!";
            }
            else
            {
                string mainPath = googlePlayObbDownloader.GetMainOBBPath();

                if (string.IsNullOrEmpty(mainPath))
                {
                    need_download = true;

                    content = "need download OBBs";

                    googlePlayObbDownloader.FetchOBB();
                }
            }
            Debug.Log(content);

            return(need_download);
        }