Ejemplo n.º 1
0
 void StartAssetLoad()
 {
     load_count = 0;
     cacaulte_load_list();
     if (load_list.Count > 0)
     {
         StartCoroutine(LoadPrefabModel(PublicClass.filePath + load_list[0].name, Vesal_DirFiles.remove_name_suffix(load_list[0].name), count_load));
         AsyncLoadModel.instance.show_message("<size=26>正在加载模型,请稍等...</size>\r\n<size=30>已经完成</size>" + (load_count / (float)load_list.Count).ToString("00%"));
         try
         {
             AsyncLoadModel.instance.img.fillAmount = 0;
         }
         catch (Exception)
         {
         }
         //Debug.Log(AsyncLoadModel.instance.img.fillAmount);
         // Debug.Log(load_count / (float)load_list.Count);
     }
     else
     {
         AsyncLoadModel.instance.show_message("<size=26>正在加载模型,请稍等...</size>\r\n<size=30>已经完成</size>" + (0.9).ToString("00%"));
         try
         {
             AsyncLoadModel.instance.img.fillAmount = 0.9f;
         }
         catch (Exception)
         {
         }
         hasNewModelLoaded = true;
     }
     PublicClass.appstate = App_State.Init_2;
 }
Ejemplo n.º 2
0
    //异步加载assetbundle资源列表
    public void load_assets_A(Action load_complete = null)
    {
        Unity_Tools.StarTime("获取远程数据计时-------");

        load_length = 0;
        load_count  = 0;
        load_length = load_list.Count;
        DebugLog.DebugLogInfo("--------------------加载模型长度:" + load_length);
        for (int i = 0; i < load_list.Count; i++)
        {
            DebugLog.DebugLogInfo("--------------------: " + load_list[i].name);
        }

        StartCoroutine(LoadPrefabModel(PublicClass.filePath + load_list[0].name, Vesal_DirFiles.remove_name_suffix(load_list[0].name), count_load));
    }
Ejemplo n.º 3
0
    void Start()
    {
        if (PublicClass.app.app_type != "sign_acu")
        {
            return;
        }

        try
        {
            GameObject.Find("RightMenuManager").SetActive(false);
            GameObject.Find("XiaoRen").SetActive(false);
            GameObject.Find("CursorModeCanvas").SetActive(false);
        }
        catch (System.Exception)
        {
            Debug.Log("rightmenumanager error");
        }

        if (PublicClass.app.app_id == "AA0100000")
        {
            i.gameObject.SetActive(false);
            ii.gameObject.SetActive(true);
        }

        db_path = Vesal_DirFiles.remove_name_suffix(PublicClass.app.xml_path) + "/SignAcu.db";//AppOpera.acu_path+"SignAcu.db";
        PublicClass.Transform_temp.gameObject.SetActive(true);
        if (showTxt == null)
        {
            showTxt = new GameObject().AddComponent <Text>();
        }
        showTxt.gameObject.SetActive(false);


        ReadAcuTable();



        Debug.Log("---------链接数据库成功-----------");
        showTxt = showinfoBG.GetComponentInChildren <Text>();
    }
Ejemplo n.º 4
0
    //本地路径检测下载
    void CheckAssetAB(string ab_path, string app_version, bool CancelDownload = false)
    {
        DebugLog.DebugLogInfo("本地路径检测下载------------------" + this_app.ab_path);
        if (this_app.ab_path == "" || this_app.ab_path == null || CancelDownload)
        {
            DebugLog.DebugLogInfo("无私有资源:" + this_app.ab_path);
            DownLoad_complete();
            return;
        }
        string path        = Vesal_DirFiles.get_dir_from_full_path(ab_path);
        string source_name = Vesal_DirFiles.get_file_name_from_full_path(ab_path);
        string short_name  = Vesal_DirFiles.remove_name_suffix(source_name);
        string suffix      = Vesal_DirFiles.get_name_suffix(source_name);

        downloadFilePath = path + short_name + "_" + app_version + "." + suffix;
        targetSourcePath = path + short_name + "_" + app_version;

        DebugLog.DebugLogInfo("targetSourcePath:" + targetSourcePath);
        //        if (!PublicClass.online_mode)
        //        {
        //            DebugLog.DebugLogInfo("离线模式");
        //            DebugLog.DebugLogInfo("资源路径:" + path);
        //            DebugLog.DebugLogInfo("short_name  " + short_name);

        //            int founded = 0;
        //            DirectoryInfo dif = new DirectoryInfo(path);
        //            FileSystemInfo[] fsis = dif.GetFileSystemInfos();
        //            for (int i = 0; i < fsis.Length; i++)
        //            {
        //                FileSystemInfo tmp = fsis[i];
        //                if (tmp.FullName == downloadFilePath || tmp.FullName == targetSourcePath || tmp.FullName.Replace("\\", "/") == targetSourcePath || tmp.FullName.Replace("\\", "/") == downloadFilePath)
        //                {
        //                    //PublicClass.app.struct_name = short_name;
        //                    PublicClass.app.ab_path = Vesal_DirFiles.get_file_name_from_full_path(tmp.FullName);
        //                    PublicClass.app.xml_path = tmp.FullName;
        //                    founded = 1;
        //                    break;
        //                }
        //            }
        //            if (founded == 0)
        //            {
        //                this_app = null;
        //                PublicClass.app = null;
        //                SetOperaToLoop();
        //                //发送
        //#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        //                if (PPTGlobal.PPTEnv != PPTGlobal.PPTEnvironment.plugin)
        //                {
        //                    send_cmd((byte)VESAL_CMD_CODE.MSG_CMD, "hide");
        //                }
        //#elif UNITY_IOS
        //                    Unity_Tools.clear_message_from_platform_for_ios();
        //                    Unity_Tools.ui_return_to_platform();
        //#elif UNITY_ANDROID
        //                    Unity_Tools.clear_message_from_platform_for_android();
        //                    Unity_Tools.ui_return_to_platform();
        //#else
        //#endif
        //                return;
        //            }
        //            else
        //            {
        //                DownLoad_complete();
        //            }
        //        }
        //        else
        //        {
        DebugLog.DebugLogInfo("在线模式");
        switch (PublicClass.app.app_type)
        {
        // case "medical":
        //     //目录存在,说明已经成功下载
        //     if (Directory.Exists(targetSourcePath))
        //     {
        //         DownLoad_complete();
        //     }
        //     else
        //     {
        //         DownLoadSignGroup(PublicClass.app.ab_path, downloadFilePath);
        //     }
        //     break;
        default:
            // PublicClass.TimelineFilePath = targetSourcePath;
            PublicClass.app.xml_path = downloadFilePath;
            string tmpPath = this_app.ab_path + "";
            PublicClass.app.ab_path = short_name + "_" + app_version + "." + suffix;
            //删除旧版本
            int    currentVersion  = int.Parse(app_version);
            string lastVersionPath = path + short_name + "_";
            for (int i = 0; i < currentVersion; i++)
            {
                if (Directory.Exists(lastVersionPath + i))
                {
                    Directory.Delete(lastVersionPath + i, true);
                }
            }
            if (!File.Exists(downloadFilePath) && !Directory.Exists(targetSourcePath))
            {
                string[] files = Directory.GetFiles(path);
                for (int i = 0; i < files.Length; i++)
                {
                    if (Vesal_DirFiles.get_file_name_from_full_path(files[i]).StartsWith(short_name))
                    {
                        Vesal_DirFiles.DelFile(files[i]);
                    }
                }
                //下载远程
                DownLoadSignGroup(tmpPath, downloadFilePath);
            }
            else
            {
                DownLoad_complete();
            }
            break;
            //}
        }
    }
Ejemplo n.º 5
0
    //加载完毕回调
    void count_load()
    {
        if (load_error_flag == false)
        {
            if (load_list[load_count].type != "TEMP")
            {
                PublicClass.Asset_loaded_list.Add(load_list[load_count]);
            }
        }
        else
        {
            //资源加载出错,放弃继续
            SetOperaToLoop();
            UnityEngine.Debug.Log("load error " + load_list[load_count].name);
            Unity_Tools.ui_return_to_platform("alert", "资源加载错误,请重试。");
            return;
        }

        load_count++;
        show_progress.current_progress = (float)load_count / (float)load_length;
        if (load_list.Count > load_count)
        {
            timer = 0;
            StartCoroutine(LoadPrefabModel(PublicClass.filePath + load_list[load_count].name, Vesal_DirFiles.remove_name_suffix(load_list[load_count].name), count_load));
        }
        if (load_count == load_length)
        {
            DebugLog.DebugLogInfo("加载完毕 获取平台参数:");
            //后台加载完成后,进入场景分发器,异步加载多个场景
            OperaStatus = AppOperState.Apprun;
        }
    }
Ejemplo n.º 6
0
    void cacaulte_load_list()
    {
        load_list = new List <Download_Vesal_info>();
        string downloaded_str = "";

        foreach (Download_Vesal_info download in PublicClass.Asset_loaded_list)
        {
            downloaded_str += download.name;
        }
        print("PublicClass.total_load_list :" + PublicClass.total_load_list.Count);
        if (this_app.ab_list == null || (this_app.ab_list.Trim() == ""))
        {
            foreach (Download_Vesal_info download in PublicClass.total_load_list)
            {
                if (!downloaded_str.Contains(Vesal_DirFiles.remove_name_suffix(download.name)))
                {
                    download.type = "AB";
                    load_list.Add(download);
                }
            }
        }
        else
        {
            string[] ab_files   = this_app.ab_list.Split(',');
            string   ablist_str = "";
            for (int k = 0; k < ab_files.Length; k++)
            {
                //if (PublicClass.low_res_ablist.Contains(ab_files[k]))
                //    ab_files[k] = "s_"+ab_files[k];
                ablist_str += ab_files[k];
                if (!downloaded_str.Contains(ab_files[k]))
                {
                    foreach (Download_Vesal_info download in PublicClass.total_load_list)
                    {
                        if (download.name.Contains(ab_files[k]))
                        {
                            download.type = "AB";
                            load_list.Add(download);
                            break;
                        }
                    }
                }
            }


            // //对于性能差的机型,卸载掉不用的ab包模型数据
            // if ((PublicClass.Quality == Run_Quality.POOL) && (load_list.Count + PublicClass.Asset_loaded_list.Count() >= PublicClass.MAX_Ab_num))
            // {
            //     bool unload = false;
            //     for (int k = PublicClass.Asset_loaded_list.Count() - 1; k >= 0; k--)
            //     {
            //         Download_Vesal_info temp = PublicClass.Asset_loaded_list[k];
            //         if (!PublicTools.isTargetInSourceList(Vesal_DirFiles.remove_name_suffix(temp.name), PublicClass.app.ab_list))
            //         {
            //             UnityEngine.Debug.Log("POOL Destroy::" + temp.name);
            //             try
            //             {
            //                 DestroyImmediate(temp.instance);
            //                 //Destroy(temp.source);
            //             }
            //             catch (Exception e)
            //             {
            //                 UnityEngine.Debug.Log(e.Message);
            //             }
            //             Resources.UnloadUnusedAssets();
            //             PublicClass.Asset_loaded_list.RemoveAt(k);
            //             unload = true;
            //         }
            //     }
            //     if (unload)
            //         ReadModelAgain();
            // }
        }


        if (PublicClass.app.app_type == "sign_acu")
        {
            Download_Vesal_info download = new Download_Vesal_info();
            download.name = "acu_path/" + Vesal_DirFiles.remove_name_suffix(PublicClass.app.ab_path) + "/acupoint.assetbundle";
            download.type = "TEMP";
            load_list.Add(download);
        }

        print("downloaded_strdownloaded_str :" + downloaded_str);

        UnityEngine.Debug.Log("加载ab 包 长度:" + load_list.Count);
    }
Ejemplo n.º 7
0
    void count_load()
    {
        if (load_error_flag == false)
        {
            PublicClass.Asset_loaded_list.Add(load_list[load_count]);
        }
        load_count++;
        //if (PublicClass.Quality == Run_Quality.GOOD) {
        hasNewModelLoaded = true;
        //}
        //        Camera.main.gameObject.GetComponent<ChooseModel>().loadModel();
        if (load_list.Count > load_count)
        {
            AsyncLoadModel.instance.show_message("<size=26>正在加载模型,请稍等...</size>\r\n<size=30>已经完成</size>" + Math.Min((load_count / (float)load_list.Count), 0.9f).ToString("00%"));
            StartCoroutine(LoadPrefabModel(PublicClass.filePath + load_list[load_count].name, Vesal_DirFiles.remove_name_suffix(load_list[load_count].name), count_load));
            try
            {
                AsyncLoadModel.instance.img.fillAmount = Math.Min((load_count / (float)load_list.Count), 0.9f);
            }
            catch (Exception)
            {
            }
        }
        if (load_count == load_list.Count)
        {
            Debug.Log("加载完毕");
            AsyncLoadModel.instance.show_message("<size=26>正在加载模型,请稍等...</size>\r\n<size=30>已经完成</size>" + (0.9f).ToString("00%"));

            try
            {
                AsyncLoadModel.instance.img.fillAmount = 0.9f;
            }
            catch (Exception)
            {
            }
            //AsyncLoadModel.instance.close_message();
        }
    }
Ejemplo n.º 8
0
    void cacaulte_load_list()
    {
        load_list = new List <Download_Vesal_info>();
        if (PublicClass.app.app_type == "demo")
        {
            return;
        }
        string downloaded_str = "";

        foreach (Download_Vesal_info download in PublicClass.Asset_loaded_list)
        {
            downloaded_str += download.name;
        }

        Debug.Log("loaded ablist---:" + downloaded_str);

        //if (PublicClass.app.ab_list == null || (PublicClass.app.ab_list.Trim() == ""))
        //{
        string        ab     = "";
        List <string> ablist = new List <string>();

        foreach (string model in temp.scope_scene_model_name)
        {
            if (!PublicClass.Model_AB_dic.ContainsKey(model))
            {
                Debug.Log("the model not founded in ab !!!!!!!!!!!!!!!" + model);
                continue;
            }
            string modelab = PublicClass.Model_AB_dic[model];
            if (ab != modelab)
            {
                if (!ablist.Contains(modelab))
                {
                    ab = modelab;
                    ablist.Add(modelab);
                    Download_Vesal_info item = new Download_Vesal_info();
                    item.type = "AB";
                    item.name = ab + ".assetbundle";
                    if (!downloaded_str.Contains(item.name))
                    {
                        load_list.Add(item);
                    }
                }
            }
        }
        //foreach (Download_Vesal_info download in PublicClass.total_load_list)
        //{
        //    if (!downloaded_str.Contains(Vesal_DirFiles.remove_name_suffix(download.name)))
        //    {
        //        load_list.Add(download);
        //    }
        //}

        //}
        //else
        //{
        //    Debug.Log("app ablist---:" + PublicClass.app.ab_list);
        //    string[] ab_files = PublicClass.app.ab_list.Split(',');
        //    string ablist_str = "";
        //    Debug.Log("app ablist---number:" + ab_files.Length);
        //    for (int k = 0; k < ab_files.Length; k++)
        //    {
        //        //if (PublicClass.low_res_ablist.Contains(ab_files[k]))
        //        //    ab_files[k] = "s_"+ab_files[k];
        //        //ablist_str += ab_files[k];
        //        if (!downloaded_str.Contains(ab_files[k] + ".assetbundle"))
        //        {
        //            bool founded = false;
        //            foreach (Download_Vesal_info download in PublicClass.total_load_list)
        //            {
        //                if (download.name.Contains(ab_files[k] + ".assetbundle"))
        //                {
        //                    founded = true;
        //                    load_list.Add(download);
        //                    break;
        //                }
        //            }
        //            if (!founded)
        //            {
        //                Debug.Log("ab list error:" + ab_files[k]);
        //            }
        //        }
        //    }
        //}
        //卸载掉不用的ab包模型数据
        string ab_list_string = "";

        foreach (string str in ablist)
        {
            ab_list_string += (str + ",");
        }

        if ((PublicClass.Quality == Run_Quality.POOL) && (load_list.Count + PublicClass.Asset_loaded_list.Count() >= PublicClass.MAX_Ab_num))
        {
            bool unload = false;
            for (int k = PublicClass.Asset_loaded_list.Count() - 1; k >= 0; k--)
            {
                Download_Vesal_info tmp = PublicClass.Asset_loaded_list[k];

                if (!PublicTools.isTargetInSourceList(Vesal_DirFiles.remove_name_suffix(tmp.name), ab_list_string))
                {
                    Debug.Log("POOL Destroy::" + tmp.name);
                    try
                    {
                        DestroyImmediate(tmp.instance);
                        //Destroy(temp.source);
                    }
                    catch (Exception e)
                    {
                        Debug.Log(e.Message);
                    }
                    Resources.UnloadUnusedAssets();
                    PublicClass.Asset_loaded_list.RemoveAt(k);
                    unload = true;
                }
            }
            if (unload)
            {
                ReadModelAgain();
            }
        }
    }
Ejemplo n.º 9
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");
            }
        }
    }
Ejemplo n.º 10
0
    //加载完毕回调
    void count_load()
    {
        print(load_list.Count + " ---------- count");
        if (load_error_flag == false)
        {
            PublicClass.Asset_loaded_list.Add(load_list[count]);
        }
        count++;
        progress.current_progress = (float)count / (float)length;
        if (load_list.Count > count)
        {
            timer = 0;
            StartCoroutine(LoadPrefabModel(PublicClass.filePath + load_list[count].name, Vesal_DirFiles.remove_name_suffix(load_list[count].name), count_load));
        }
        if (count == length)
        {
#if UNITY_EDITOR
            //Debug.LogError(LoadResult);
#endif
            start_load_model = false;
            this.ReadModelInfo();
            PublicClass.Transform_parent.gameObject.SetActive(false);
            ReadModel(PublicClass.Transform_parent);

#if UNITY_ANDROID
            // DebugLog.DebugLogInfo("返回平台!");
            Unity_Tools.ui_return_to_platform();
#endif
            isLoadAbDown = true;
            if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.PPTPlayer || PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.WeiKePlayer)
            {
                //if (PPTResourcePool.isSkipUnzip == true)
                //{
                //    isLoadAbDown = true;

                //}
                if (isLoadAbDown && isUnzipDown)
                {
                    isLoadAbDown = false;
                    if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.demo_pc)
                    {
                        SceneManager.LoadScene("SceneSwitchInteral");
                    }
                    else
                    {
                        SceneManager.LoadScene("SceneSwitch");
                    }
                }
                return;
            }

            if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.demo_pc)
            {
                SceneManager.LoadScene("SceneSwitchInteral");
            }
            else
            {
                SceneManager.LoadScene("SceneSwitch");
            }
        }
    }