예제 #1
0
 private void OnGUI()
 {
     if (Event.current.Equals(Event.KeyboardEvent("escape")))
     {
         DefaultUI.SetActive(!DefaultUI.gameObject.activeSelf);
         EvolutionUI.SetActive(!EvolutionUI.gameObject.activeSelf && EvolutionManager.Instance != null);
     }
 }
예제 #2
0
 private void Awake()
 {
     instance = this;
     if (child_background != null && child_background.activeSelf != active)
     {
         child_background.SetActive(active);
     }
 }
예제 #3
0
        // ______________________________ Section 5 ________________________________
        //
        //   Unity Built-in Methods
        // _________________________________________________________________________
        #region
        private void Awake()
        {
            // Find Query Model Canvas Group, if model querying is enabled in Inspector
            if (useModelExploration)
            {
                queryModel = FindObjectOfType <QueryModel>(true);
                if (queryModel == null)
                {
                    ModelExplorerPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(modelExplorerPath);
                    if (ModelExplorerPrefab != null)
                    {
                        queryModel = Instantiate(ModelExplorerPrefab).GetComponent <QueryModel>();
                    }
                    else
                    {
                        Debug.LogError(string.Format("Prefab not found at: {0}. Please Manually add the ModelExploreInterface prefab to use model exploration.", modelExplorerPath));
                    }
                    Debug.Log("No Query Model game object detected in scene. Loading default ModelExploreInterface Prefab.");
                }

                // Add Event System if there isn't one already
                if (FindObjectOfType <EventSystem>() == null)
                {
                    new GameObject("EventSystem", typeof(EventSystem), typeof(StandaloneInputModule));
                }
            }
            // Find client within Unity scene
            client = FindObjectOfType <AEPsychClient>();
            if (client == null)
            {
                Debug.LogError("AEPsych Client is missing. Please add the AEPsych " +
                               "Client to the scene and ensure that it is enabled.");
                TerminateExperiment();
            }
            configGenerator = GetComponent <ConfigGenerator>();
            if (configGenerator == null)
            {
                Debug.LogError("Experiement script running without a ConfigGenerator attached. " +
                               "Please attach a ConfigGenerator component to " + GetName());
                TerminateExperiment();
            }
            if (configGenerator.isAutomatic)
            {
                //AEPsychClient.Log("Automatic Config Generated:\n" + PlayerPrefs.GetString(configGenerator.experimentName + "config"));
                AEPsychClient.Log("Automatic Config Generated:\n" + configGenerator.GetConfigText());
            }
            if (useDefaultUI)
            {
                defaultUI = FindObjectOfType <DefaultUI>();
                if (defaultUI == null)
                {
                    Debug.LogError("Using default UI, but DefaultUI not found in scene. " +
                                   "Please add the DefaultUI component to your scene or uncheck \"Use " +
                                   "Default UI\" for your Experiment.");
                    TerminateExperiment();
                }
            }
        }
예제 #4
0
    void TryToInit()
    {
        InitLoaderLib();
        if (Application.internetReachability != NetworkReachability.NotReachable)
        {
            var checkTimeout = new CheckTimeout();
            DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(13).content);//正在检查网络
            checkTimeout.AsynIsNetworkTimeout((result) =>
            {
                Invoke(() =>
                {
                    if (result)
                    {
                        DoInit();
                    }
                    else
                    {
                        ForwardLoadingMsgBox.Instance.ShowRetryMsgBox(DefaultUI.dataMap[52].content, (isOk) =>
                        {
                            if (isOk)
                            {
                                TryToInit();
                            }
                            else
                            {
                                Application.Quit();
                            }
                        });
                    }
                });
            });
        }
        else
        {
            var languageData = DefaultUI.dataMap;
            ForwardLoadingMsgBox.Instance.ShowMsgBox(languageData[50].content, languageData[51].content, languageData[52].content, (OnOkButton) =>
            {
                if (OnOkButton)
                {
                    ForwardLoadingMsgBox.Instance.Hide();
                    TryToInit();
                }
                else
                {
#if UNITY_ANDROID && !UNITY_EDITOR
                    AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                    AndroidJavaObject m_mainActivity = jc.GetStatic <AndroidJavaObject>("currentActivity");
                    m_mainActivity.Call("gotoNetworkSetting");
#endif
                }
            });
        }
    }
예제 #5
0
    void InitConfig()
    {
        DefaultUI.InitLanguageInfo();
        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);//数据读取中…
        var loadCfgSuccess = SystemConfig.Init();

        VersionManager.Instance.Init();
        VersionManager.Instance.LoadLocalVersion();
        SystemConfig.LoadServerList();
        PluginCallback.Instance.ShowGlobleLoadingUI = MogoForwardLoadingUIManager.Instance.ShowGlobleLoadingUI;
        PluginCallback.Instance.SetLoadingStatus    = MogoForwardLoadingUIManager.Instance.SetLoadingStatus;
        PluginCallback.Instance.SetLoadingStatusTip = MogoForwardLoadingUIManager.Instance.SetLoadingStatusTip;
        PluginCallback.Instance.ShowRetryMsgBox     = GameObject.Find("MogoDefaultUI/DefaultUICamera2/Anchor").GetComponent <ForwardLoadingMsgBox>().ShowRetryMsgBox;
        PluginCallback.Instance.ShowMsgBox          = GameObject.Find("MogoDefaultUI/DefaultUICamera2/Anchor").GetComponent <ForwardLoadingMsgBox>().ShowMsgBox;
        PluginCallback.Instance.Hide   = GameObject.Find("MogoDefaultUI/DefaultUICamera2/Anchor").GetComponent <ForwardLoadingMsgBox>().Hide;
        PluginCallback.Instance.IsHide = GameObject.Find("MogoDefaultUI/DefaultUICamera2/Anchor").GetComponent <ForwardLoadingMsgBox>().IsHide;
    }
예제 #6
0
    void Awake()
    {
#if !UNITY_EDITOR
        LoggerHelper.CurrentLogLevels = LogLevel.INFO | LogLevel.ERROR | LogLevel.CRITICAL | LogLevel.EXCEPT;// | LogLevel.WARNING
#endif
        //Debug.LogInfo("------Game Start!--------");
        SystemSwitch.InitSystemSwitch();
        Screen.sleepTimeout = (int)SleepTimeout.NeverSleep;
        DontDestroyOnLoad(transform.gameObject);
        Instance = this;
        gameObject.AddComponent <DriverLib>();
        Application.targetFrameRate = 30;
        DefaultUI.InitLanguageInfo();
        GameObject.Find("MogoForwardLoadingUIPanel").AddComponent <MogoForwardLoadingUIManager>();
        TryToInit();
        InvokeRepeating("Tick", 1, 0.02f);
        gameObject.AddComponent <AudioListener>();
    }
예제 #7
0
    public void CheckVersionFinish()
    {
        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);//数据读取中
        SystemConfig.LoadServerList();
#if UNITY_ANDROID
        LoadLib();
#endif
#if UNITY_EDITOR
        gameObject.AddComponent("MogoInitialize");
        gameObject.AddComponent("TestUI");
#else
        if (SystemSwitch.ReleaseMode)
        {
            gameObject.AddComponent <StreamingAssetCacheManager>();
            StreamingAssetCacheManager.Instance.Export();
        }
#endif
    }
예제 #8
0
    public void CheckVersionFinish()
    {
        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);//数据读取中
        SystemConfig.LoadServerList();
#if UNITY_ANDROID
        LoadLib();
#endif
#if UNITY_EDITOR
        var t1 = System.Type.GetType("MogoInitialize,Assembly-CSharp");
        var addedComponent1 = gameObject.AddComponent(t1);
        var t2 = System.Type.GetType("TestUI,Assembly-CSharp");
        var addedComponent2 = gameObject.AddComponent(t2);
        //gameObject.AddComponent(System.Type.GetType("MogoInitialize"));
        //gameObject.AddComponent(System.Type.GetType("TestUI"));
        //UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(gameObject, "Assets/Plugins/Init/Driver.cs (202,9)", "MogoInitialize");
        //UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(gameObject, "Assets/Plugins/Init/Driver.cs (203,9)", "TestUI");
#else
        if (SystemSwitch.ReleaseMode)
        {
            gameObject.AddComponent <StreamingAssetCacheManager>();
            StreamingAssetCacheManager.Instance.Export();
        }
#endif
    }
예제 #9
0
    void CheckVersion(Action callback)
    {
#if UNITY_EDITOR
        ResourceIndexInfo.Instance.Init(Application.streamingAssetsPath + "/ResourceIndexInfo.txt", () =>
        {
            if (ResourceIndexInfo.Instance.Exist())
            {
                var localVer     = Utils.LoadFile(SystemConfig.VersionPath);
                var localVersion = VersionManager.Instance.GetVersionInXML(localVer);
                var pkgVer       = Resources.Load(SystemConfig.VERSION_URL_KEY) as TextAsset;
                var pkgVersion   = VersionManager.Instance.GetVersionInXML(pkgVer.text);
                if (pkgVersion.ResouceVersionInfo.Compare(localVersion.ResouceVersionInfo) > 0)
                {
                    if (File.Exists(SystemConfig.VersionPath))
                    {
                        File.Delete(SystemConfig.VersionPath);
                    }
                    var mogoResroucesPath = SystemConfig.ResourceFolder.Substring(0, SystemConfig.ResourceFolder.Length - 1);
                    if (Directory.Exists(mogoResroucesPath))
                    {
                        Directory.Delete(mogoResroucesPath, true);
                    }
                    if (!File.Exists(SystemConfig.VersionPath))
                    {
                        var ver = Resources.Load(SystemConfig.VERSION_URL_KEY) as TextAsset;
                        if (ver != null)
                        {
                            XMLParser.SaveText(SystemConfig.VersionPath, ver.text);
                        }
                    }
                }
            }
            var go         = new StreamingAssetManager();
            go.AllFinished = () =>
            {
                MogoFileSystem.Instance.Init();
                Action <bool> fileDecompress = (finish) =>
                {
                    Driver.Invoke(() =>
                    {
                        if (finish)
                        {
                            DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(3).content);//正在更新本地文件
                        }
                        else
                        {
                            DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);//恢复成“数据读取中”
                        }
                    });
                };
                Action <int, int, string> taskProgress = (total, index, filename) =>
                {
                    Driver.Invoke(() =>
                    {
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(2).content, index + 1, total, filename);
                    });
                };
                Action <int, long, long> progress = (ProgressPercentage, TotalBytesToReceive, BytesReceived) =>
                {
                    Driver.Invoke(() => { DefaultUI.Loading(ProgressPercentage); });
                };
                Action <Exception> error = (ex) =>
                {
                    ForwardLoadingMsgBox.Instance.ShowRetryMsgBox(DefaultUI.dataMap[54].content, (isOk) =>
                    {
                        if (isOk)
                        {
                            CheckVersion(callback);
                        }
                        else
                        {
                            Application.Quit();
                        }
                    });
                    Debug.LogException(ex);
                };
                DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(1).content);
                VersionManager.Instance.CheckVersion(fileDecompress, taskProgress, progress, () => { Driver.Invoke(callback); }, error);
            };
            go.FirstExport();
        });
#else
        callback();
#endif
    }
예제 #10
0
    void InitMogoFile(Action <int> loading, Action finished)
    {
        var fileName = "pkg";
        var target   = SystemConfig.ResourceFolder + fileName;

        if (File.Exists(SystemConfig.VersionPath) && File.Exists(target))//pkg文件存在以及版本文件存在才不拷出来,如果只是pkg文件存在,有可能pkg文件不完整
        {
            var localVer     = Utils.LoadFile(SystemConfig.VersionPath);
            var localVersion = VersionManager.Instance.GetVersionInXML(localVer);

            var pkgVer     = Resources.Load(SystemConfig.VERSION_URL_KEY) as TextAsset;
            var pkgVersion = VersionManager.Instance.GetVersionInXML(pkgVer.text);

            if (pkgVersion.ResouceVersionInfo.Compare(localVersion.ResouceVersionInfo) > 0)
            {
                File.Delete(target);
                File.Delete(SystemConfig.VersionPath);
            }
            else
            {
                if (finished != null)
                {
                    finished();
                }
                return;
            }
        }
        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(0).content);//游戏初次运行初始化中,时间较长,请耐心等待…
        Directory.CreateDirectory(SystemConfig.ResourceFolder);
        //var pkg = Resources.Load(fileName) as TextAsset;
        //if (pkg != null)
        //    XMLParser.SaveBytes(target, pkg.bytes);

        var pkgPath = Application.streamingAssetsPath + "/" + fileName;

        if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
        {
            pkgPath = "File://" + pkgPath;
        }

        StartCoroutine(LoadWWW(pkgPath, (www) =>
        {
            StartCoroutine(Loading(www, (p) =>
            {
                if (loading != null)
                {
                    loading((int)(p * 30));//硬编码获取文件占进度前30%
                }
            }));
        }, (pkg) =>
        {
            //if (loading != null)
            //    loading(1);
            if (pkg != null && pkg.Length != 0)
            {
                Action action = () =>
                {
                    //保存文件
                    MemoryStream stream = new MemoryStream(pkg);
                    stream.Seek(0, SeekOrigin.Begin);
                    byte[] data   = new byte[2048];
                    var pkgLength = pkg.Length;
                    using (FileStream streamWriter = File.Create(target))
                    {
                        int bytesRead;
                        long bytesTotalRead = 0;
                        while ((bytesRead = stream.Read(data, 0, data.Length)) > 0)
                        {
                            streamWriter.Write(data, 0, bytesRead);
                            bytesTotalRead += bytesRead;
                            //Debug.Log("bytesTotalRead: " + bytesTotalRead + " bytesRead: " + bytesRead);
                            if (loading != null)
                            {
                                Invoke(() => loading(30 + (int)((bytesTotalRead * 70) / pkgLength)));//硬编码存储文件占进度后70%
                            }
                        }
                    }
                    //XMLParser.SaveBytes(target, pkg);
                    Invoke(() =>
                    {
                        Debug.Log("Save pkg, size: " + pkg.Length);
                        if (!File.Exists(SystemConfig.VersionPath))
                        {
                            var ver = Resources.Load(SystemConfig.VERSION_URL_KEY) as TextAsset;
                            if (ver != null)
                            {
                                XMLParser.SaveText(SystemConfig.VersionPath, ver.text);
                            }
                        }
                        pkg = null;
                        GC.Collect();
                        if (finished != null)
                        {
                            finished();
                        }
                    });
                };
                action.BeginInvoke(null, null);
            }
            else
            {
                Debug.LogWarning("Save pkg error.");
                if (finished != null)
                {
                    finished();
                }
            }
        }));
    }
예제 #11
0
    void CheckVersion(Action finished)
    {
        if (SystemSwitch.ReleaseMode)
        {
            //添加一个处理解压文件时的界面提示回调,解压前开始提示,解压后恢复
            Action <bool> fileDecompress = (finish) =>
            {
                Driver.Invoke(() =>
                {
                    if (finish)
                    {
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(3).content);//正在更新本地文件
                    }
                    else
                    {
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);//恢复成“数据读取中”
                    }
                });
            };
            //第一个参数是总任务数,第二参数是已经完成的任务
            Action <int, int, string> taskProgress = (total, index, filename) =>
            {
                Driver.Invoke(() =>
                {
                    DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(2).content, index + 1, total, filename);
                });
            };
            Action <int, long, long> progress = (ProgressPercentage, TotalBytesToReceive, BytesReceived) =>
            {
                Driver.Invoke(() => { DefaultUI.Loading(ProgressPercentage); });
            };
            Action <Exception> error = (ex) =>
            {
                ForwardLoadingMsgBox.Instance.ShowRetryMsgBox(DefaultUI.dataMap[54].content, (isOk) =>
                {
                    if (isOk)
                    {
                        CheckVersion(finished);
                    }
                    else
                    {
                        Application.Quit();
                    }
                });
                Debug.LogException(ex);
            };

            DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(1).content);
            //版本检查
            if (SystemSwitch.ReleaseMode)
            {
                VersionManager.Instance.CheckVersion(fileDecompress, taskProgress, progress, () => { Driver.Invoke(finished); }, error);
            }
            else
            {
                finished();
            }
        }
        else
        {
            finished();
        }
    }
예제 #12
0
    void DoInit()
    {
        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);//数据读取中…
        var loadCfgSuccess = SystemConfig.Init();

        if (!loadCfgSuccess)
        {
            ForwardLoadingMsgBox.Instance.ShowRetryMsgBox(DefaultUI.dataMap[53].content, (isOk) =>
            {
                if (isOk)
                {
                    DoInit();
                }
                else
                {
                    Application.Quit();
                }
            });
            return;
        }
        if (SystemSwitch.ReleaseMode)
        {
            //第一次导出资源
            ResourceIndexInfo.Instance.Init(Application.streamingAssetsPath + "/ResourceIndexInfo.txt", () =>
            {
                //如果是完整包(判断ResourceIndexInfo.txt是否存在),再判断apk的资源版本是否比本地资源版本高,如果高删除MogoResource和version.xml
                if (ResourceIndexInfo.Instance.Exist())
                {
                    Debug.Log("-------------------------Exist ResourceIndexInfo.txt--------------------------");
                    var localVer     = Utils.LoadFile(SystemConfig.VersionPath);
                    var localVersion = VersionManager.Instance.GetVersionInXML(localVer);

                    var pkgVer     = Resources.Load(SystemConfig.VERSION_URL_KEY) as TextAsset;
                    var pkgVersion = VersionManager.Instance.GetVersionInXML(pkgVer.text);
                    if (pkgVersion.ResouceVersionInfo.Compare(localVersion.ResouceVersionInfo) > 0)
                    {
                        //删除version.xml
                        if (File.Exists(SystemConfig.VersionPath))
                        {
                            File.Delete(SystemConfig.VersionPath);
                        }
                        //删除MogoResource文件夹
                        var mogoResroucesPath = SystemConfig.ResourceFolder.Substring(0, SystemConfig.ResourceFolder.Length - 1);
                        if (Directory.Exists(mogoResroucesPath))
                        {
                            Directory.Delete(mogoResroucesPath, true);
                        }
                        //删除后再导出version
                        if (!File.Exists(SystemConfig.VersionPath))
                        {
                            var ver = Resources.Load(SystemConfig.VERSION_URL_KEY) as TextAsset;
                            if (ver != null)
                            {
                                XMLParser.SaveText(SystemConfig.VersionPath, ver.text);
                            }
                        }
                    }
                }
                var go         = new StreamingAssetManager();
                go.AllFinished = () =>
                {
                    Debug.Log("firstExport finish,start checkversion");
                    if (SystemSwitch.UseFileSystem)
                    {
                        try
                        {
                            MogoFileSystem.Instance.Init();
                        }
                        catch (Exception ex)
                        {
                            Debug.LogException(ex);
                        }
                    }
                    VersionManager.Instance.Init();
                    VersionManager.Instance.LoadLocalVersion();
                    CheckVersion(CheckVersionFinish);
                };
                go.FirstExport();
            });
        }
        else
        {
            SystemConfig.LoadServerList();
            VersionManager.Instance.Init();
            VersionManager.Instance.LoadLocalVersion();
            //UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(gameObject, "Assets/Plugins/Init/Driver.cs (187,13)", "MogoInitialize");
            //if (ass.GetType("MogoInitialize") != null)
            //gameObject.AddComponent(ass.GetType("MogoInitialize"));
            var t = System.Type.GetType("MogoInitialize,Assembly-CSharp");
            var addedComponent = gameObject.AddComponent(t);
            IsRunOnAndroid = false;
            gameObject.AddComponent <PlatformSdkManager>();
        }
    }
예제 #13
0
    IEnumerator ExportAll(string[] paths)
    {
        if (paths.Length == 1)
        {
            LoggerHelper.Debug("ExportAll one");
            //只有一个文件要导出时,一般是大文件,要单独处理进度条
            string fullpath = null;
            string s        = paths[0];
            string target   = String.Concat(SystemConfig.ResourceFolder, s);
            LoggerHelper.Debug("export target:" + target);
            if (!File.Exists(target))
            {
                LoggerHelper.Debug("target not exit");
                fullpath = Utils.GetStreamPath(s);
                DriverLib.Instance.StartCoroutine(LoadWWW(fullpath,
                                                          (www) =>
                {
                    DriverLib.Instance.StartCoroutine(
                        Loading(www, (p) =>
                    {
                        DefaultUI.Loading((int)(p));
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(4).content);
                    })
                        );
                },
                                                          (pkg) =>
                {
                    if (pkg != null && pkg.Length != 0)
                    {
                        tempFile = target + "_temp";
                        XMLParser.SaveBytes(tempFile, pkg);
                        File.Move(tempFile, target);
                        pkg = null;
                    }
                    else
                    {
                        LoggerHelper.Error("export one file not exist: " + fullpath);
                    }

                    allPathes = null;
                    if (AllFinished != null)
                    {
                        LoggerHelper.Debug("导出一个资源AllFinished");
                        AllFinished();
                    }
                    else
                    {
                        LoggerHelper.Debug("导出一个资源AllFinished为null");
                    }
                }
                                                          ));
            }
        }
        else
        {
            LoggerHelper.Debug("ExportAll more than one");
            //文件大于一个时,进度条是文件数量计算的
            while (index < paths.Length)
            {
                string fullpath = null;
                string s        = paths[index++];
                string target   = String.Concat(SystemConfig.ResourceFolder, s);
                if (!File.Exists(target))
                {
                    fullpath = Utils.GetStreamPath(s);
                    WWW www = new WWW(fullpath);
                    yield return(www);

                    if (www.bytes != null && www.bytes.Length != 0)
                    {
                        tempFile = target + "_temp";
                        XMLParser.SaveBytes(tempFile, www.bytes);
                        File.Move(tempFile, target);
                        www = null;
                    }
                    else
                    {
                        LoggerHelper.Error("file not exist: " + fullpath);
                    }
                }
                //else
                //    yield return null;
                //LoggerHelper.Debug("index: " + index);

                if (UpdateProgress)
                {
                    float progress;
                    if (way2Compute)
                    {
                        progress = (float)(index * 100) / (float)taskBatchCount;
                        DefaultUI.Loading((int)(progress));
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(3).content);
                    }
                    else
                    {
                        progress =
                            (float)(((float)(index - (paths.Length - taskBatchCount)) % (float)taskBatchCount) * 100) /
                            (float)taskBatchCount;
                        DefaultUI.Loading((int)(progress));
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get(10).content, Path.GetFileName(s));
                    }
                    DefaultUI.Loading((int)(progress));
                }
            }
            allPathes = null;
            if (AllFinished != null)
            {
                LoggerHelper.Debug("导出资源AllFinished");
                AllFinished();
            }
            else
            {
                LoggerHelper.Debug("导出资源AllFinished为null");
            }
        }
    }
예제 #14
0
    private IEnumerator ExportAll(string[] paths)
    {
        Action <WWW> loading = null;

        if (paths.Length != 1)
        {
            LoggerHelper.Debug("ExportAll more than one", true, 0);
            while (this.index < paths.Length)
            {
                string streamPath        = null;
                string iteratorVariable1 = paths[this.index++];
                string path = SystemConfig.ResourceFolder + iteratorVariable1;
                if (!File.Exists(path))
                {
                    streamPath = Utils.GetStreamPath(iteratorVariable1);
                    WWW iteratorVariable3 = new WWW(streamPath);
                    yield return(iteratorVariable3);

                    if ((iteratorVariable3.get_bytes() != null) && (iteratorVariable3.get_bytes().Length != 0))
                    {
                        this.tempFile = path + "_temp";
                        XMLParser.SaveBytes(this.tempFile, iteratorVariable3.get_bytes());
                        File.Move(this.tempFile, path);
                        iteratorVariable3 = null;
                    }
                    else
                    {
                        LoggerHelper.Error("file not exist: " + streamPath, true);
                    }
                }
                if (this.UpdateProgress)
                {
                    float num;
                    if (this.way2Compute)
                    {
                        num = ((float)(this.index * 100)) / ((float)this.taskBatchCount);
                        DefaultUI.Loading((int)num);
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get <int, DefaultLanguageData>(3).content, new object[0]);
                    }
                    else
                    {
                        num = ((((float)(this.index - (paths.Length - this.taskBatchCount))) % ((float)this.taskBatchCount)) * 100f) / ((float)this.taskBatchCount);
                        DefaultUI.Loading((int)num);
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get <int, DefaultLanguageData>(10).content, new object[] { Path.GetFileName(iteratorVariable1) });
                    }
                    DefaultUI.Loading((int)num);
                }
            }
            this.allPathes = null;
            if (this.AllFinished != null)
            {
                LoggerHelper.Debug("导出资源AllFinished", true, 0);
                this.AllFinished();
            }
            else
            {
                LoggerHelper.Debug("导出资源AllFinished为null", true, 0);
            }
            yield break;
        }
        Action <byte[]> loaded = null;

        LoggerHelper.Debug("ExportAll one", true, 0);
        string fullpath = null;
        string fileName = paths[0];
        string target   = SystemConfig.ResourceFolder + fileName;

        LoggerHelper.Debug("export target:" + target, true, 0);
        if (!File.Exists(target))
        {
            LoggerHelper.Debug("target not exit", true, 0);
            fullpath = Utils.GetStreamPath(fileName);
            if (loading == null)
            {
                loading = delegate(WWW www) {
                    DriverLib.Instance.StartCoroutine(this.Loading(www, delegate(float p) {
                        DefaultUI.Loading((int)p);
                        DefaultUI.SetLoadingStatusTip(DefaultUI.dataMap.Get <int, DefaultLanguageData>(4).content, new object[0]);
                    }));
                };
            }
            if (loaded == null)
            {
                loaded = delegate(byte[] pkg) {
                    if ((pkg != null) && (pkg.Length != 0))
                    {
                        this.tempFile = target + "_temp";
                        XMLParser.SaveBytes(this.tempFile, pkg);
                        File.Move(this.tempFile, target);
                        pkg = null;
                    }
                    else
                    {
                        LoggerHelper.Error("export one file not exist: " + fullpath, true);
                    }
                    this.allPathes = null;
                    if (this.AllFinished != null)
                    {
                        LoggerHelper.Debug("导出一个资源AllFinished", true, 0);
                        this.AllFinished();
                    }
                    else
                    {
                        LoggerHelper.Debug("导出一个资源AllFinished为null", true, 0);
                    }
                };
            }
            DriverLib.Instance.StartCoroutine(this.LoadWWW(fullpath, loading, loaded));
        }
    }