Exemple #1
0
 //开启下载
 public void DownloadNow()
 {
     //初始化
     showProgress.Set_Progress("正在下载模型..."); //, CannelDownload);
     ndr  = 0;
     http = new HttpDownLoad();
     DebugLog.DebugLogInfo("开始下载!");
     DownSwitch();
 }
Exemple #2
0
    void Update()
    {
        //UnityEngine.Debug.Log(OperaStatus);
        if (OperaStatus != AppOperState.Loop)
        {
            timer = 0;
        }
        switch (OperaStatus)
        {
        case AppOperState.Loop:
            timer++;
#if UNITY_EDITOR
#elif UNITY_IOS
            string message = Unity_Tools.get_message_from_platform_for_ios();
            if (message != "")
            {
                DebugLog.DebugLogInfo("-------------------------------get_message---------------------------------------");
                Get_app(message);
                Unity_Tools.clear_message_from_platform_for_ios();
            }
            if (timer > 60)
            {
                Unity_Tools.ui_return_to_platform();
                timer = 0;
            }
#elif UNITY_ANDROID
            string message = Unity_Tools.get_message_from_platform_for_android();
            if (message != "")
            {
                DebugLog.DebugLogInfo("-------------------------------get_message---------------------------------------");
                Get_app(message);
                Unity_Tools.clear_message_from_platform_for_android();
            }
            if (timer > 60)
            {
                Unity_Tools.ui_return_to_platform();
                timer = 0;
            }
#endif

            break;

        case AppOperState.Apprun:

            DebugLog.DebugLogInfo(" 资源完备加载 加载场景 " + this_app.app_type);
            UnityEngine.Debug.Log(" 资源完备加载 加载场景 " + this_app.app_type);
            switch (PublicClass.app.app_type)
            {
            case "model":
                //SetOperaToRuning();
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
                if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.plugin)
                {
                    Load_Scene("UI4_PptPlugin");
                }
                else
                {
                    show_progress.CloseBtn(true);
                    Load_Scene("UI3");
                }
#elif UNITY_IOS || UNITY_ANDROID
                Load_Scene("UI2", false);
#endif
                //show_progress.StopLoad();
                // Load_Scene("sign");
                break;

            case "sign":
                show_progress.CloseBtn(true);
                Load_Scene("UI_sign", false);
                break;

            case "sign_ssp":
            case "sign_new":
            case "sign_acu":
                show_progress.CloseBtn(true);
                Load_Scene("UI_sign_all");
                // Load_Scene("sign");
                break;

            case "ppt":
                Load_Scene("ppt");
                break;

            case "microlesson":
                show_progress.CloseBtn(false);
                Load_Scene("WeiKePlayer");
                break;

            case "game":
                show_progress.CloseBtn(false);
                Load_Scene("Block_UI");
                break;

            case "exam":
                Load_Scene("totalScence");
                break;

            case "medical":
                Load_Scene("Medical", true);
                break;

            case "animation":
                Load_Scene("MotorAnatomy", true);
                break;

            case "acu":
                Load_Scene("NewAcu", true);
                break;

            case "cfd":
                Load_Scene("CFD", true);
                break;

            default:
                break;
            }

            //SetOperaToRuning();
            break;

        case AppOperState.LoadScene:
            if (show_progress != null)
            {
                show_progress.current_progress = _async.progress;
            }
            //vesal_log.vesal_write_log("load scenec" + _async.progress);
            break;

        case AppOperState.Appruning:
            //if (show_progress.current_progress <= 0.8f)
            if (_async != null && _async.progress >= 0.85f && _async.allowSceneActivation == false)
            {
                _async.allowSceneActivation = true;
            }
            break;

        case AppOperState.UpdateData:
            show_progress.Set_Progress("系统正在为下载后首次运行准备数据,请稍等...");
            update_app_fix();
            OperaStatus = AppOperState.UpdataDating;
            break;

        case AppOperState.Downloading:
            if (http.progress <= 1.0f)
            {
                show_progress.current_progress = http.progress;
            }
            break;

        case AppOperState.AssetLoad:
            UnityEngine.Debug.Log("模型正在加载中..." + PublicClass.app.app_type);
            show_progress.Set_Progress("模型正在加载中...", Call);
            switch (PublicClass.app.app_type)
            {
            case "acu":
            case "model":
            // OperaStatus = AppOperState.Apprun;
            // break;
            case "sign":
            case "sign_ssp":
            case "sign_new":
            case "sign_acu":
            case "ppt":
            case "microlesson":
            case "game":
            case "exam":
                UnityEngine.Debug.Log("cacaulte_load_list();");
                cacaulte_load_list();
                if (load_list.Count() == 0)
                {
                    UnityEngine.Debug.Log("OperaStatus = AppOperState.Apprun;");
                    OperaStatus = AppOperState.Apprun;
                }
                else
                {
                    OperaStatus = AppOperState.AssetLoading;
                    UnityEngine.Debug.Log("OperaStatus = AppOperState.AssetLoading;");
                    load_assets_A(count_load);
                }
                break;

            case "cfd":
                OperaStatus = AppOperState.Apprun;
                //cacaulte_load_list();
                if (load_list.Count() == 0)
                {
                    UnityEngine.Debug.Log("OperaStatus = AppOperState.Apprun;");
                    OperaStatus = AppOperState.Apprun;
                }
                else
                {
                    OperaStatus = AppOperState.AssetLoading;
                    UnityEngine.Debug.Log("OperaStatus = AppOperState.AssetLoading;");
                    load_assets_A(count_load);
                }
                break;

            default:
                break;
            }
            break;

        case AppOperState.UnZip:
            OperaStatus = AppOperState.UnZiping;
            if (File.Exists(downloadFilePath))
            {
                StartCoroutine(Vesal_DirFiles.UnZipAsync(downloadFilePath, targetSourcePath + "/", unzipProgress, true));
                //StartCoroutine(StartUnzip(downloadFilePath, targetSourcePath));
            }
            else
            {
                OperaStatus = AppOperState.AssetLoad;
            }
            break;

        default:
            break;
        }
    }
 /// <summary>
 /// 初始化进度条
 /// </summary>
 /// <param name="tittle">加载标题</param>
 public void initProgress(string tittle = "")
 {
     progressPanel.SetActive(true);
     sp.Set_Progress(tittle);
 }
Exemple #4
0
    List <Download_Vesal_info> load_list;//异步加载assetbundle资源列表

    public void load_assets_A(List <Download_Vesal_info> targetList, Action load_complete = null)
    {
        if (PublicClass.id_model_dic == null)
        {
            PublicClass.id_model_dic = new Dictionary <string, int>();
        }

        load_list = new List <Download_Vesal_info>();
        foreach (Download_Vesal_info temp in targetList)
        {
            if ((temp.type == null) || (temp.type.ToUpper() == "") || (temp.type.ToUpper() == "AB"))
            {
                load_list.Add(temp);
                PublicClass.total_load_list.Add(temp);
            }
        }
        //DebugLog.DebugLogInfo("--------------------可以加载模型长度:" + PublicClass.total_load_list.Count);
        //foreach (Download_Vesal_info temp in PublicClass.total_load_list)
        //{
        //    DebugLog.DebugLogInfo("total list:" + temp.name);
        //}

        //去掉多余的加载项
        int max = load_list.Count;

        for (int k = PublicClass.int_load_AB_nums; k < max; k++)
        {
            load_list.RemoveAt(PublicClass.int_load_AB_nums);
        }

        Unity_Tools.StarTime("获取远程数据计时-------");
        progress.Set_Progress("模型正在加载中...", Call);
        length = 0;
        count  = 0;
        length = load_list.Count;
        DebugLog.DebugLogInfo("--------------------加载模型长度:" + length);
        ////加载公共库异常处理
        //if (load_list.Count == 0)
        //{
        //    progress.Set_Progress("加载数据错误...", Call);
        //}
//这是在未PPTPlayer 播放时,启动时指定vsl文件而给与解压
        if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.PPTPlayer || PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.WeiKePlayer)
        {
            isUnzipDown = true;
            string[] CommandLineArgs = Environment.GetCommandLineArgs();
            for (int i = 0; i < CommandLineArgs.Length; i++)
            {
                string tmpStr = CommandLineArgs[i];
                //tmpStr = "C:\\vesalplayer\\WK0000001_5.vsl";
                Debug.Log("GetCommandLineArgs::" + tmpStr);
                vesal_log.vesal_write_log("GetCommandLineArgs::" + tmpStr);
                if (tmpStr.Contains(".vsl") || tmpStr.Contains(".VSL"))
                {
                    Debug.Log("GetCommandLineArgs::" + tmpStr);
                    //SelectFile(tmpStr);
                    PPTHomePageController.TempFilePath = PPTHomePageController.getTempPath();
                    vesal_log.vesal_write_log("PPTHomePageController.TempFilePath " + PPTHomePageController.TempFilePath);
                    StartCoroutine(Vesal_DirFiles.UnZipAsync(tmpStr, PPTHomePageController.TempFilePath, ManagerModelUnzipCall, true));
                    PPTResourcePool.isSkipUnzip = true;
                    isUnzipDown = false;
                    PPTHomePageController.currentFilePath = tmpStr;
                    break;
                }
            }
        }



        if (load_list.Count > 0)
        {
            //设置加载标记
            start_load_model = true;
            timer            = 0;
            //            progress = GameObject.Find("LoadingCanvas").transform.GetComponent<ShowProgress>();

            StartCoroutine(LoadPrefabModel(PublicClass.filePath + load_list[0].name, Vesal_DirFiles.remove_name_suffix(load_list[0].name), count_load));
        }
        else
        {
            start_load_model = false;
            this.ReadModelInfo();
            if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.demo_pc)
            {
                SceneManager.LoadScene("SceneSwitchInteral");
            }
            else
            {
                SceneManager.LoadScene("SceneSwitch");
            }
        }
    }