예제 #1
0
    /// <summary>
    /// 微课初始化
    /// </summary>
    public void init()
    {
        PPTGlobal.pptStatus = PPTGlobal.PPTStatus.unziping;
        ModelUiCamera.depth = 21;
        LittleMapCam.depth  = 20;
        Camera.main.depth   = 20;
        ModelBgCamera.depth = 19;
        initProgress("正在解析资源");
        //yield return null;
        if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.pc || PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.ios || PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.android)
        {
            Debug.Log("init WeiKe");
            //string basePath = AppOpera.WeiKePlayer_path;
            //if (basePath!=string.Empty) {
            //    Vesal_DirFiles.DelectDir(basePath);
            //}
            //Vesal_DirFiles.CreateDir(basePath + PublicClass.app.app_id + "/");
            //StartCoroutine(Vesal_DirFiles.UnZipAsync(basePath + PublicClass.app.ab_path, basePath + PublicClass.app.app_id + "/", unzipProgress, true));

            unzipProgress(1.0F);
        }
        PPTGlobal.PPTPath = PPTGlobal.PPTPath + message + "/";
        Debug.Log(PPTGlobal.PPTPath);
        if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.PPTPlayer || PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.WeiKePlayer)
        {
            if (isSkipUnzip)
            {
                isSkipUnzip = false;
                unzipProgress(1f);
            }
            else
            {
                if (PPTHomePageController.TempFilePath != string.Empty)
                {
                    Vesal_DirFiles.DelectDir(PPTHomePageController.TempFilePath);
                }
                Debug.Log(PPTHomePageController.tmpSelectPath);
                //PPTHomePageController.TempFilePath = Vesal_DirFiles.get_dir_from_full_path(PPTHomePageController.tmpSelectPath)+ System.Guid.NewGuid().ToString("N");

                Debug.Log(PPTHomePageController.TempFilePath);
                StartCoroutine(Vesal_DirFiles.UnZipAsync(PPTHomePageController.tmpSelectPath, PPTHomePageController.TempFilePath, unzipProgress, true));
            }
        }
    }
예제 #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;
        }
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     StartCoroutine(Vesal_DirFiles.UnZipAsync("D:\\vesalplayer\\李哲微课第一讲——骨骼系统简介.vsl", "D:\\vesalplayer\\", unzipProgress, true));
 }
예제 #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");
            }
        }
    }