Exemple #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;
 }
 static public void vesal_write_log(String logcontent)
 {
     try {
         _log_path = PublicClass.tempPath + "unity.log";
         FileStream fs;
         if (!File.Exists(_log_path))
         {
             Vesal_DirFiles.CreateDir(PublicClass.tempPath);
             fs = new FileStream(_log_path, System.IO.FileMode.CreateNew);
         }
         else
         {
             fs = new FileStream(_log_path, System.IO.FileMode.Append);
         }
         String time_now = DateTime.Now.ToString();
         // FileStream fs = new FileStream("D:\\vesal.log", System.IO.FileMode.Append, FileAccess.Read, FileShare.ReadWrite);
         //获得字节数组
         byte[] data = System.Text.Encoding.UTF8.GetBytes(time_now + " : [" + _pid + "] " + logcontent + "\r\n\r\n");
         //开始写入
         fs.Write(data, 0, data.Length);
         //清空缓冲区、关闭流
         fs.Flush();
         fs.Close();
     } catch (Exception e) {
         UnityEngine.Debug.Log(e.Message);
     }
 }
Exemple #3
0
    public void Init(string db_path, GameObject model, string timeLine_path)
    {
        QualitySettings.blendWeights = BlendWeights.FourBones;
        GO = model;
        this.timelinePath = timeLine_path;
        AssetBundle      ab         = AssetBundle.LoadFromFile(timeLine_path);
        PlayableAsset    wallPrefab = ab.LoadAsset <PlayableAsset>(Vesal_DirFiles.get_file_name_from_full_path(timelinePath).Split('_')[0]);
        PlayableDirector pad        = model.GetComponent <PlayableDirector>();

        pad.playableAsset = wallPrefab;

        var timeline = pad.playableAsset as TimelineAsset;

        foreach (var track in timeline.GetOutputTracks())
        {
            Debug.Log(track.name);
        }
        pad.SetGenericBinding(timeline.GetOutputTrack(0), GO);

        this.db_path = db_path;
        timelineControll.timeLine = pad;
        showMode.model            = model;
        // showMode.Init();

        ab.Unload(false);
        loaddb();
    }
Exemple #4
0
 public static void update_app_fix()
 {
     index = 0;
     PublicClass.InitStaticData();
     db_list = new List <string>();
     db_list.AddRange(Vesal_DirFiles.ReadFileWithLine(PublicClass.filePath + "Mediacl/222.txt"));
     count = db_list.Count;
     update_db_process(db_list[index], count_load);
 }
Exemple #5
0
    IEnumerator LoadPrefabModel()
    {
        DebugLog.DebugLogInfo("--------487055555555555555555555552800-----" + PublicClass.Transform_parent.transform.Find("framework/GG_LuGu_Diff").childCount);

        Model_Group = new List <GameObject>();
        string temp_path = PublicClass.tempPath + "temp.dat";
        AssetBundleCreateRequest assetBundleCreateRequest = null;

        try
        {
            assetBundleCreateRequest = AssetBundle.LoadFromMemoryAsync(Vesal_DirFiles.GetAbfile(PublicClass.filePath + Asset_ab_name, temp_path));
        }
        catch (System.Exception ex)
        {
            UnityEngine.Debug.Log(ex.Message);
            UnityEngine.Debug.Log(ex.StackTrace);
        }

        if (assetBundleCreateRequest != null)
        {
            yield return(assetBundleCreateRequest);

            GameObject obj = (GameObject)assetBundleCreateRequest.assetBundle.LoadAsset(Prefab_Inner_name, typeof(GameObject));
            realObj = Instantiate(obj);

            //载入模型的 信息初始化 destory多余脚本 添加block 脚本
            Manager_Trans = GameObject.Find(Last_group_name).transform;
            last_Object   = Instantiate(Manager_Trans);
            last_Object.SetParent(Model_parent, true);
            last_Object.localPosition = Vector3.zero;
            last_Object.localScale   *= SizeOf_Model;
            realObj.SetActive(false);
            Model[]      remove_models = last_Object.GetComponentsInChildren <Model>();
            List <Model> ya_list       = new List <Model>();
            for (int i = 0; i < remove_models.Length; i++)
            {
                if (remove_models[i].name.Contains("Ya"))
                {
                    ya_list.Add(remove_models[i]);
                    continue;
                }
                Model_Group.Add(remove_models[i].gameObject);
            }
            for (int i = 0; i < ya_list.Count; i++)
            {
                Destroy(ya_list[i].gameObject);
            }
            DebugLog.DebugLogInfo("拼图个数:  " + Model_Group.Count);
            Add_block_componet(Model_Group);
            BlockManager.Instance.InitTargetPosition();//记录显示模型的初始化位置
            //ChangeModel_position(Model_Group);//随机位置

            assetBundleCreateRequest.assetBundle.Unload(false);
        }
    }
Exemple #6
0
    void ReadCopyList()
    {
        string target_file = PublicClass.filePath + "filelist.txt";

        StartCoroutine((Vesal_DirFiles.Vesal_FileCopy(PublicClass.fileLocalStreamingPath + "filelist.txt", target_file, () => {
            copy_list.AddRange(Vesal_DirFiles.ReadFileWithLine(target_file));
            DebugLog.DebugLogInfo("copy_list count -----------------:" + copy_list.Count);
            PublicClass.DataManagerStatus = DataIntState.Init;
            Vesal_DirFiles.DelFile(target_file);
        })));
    }
    //贴图记录工具
    public static void SetTextureDataToDB(string texture_path, string db_fullname)
    {
        print("<Color=#00ff00> db路径 :" + db_fullname + " </color>");
        List <string> list = new List <string>();

        list.AddRange(Vesal_DirFiles.GetAllDirInfoFromPath(texture_path));
        print("<Color=#00ff00> 贴图列表长度 :" + list.Count + "</color>");
        DbRepository <texture_mask> temp_db = new DbRepository <texture_mask>();

        // temp_db.DataService("StartStop.db");
        temp_db.CreateDb(db_fullname);
        temp_db.CreateTable();
        //db 原数据
        List <string> mask_name_list = new List <string>();
        var           tmpssp         = temp_db.Select <texture_mask>((ss_id) =>
        {
            if (ss_id != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });

        for (int i = 0; i < list.Count; i++)
        {
            texture_mask temp_mask = new texture_mask
            {
                id       = i + 1,
                name     = Vesal_DirFiles.get_file_name_from_full_path(list[i]),
                tex_data = File.ReadAllBytes(list[i]),// Vesal_DirFiles.Object2Bytes(new SceneModelState()),
            };
            bool has_record = false;
            foreach (texture_mask tmp in tmpssp)
            {
                if (temp_mask.name == tmp.name)
                {
                    temp_db.Update(temp_mask);
                    has_record = true;
                    print("update : " + temp_mask.name);
                }
            }
            if (has_record == false)
            {
                temp_db.Insert(temp_mask);
            }
        }

        Debug.Log("写入mask texture 数据成功");
        temp_db.Close();
    }
Exemple #8
0
    //public static GameObject QaController;
    private void Awake()
    {
        //#if UNITY_EDITOR
        //        LinkStart.message = "JGCY_GX";
        //        PublicClass.filePath = Application.persistentDataPath + "/";
        //#endif
        if (GlobalVariable.practiceState == PracticeState.classes || GlobalVariable.practiceState == PracticeState.errors)
        {
            Debug.Log("GlobalVariable.practiceState :" + GlobalVariable.practiceState);
            currentQaPath = PublicClass.filePath;
            return;
        }
        Debug.Log("BanckScript: " + JsonConvert.SerializeObject(PublicClass.app));
        string basePath = AppOpera.QA_path;

        currentQaPath = basePath + PublicClass.app.app_id + "_" + PublicClass.app.app_version;
        if (Directory.Exists(currentQaPath))
        {
            currentQaPath = Vesal_DirFiles.findFileInPath(currentQaPath, PublicClass.app.struct_code + ".xml");
        }
        else
        {
            StartCoroutine(transform.GetComponent <StartPanel>().requestFailed("资源获取失败,请返回重试!"));
        }


        //if (!File.Exists(currentQaPath + PublicClass.app.struct_code + ".xml"))
        //{
        //    Debug.Log("BanckScript: " + currentQaPath + PublicClass.app.struct_code + ".xml");

        //    Debug.Log("BanckScript:  不存在xml,解压文件夹。");
        //    //pass
        //    string firstDirName = string.Empty;
        //    Vesal_DirFiles.ExtractAppData(ref basePath, ref firstDirName);
        //    if (File.Exists(currentQaPath + PublicClass.app.struct_code + ".xml"))
        //    {
        //        //pass
        //    }
        //    else if (File.Exists(currentQaPath + firstDirName + "/" + PublicClass.app.struct_code + ".xml"))
        //    {
        //        currentQaPath = currentQaPath + firstDirName + "/";
        //    }
        //    else
        //    {

        //        StartCoroutine(transform.GetComponent<StartPanel>().requestFailed("资源获取失败,请返回重试!"));
        //    }
        //    Debug.Log(firstDirName);
        //}
        GlobalVariable.bankName = PublicClass.app.struct_code;
        Debug.Log(currentQaPath);
        Debug.Log(GlobalVariable.bankName);
    }
Exemple #9
0
    public void PreAssets()
    {
        DebugLog.DebugLogInfo("preasset---------------------------------");

        PublicClass.DataManagerStatus = DataIntState.StreamCopying;

        string source_path = string.Empty;

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        source_path = PublicClass.fileLocalStreamingPath.Replace("file://", "");
#elif UNITY_IOS
        source_path = PublicClass.fileLocalStreamingPath;
#elif UNITY_ANDROID
        source_path = PublicClass.fileLocalStreamingPath;
#endif
        string target_path = PublicClass.filePath;
        try
        {
            Vesal_DirFiles.DelectDirFiles(target_path, new List <string> {
                "PPT", "temp"
            });
            DebugLog.DebugLogInfo("delete files ok---------------------------------");
            UnityEngine.Debug.Log(source_path);
            UnityEngine.Debug.Log(copy_list.Count);
            PublicClass.InitDirFiles();

            stream_copy_list = PublicTools.DeepCopy <List <string> >(copy_list);
            for (int i = 0; i < stream_copy_list.Count; i++)
            {
                stream_copy_list[i] = source_path + stream_copy_list[i];
            }
            if (copy_list.Count > 0)
            {
                string source = stream_copy_list[stream_copy_count];
                string target = target_path + copy_list[stream_copy_count];
                StartCoroutine(Vesal_DirFiles.Vesal_FileCopy(source, target, count_stream_copy));
            }
            else
            {
                DebugLog.DebugLogInfo("stream copy 异常--------------------------------");

                PublicClass.DataManagerStatus = DataIntState.FetchDb;
            }
        }
        catch (Exception e)
        {
            UnityEngine.Debug.Log("current count :" + stream_copy_count);
            UnityEngine.Debug.Log(e.Message);
            UnityEngine.Debug.Log(e.StackTrace);
            PublicClass.DataManagerStatus = DataIntState.FetchDb;
        }
    }
    /// <summary>
    /// 结束解压,开始加载器预处理
    /// </summary>
    /// <returns></returns>
    IEnumerator endUnzip()
    {
        initProgress("正在加载幻灯片");
        yield return(null);

        if (PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.PPTPlayer || PPTGlobal.PPTEnv == PPTGlobal.PPTEnvironment.WeiKePlayer)
        {
            DirectoryInfo di = new DirectoryInfo(PPTHomePageController.TempFilePath);
            PPTGlobal.PPTPath = di.GetDirectories()[0].FullName;
            string id         = System.Guid.NewGuid().ToString("N");
            string renamePath = Vesal_DirFiles.get_dir_from_full_path(PPTGlobal.PPTPath) + id;
            //重命名文件夹,替换中文
            Directory.Move(PPTGlobal.PPTPath, renamePath);
            PPTGlobal.PPTPath = renamePath;
            PPTGlobal.PPTPath = PPTGlobal.PPTPath.Replace("\\", "/");
            if (!PPTGlobal.PPTPath.EndsWith("/"))
            {
                PPTGlobal.PPTPath += "/";
            }
        }
        else
        {
            int    pos      = PublicClass.app.xml_path.LastIndexOf(".");
            string basePath = "";
            if (pos >= 0)
            {
                basePath = PublicClass.app.xml_path.Substring(0, pos);
            }

            basePath = basePath + "/";
            message  = Vesal_DirFiles.GetFirstDirInDir(basePath);
            Debug.Log("basePath:" + basePath);

            //Vesal_DirFiles.ExtractAppData(ref basePath, ref message);
            string renamePath = basePath + PublicClass.app.app_id;
            if (basePath + message != renamePath)
            {
                //if (Directory.Exists(renamePath)) {
                //    Directory.Delete(renamePath,true);
                //}
                Directory.Move(basePath + message, renamePath);
                message = PublicClass.app.app_id;
            }
            PPTGlobal.PPTPath = basePath + message + "/";
            Debug.Log(PPTGlobal.PPTPath);
        }
        yield return(null);

        //progressPanel.SetActive(false);
        PPTGlobal.pptStatus = PPTGlobal.PPTStatus.initial;
    }
Exemple #11
0
    //string  cameraParamsByte;


    //private Customer markData;

    //public Customer MarkData
    //{
    //    set
    //    {
    //        markData = value;
    //        _id = markData._id;
    //        nameText.text = markData.bookmarkName;
    //        // DebugLog.DebugLogInfo(markData.btnState+" btnState:"+btnState);
    //        // DebugLog.DebugLogInfo(" markData.cameraParams:"+markData.cameraParams);
    //        // DebugLog.DebugLogInfo("markData.BookmarkPicture :"+markData.BookmarkPicture.Length);
    //        //类对象反序列化
    //        btnState = (SceneBtnState)BookMarkManager.DeserializeObject<SceneBtnState>(markData.btnState);
    //        modelState = (SceneModelState)BookMarkManager.DeserializeObject<SceneModelState>(markData.modelState);
    //        cameraParams = (CameraParams)BookMarkManager.DeserializeObject<CameraParams>(markData.cameraParams);
    //        ImageMark = markData.BookmarkPicture;
    //        ShowUI();
    //    }
    //}

    //书签的构造函数
    //public BookMark(string _id,string _name,byte[] _ImageMark,string  _modelState,string  _btnState,string  _cameraParams)
    //{
    //    id = _id;
    //    ImageMarkByte = _ImageMark;
    //    modelStateByte = _modelState;
    //    btnStateByte = _btnState;
    //    cameraParamsByte = _cameraParams;

    //}


    public void SetMarkData(BookMarkInfo mark_data, bool pc_image)
    {
        markInfo      = mark_data;
        id            = markInfo.id;
        nameText.text = markInfo.bookmarkName;
        //类对象反序列化
        btnState      = (SceneBtnState)Vesal_DirFiles.Bytes2Object(markInfo.btnState);
        modelState    = (SceneModelState)Vesal_DirFiles.Bytes2Object(markInfo.modelState);
        cameraParams  = (CameraParams)Vesal_DirFiles.Bytes2Object(markInfo.cameraParams);
        ImageMarkByte = markInfo.bookmarkPicture;
        is_fix        = (markInfo.type == "0") ?true:false;
        playRecord    = new PlayerCommand(modelState, btnState, cameraParams);
        ShowUI(pc_image);
    }
    //截屏操作
    IEnumerator ScreenShotCut()
    {
        Vesal_DirFiles.DelFile(PublicClass.filePath + "share.png");
        //添加水印,截屏完成后,自动调用分享界面
#if UNITY_EDITOR
        ScreenCapture.CaptureScreenshot(PublicClass.filePath + "share.png");
        yield return(new WaitForSeconds(0.7f));
#else
        //截屏获取图片
        ScreenCapture.CaptureScreenshot("share.png");      //截屏
        while (true)
        {
            if (!File.Exists(PublicClass.filePath + "share.png"))
            {
                yield return(null);
            }
            else
            {
                break;
            }
        }
#endif
        yield return(null);

        Debug.Log("截屏完成 shot completed");

        DrawLinePanel.SetActive(true);
        ShareUsed.SetActive(false);
        Debug.Log(PublicClass.filePath + "share.png");
        JObject data_obj = new JObject();
        data_obj["PicturePath"] = PublicClass.filePath + "share.png";
        //UnityMessageManager.Instance.SendMessageToRN(new UnityMessage()
        //{
        //    name = "share",
        //    data = data_obj,
        //    callBack = (data) => { DebugLog.DebugLogInfo("message : " + data); }
        //});



        // Logo.gameObject.SetActive(true);
        // Application.CaptureScreenshot(ScreenshotName);      //截屏
        // yield return new WaitForSeconds(0.7f);              //等待
        // Debug.Log("截屏完成");
        // Logo.gameObject.SetActive(false);
        //_text.text = "截屏完成";
        //_text.color = new Color(0,0,0,1);
        //_text.CrossFadeAlpha(0f, 0.3f, true);//淡入
        //_text.CrossFadeAlpha(4f, 1f, true);//淡出
    }
Exemple #13
0
 void UnZip(string filePath, Action call)
 {
     if (File.Exists(filePath))
     {
         StartCoroutine(Vesal_DirFiles.unzipInThread(filePath, Vesal_DirFiles.get_dir_from_full_path(filePath), () => {
             call();
             Vesal_DirFiles.DelFile(filePath);
         }));
     }
     else
     {
         call();
     }
 }
Exemple #14
0
    public static void SplitByte()
    {
        PublicClass.InitStaticData();
        string        db_path  = PublicClass.filePath + "Mediacl/RA0901001_1/";
        List <string> namelist = new List <string>();

        namelist.AddRange(Vesal_DirFiles.GetAllDirInfoFromPath(db_path));
        Debug.Log(db_path);
        for (int i = 0; i < namelist.Count; i++)
        {
            Debug.Log(namelist[i]);
            Vesal_DirFiles.SaveAbfile(namelist[i], PublicClass.filePath + Vesal_DirFiles.get_file_name_from_full_path(namelist[i]), false, false);
        }
    }
Exemple #15
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));
    }
Exemple #16
0
    void count_stream_copy()
    {
        stream_copy_count++;
        if (stream_copy_count >= stream_copy_list.Count)
        {
            PublicClass.DataManagerStatus = DataIntState.FetchDb;
            PublicTools.save_version_to_file(PublicClass.filePath + "version.dat", PublicClass.get_assets_version());
        }
        else
        {
            string source = stream_copy_list[stream_copy_count];
            string target = PublicClass.filePath + copy_list[stream_copy_count];

            StartCoroutine((Vesal_DirFiles.Vesal_FileCopy(source, target, count_stream_copy)));
        }
    }
    /// <summary>
    /// 解压缩文件并返回临时文件夹路径
    /// </summary>
    /// <param name="filePath"></param>
    /// <returns></returns>
    public string extractFile(string filePath)
    {
        Vesal_DirFiles.UnZip(filePath, TempFilePath);
        DirectoryInfo di = new DirectoryInfo(TempFilePath);

        try
        {
            return(di.GetDirectories()[0].FullName);
        }
        catch (Exception e)
        {
            Debug.Log(e.Message);
        }

        return(string.Empty);
    }
Exemple #18
0
 public static void InitDirFiles()
 {
     Vesal_DirFiles.CreateDir(PublicClass.filePath);
     Vesal_DirFiles.CreateDir(PublicClass.tempPath);
     Vesal_DirFiles.CreateDir(PublicClass.vesal_db_path);
     Vesal_DirFiles.CreateDir(PublicClass.sign_texture_path);
     Vesal_DirFiles.CreateDir(PublicClass.UpdatePath);
     Vesal_DirFiles.CreateDir(PublicClass.SignPath);
     Vesal_DirFiles.CreateDir(PublicClass.ModelPath);
     Vesal_DirFiles.CreateDir(PublicClass.MedicalPath);
     Vesal_DirFiles.CreateDir(PublicClass.xluaPath);
     Vesal_DirFiles.CreateDir(PublicClass.Anim_TimelinePath);
     Vesal_DirFiles.CreateDir(PublicClass.Video_path);
     Vesal_DirFiles.CreateDir(PublicClass.WeiKePlayer_path);
     // DebugLog.DebugLogInfo("---------------设备内存-------------------" + mem);
     Vesal_DirFiles.CreateDir(PublicClass.BookMarkPath);
 }
Exemple #19
0
    //下载切换
    void DownSwitch()
    {
        string tmpName = Ready_Download_list[ndr].name;
        string tmpUrl  = Ready_Download_list[ndr].url;//+ "?v=" + System.DateTime.Now;

        string filePath;

        switch (Ready_Download_list[ndr].type.ToLower())
        {
        case "anim_ab":
            filePath = PublicClass.Anim_TimelinePath + tmpName;
            PublicClass.Anim_ABPath = filePath;
            break;

        case "ab":
            filePath = PublicClass.filePath + tmpName;
            break;

        case "db":
            filePath = PublicClass.vesal_db_path + tmpName;
            break;

        case "update":
            filePath = PublicClass.filePath + tmpName;
            break;

        case "lua":
            filePath = PublicClass.filePath + tmpName;
            Vesal_DirFiles.ClearFolder(PublicClass.xluaPath);
            break;

        default:
            filePath = PublicClass.filePath + tmpName;
            break;
        }


        Debug.Log("当前下载资源:" + tmpName + " 路径:" + tmpUrl + "version " + Ready_Download_list[ndr].version);
        Vesal_DirFiles.DelFile(filePath);

        if (!http.DownLoad(tmpUrl, filePath, Download, Download_error))
        {
            Unity_Tools.ui_return_to_platform();
            Application.Quit(); //下载过程中,连接断开,重连失败
        }
    }
Exemple #20
0
 void Create_assets_path()
 {
     model_path       = PublicClass.filePath + "model/";
     sign_path        = PublicClass.filePath + "sign/";
     sign_ssp_path    = PublicClass.filePath + "sign_ssp_path/";
     acu_path         = PublicClass.filePath + "acu_path/";
     WeiKePlayer_path = PublicClass.filePath + "microlesson/";
     game_path        = PublicClass.filePath + "game/";
     QA_path          = PublicClass.filePath + "qa/";
     //生成资源文件夹
     Vesal_DirFiles.CreateDir(QA_path);
     Vesal_DirFiles.CreateDir(model_path);
     Vesal_DirFiles.CreateDir(sign_ssp_path);
     Vesal_DirFiles.CreateDir(sign_path);
     Vesal_DirFiles.CreateDir(WeiKePlayer_path);
     Vesal_DirFiles.CreateDir(game_path);
     Vesal_DirFiles.CreateDir(acu_path);
 }
Exemple #21
0
    void DownloadFileCompleted(object sender, DownloadFileCompletedArgs eventArgs)
    {
        if (eventArgs.State == CompletedState.Succeeded && eventArgs.BytesReceived == eventArgs.BytesTotal)
        {
            //download completed
            vesal_log.vesal_write_log("completed file percent:" + eventArgs.DownloadProgress);
            vesal_log.vesal_write_log("bytes:" + eventArgs.BytesReceived.ToString() + "::" + eventArgs.BytesTotal);

            string suffix = Vesal_DirFiles.get_name_suffix(savepath);

            if (suffix == "assetbundle")
            {
//                state = "saveab";
                abfile_process();
            }
            else if (suffix.ToLower() == "zip")
            {
//                state = "zip";
                unzip_process();
            }
            else
            {
                File.Move(temppath, savepath);
                if (succes_method != null)
                {
                    succes_method();
                }
            }
        }
        else
        {
            vesal_log.vesal_write_log("download fail:" + eventArgs.DownloadProgress);
            //download failed
            Vesal_DirFiles.DelFile(temppath);
            if (fail_method != null)
            {
                fail_method(eventArgs.Error);
            }
        }
        if (fileDownloader != null)
        {
            fileDownloader.Dispose();
        }
    }
    /// <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));
            }
        }
    }
Exemple #23
0
        string Read()
        {
            string        target_file = PublicClass.fileLocalStreamingPath + "server_ip.txt";
            List <string> tempList    = Vesal_DirFiles.ReadFileWithLine(target_file);
            string        str         = "";

            for (int i = 0; i < tempList.Count; i++)
            {
                str += tempList[i];
            }
            if (str.Contains("server"))
            {
                return(str.Split('s')[0]);
            }
            else
            {
                return(str.Split('c')[0]);
            }
        }
Exemple #24
0
    /// <summary>
    /// 执行新的命令
    /// </summary>
    public void ExecutiveCommand(BaseCommand command)
    {
        if (CloseCommandCompent)
        {
            return;
        }
        indexId++;
        CommandList db_command = new CommandList
        {
            id        = indexId,
            modelInfo = Vesal_DirFiles.Object2Bytes(new SceneModelState()),
        };

        local_db.DataService("Command.db");
        local_db.Insert(db_command);
        local_db.Close();
        DebugLog.DebugLogInfo("插入命令 " + indexId);
        command.ExecuteCommand();
        this.CanOperaCommand(true);
    }
Exemple #25
0
    /// <summary>
    /// 开始时加载题库列表
    /// </summary>
    void Start()
    {
        if (selectClassId != string.Empty)
        {
            if (GlobalVariable.practiceState == PracticeState.classes)
            {
                initClassInfo();
                GlobalVariable.bankName = "classId_" + selectClassId + "_QAXML";
                Debug.Log(GlobalVariable.bankName);
            }
            else if (GlobalVariable.practiceState == PracticeState.errors)
            {
                GlobalVariable.bankName = "classId_" + selectClassId + "_Error_QAXML";
                Debug.Log(GlobalVariable.bankName);
            }
            this.transform.GetComponent <StartPanel>().changeBankName();
        }
        else
        {
            //正常加载QA系统 , 初始化题库旋转列表
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc = Vesal_DirFiles.loadXml(currentQaPath, GlobalVariable.bankName + ".xml");

            if (xmlDoc == null)
            {
                Debug.Log("BankScriControl missing Xml");
                return;
            }
            string      xPath = "//banks";
            XmlNodeList node  = xmlDoc.SelectSingleNode(xPath).ChildNodes;

            foreach (XmlElement nodeElement in node)
            {
                InstantiateList(nodeElement["bankName"].InnerText,
                                nodeElement["tips"].InnerText,
                                nodeElement["fileName"].InnerText);
            }
            //获得班级题库
            // StartCoroutine(getClassInfo());
        }
    }
Exemple #26
0
    public bool abfile_process()
    {
        vesal_log.vesal_write_log("--ab file start  ");

        thread = new Thread(delegate()
        {
            vesal_log.vesal_write_log("-- ab ss");
            Vesal_DirFiles.SaveAbfile(temppath, savepath, false);
            vesal_log.vesal_write_log("-- ab end");
            if (succes_method != null)
            {
                succes_method();
            }
        });
        //开启子线程
        thread.IsBackground = true;
        thread.Start();
        vesal_log.vesal_write_log("-- ab thread started");

        return(true);
    }
Exemple #27
0
        string GetRole()
        {
            string target_file = PublicClass.fileLocalStreamingPath + "server_ip.txt";

            Debug.Log("server_ip info path " + target_file);
            List <string> tempList = Vesal_DirFiles.ReadFileWithLine(target_file);
            string        str      = "";

            for (int i = 0; i < tempList.Count; i++)
            {
                str += tempList[i];
            }
            if (str.Contains("server"))
            {
                return("server");
            }
            else
            {
                return("client");
            }
        }
Exemple #28
0
    public bool DownLoad(string downUrl, string savePath, Action callBack = null, Action <Exception> errorCallBack = null, bool NameSubDir = false)
    {
        state          = "download";
        sameNameSubDir = NameSubDir;
        vesal_log.vesal_write_log("-- download: " + downUrl + savePath);
        savepath = savePath;
        temppath = savepath + ".temp";
        string suffix = Vesal_DirFiles.get_name_suffix(savepath);

        if (suffix.ToLower() == "zip")
        {
            isZipFile = true;
        }
        Vesal_DirFiles.DelFile(temppath);
        if (callBack != null)
        {
            succes_method = callBack;
        }
        if (errorCallBack != null)
        {
            fail_method = errorCallBack;
        }
        try
        {
            Uri      url = new Uri(downUrl);
            TimeSpan x   = new TimeSpan(0, 0, 8);
            fileDownloader                          = new FileDownloader.FileDownloader();
            fileDownloader.MaxAttempts              = 10;
            fileDownloader.SafeWaitTimeout          = x;
            fileDownloader.DownloadProgressChanged += DownLoadFileChanged;
            fileDownloader.DownloadFileCompleted   += DownloadFileCompleted;
            fileDownloader.DownloadFileAsync(url, temppath);
            vesal_log.vesal_write_log("-- downalod asy started");
        }
        catch
        {
            return(false);
        }
        return(true);
    }
Exemple #29
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>();
    }
Exemple #30
0
    /// <summary>
    /// 撤销上一个命令
    /// </summary>
    public void RevocationCommand()
    {
        if (CloseCommandCompent)
        {
            return;
        }
        if (indexId >= 0)
        {
            local_db.DataService("Command.db");

            CommandList popDocument = local_db.SelectOne <CommandList>((temp_command) =>
            {
                if (indexId == temp_command.id)
                {
                    DebugLog.DebugLogInfo("查询数据:" + indexId);
                    return(true);
                }
                else
                {
                    return(false);
                }
            });

            try
            {
                SceneModelState modelstaste = (SceneModelState)Vesal_DirFiles.Bytes2Object(popDocument.modelInfo);
                PlayerCommand   command     = new PlayerCommand(modelstaste);
                command.RevocationCommand();
            }
            catch
            {
                // Debug.LogError("命令记录不存在 id :"+id);
            }
            DebugLog.DebugLogInfo("删除数据:" + indexId);
            local_db.Delete(popDocument);
            local_db.Close();
            indexId--;
            this.CanOperaCommand(indexId != 0);
        }
    }