少年修仙传客户端代码仓库
client_Hale
2019-01-23 73ac8fdd0406946c52a0921d5ccf20dd3a66ca2e
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
2个文件已添加
4个文件已修改
1312 ■■■■ 已修改文件
Core/GameEngine/Login/Launch.cs 1051 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Model/ConfigManager.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Launch/LaunchWin.cs 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Login/ServerListCenter.cs 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Login/ServerListParser.cs 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Login/ServerListParser.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Login/Launch.cs
@@ -10,32 +10,15 @@
public class Launch : MonoBehaviour
{
    static LaunchStage m_CurrentStage = LaunchStage.None;
    static public LaunchStage currentStage { get { return m_CurrentStage; } }
    static float m_Progress = 0f;
    static public float progress {
        get { return m_Progress; }
        set {
            if (m_Progress != value)
            {
                m_Progress = value;
                if (progressEvent != null)
                {
                    progressEvent(m_CurrentStage, m_Progress);
                }
            }
        }
    }
    public static event Action<LaunchStage, float> progressEvent;
    public static ProgressInfo progressInfo { get; private set; }
    private void Awake()
    {
        ResourcesPath.Instance.Init();
        SnxxzGame.Instance.gameObject.name = "__SnxxzGame__";
        Application.backgroundLoadingPriority = ThreadPriority.BelowNormal;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        SDKUtility.Instance.Init();
@@ -139,157 +122,241 @@
        GlobalTimeEvent.Instance.Begin();
    }
    private byte m_Step = 0;
    float timer = 0f;
    float originalExpectTotalTime = 0f;
    float expectTotalTime = 0f;
    public float totalTime {
        get {
            return Mathf.Lerp(originalExpectTotalTime, expectTotalTime, Mathf.Clamp01(timer / expectTotalTime));
        }
    }
    Queue<LaunchTask> tasks = new Queue<LaunchTask>();
    LaunchTask currentTask = null;
    bool launchComplete = false;
    void Start()
    {
        m_Step = 0;
        Application.backgroundLoadingPriority = ThreadPriority.High;
        SoundPlayer.Instance.PlayLoginMusic();
        Config.Instance.PreLoadConfigs();
        WindowCenter.Instance.OpenFromLocal<LaunchWin>();
        SystemSetting.Instance.LetFPSUnLimit();
        Config.Instance.RegisterGlobalEvent();
        PackageRegedit.Init();
        DebugUtility.Instance.CreateDebugRoot();
        StartCoroutine(Co_Lanuch());
        WindowCenter.Instance.OpenFromLocal<LaunchWin>();
        var sdkInitedTask = new SDKInitedTask();
        var assetCopyTask = new AssetCopyTask();
        var assetDecompressTask = new AssetDecompressTask();
        var getVersionInfoTask = new GetVersionInfoTask();
        var checkAssetValidTask = new CheckAssetValidTask();
        var downLoadAssetTask = new DownLoadAssetTask();
        var assetBundleInitTask = new AssetBundleInitTask();
        var configInitTask = new ConfigInitTask();
        var launchFadeOutTask = new LaunchFadeOutTask();
#if !UNITY_EDITOR
        tasks.Enqueue(sdkInitedTask);
#endif
#if UNITY_ANDROID
#if  !UNITY_EDITOR
        tasks.Enqueue(assetCopyTask);
        tasks.Enqueue(assetDecompressTask);
#endif
        tasks.Enqueue(getVersionInfoTask);
#endif
#if UNITY_IOS
        tasks.Enqueue(getVersionInfoTask);
        tasks.Enqueue(assetCopyTask);
#endif
        tasks.Enqueue(checkAssetValidTask);
        tasks.Enqueue(downLoadAssetTask);
        tasks.Enqueue(assetBundleInitTask);
        tasks.Enqueue(configInitTask);
        tasks.Enqueue(launchFadeOutTask);
        CalculateExpectTotalTime();
        originalExpectTotalTime = expectTotalTime;
    }
    void Update()
    {
        if (m_Step == 1)
        timer += Time.deltaTime;
        if (!launchComplete)
        {
            ServerListCenter.Instance.RequestJumpUrl();
            m_Step = 2;
            if (currentTask == null)
            {
                if (tasks.Count > 0)
                {
                    currentTask = tasks.Dequeue();
                    currentTask.Begin();
                }
                else
                {
                    launchComplete = true;
                }
            }
            if (currentTask != null)
            {
                currentTask.Update();
            }
            if (currentTask != null && currentTask.done)
            {
                currentTask.End();
                CalculateExpectTotalTime();
                currentTask = null;
            }
            var progress = Mathf.Lerp(progressInfo.totalProgress, timer / totalTime, 0.5f);
            var partProgress = 0f;
            if (currentTask == null)
            {
                partProgress = 0f;
            }
            else
            {
                var temp = currentTask.timer / Mathf.Min(1f, currentTask.duration);
                partProgress = temp - (int)temp;
            }
            progressInfo = new ProgressInfo(m_CurrentStage, progress, partProgress);
        }
        if (launchComplete)
        {
            Debug.LogFormat("启动耗时:{0}", timer);
            progressInfo = new ProgressInfo(m_CurrentStage, 1f, 1f);
            this.enabled = false;
            StageManager.Instance.LoadLoginStage();
        }
    }
    IEnumerator Co_Lanuch()
    void CalculateExpectTotalTime()
    {
        var startTime = Time.time;
        var progressBuf = progress;
        var timer = 0f;
        var duration = 1f;
#if !UNITY_EDITOR
        while (!SDKUtility.Instance.InitFinished)
        var time = timer;
        foreach (var item in tasks)
        {
            time += item.expectTime;
        }
        expectTotalTime = time;
    }
    public enum LaunchStage
    {
        None = 0,
        SDKInit = 1,
        AssetCopy = 2,
        ClientVersion = 3,
        CheckAsset = 4,
        DownLoad = 5,
        AssetBundleInit = 6,
        ConfigInit = 7,
        Complete = 8,
    }
    public abstract class LaunchTask
    {
        public float timer { get; protected set; }
        public float duration { get; protected set; }
        bool exceptionReported = false;
        public bool done { get; protected set; }
        public float progress { get; protected set; }
        public virtual float expectTime { get; protected set; }
        public abstract void Begin();
        public abstract void Update();
        public abstract void End();
        public void ExceptionReport()
        {
            if (!exceptionReported && timer > 15f && !done)
            {
                var content = string.Format("任务:{0};网络状态:{1}", this.GetType().Name, Application.internetReachability);
                ExceptionCatcher.ReportException("游戏启动执行失败!", content);
                exceptionReported = true;
            }
        }
    }
    public class SDKInitedTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("SDKInitedTask_ExpectTime", 0.5f); }
            protected set { LocalSave.SetFloat("SDKInitedTask_ExpectTime", value); }
        }
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.SDKInit;
            duration = Mathf.Max(0.1f, expectTime);
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
            OperationLogCollect.Instance.RecordLauchEvent(1);
            OperationLogCollect.Instance.RecordEvent(1);
            var cpu = 2;
            var memory = 2048;
            DeviceUtility.GetCpuAndMemory(out cpu, out memory);
            DebugEx.LogFormat("获得机器信息:cpu {0}----内存 {1}", cpu, memory);
            GameNotice.OpenGameNotice();
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
            progress = Mathf.Clamp(progressBuf + timer / duration * 0.1f, progressBuf, progressBuf + 0.1f);
            yield return null;
            if (SDKUtility.Instance.InitFinished)
            {
                done = true;
            }
            else
            {
                done = false;
                progress = timer / duration;
            }
            ExceptionReport();
        }
#endif
    }
        m_Step = 1;
        var cpu = 2;
        var memory = 2048;
        DeviceUtility.GetCpuAndMemory(out cpu, out memory);
    public class AssetCopyTask : LaunchTask
    {
        int completedCount = 0;
        int totalCount = 1;
        List<FileInfo> copyTasks = new List<FileInfo>();
        DebugEx.LogFormat("获得机器信息:cpu {0}----内存 {1}", cpu, memory);
        public override float expectTime {
            get { return LocalSave.GetFloat("AssetCopyTask_ExpectTime", 20f); }
            protected set { LocalSave.SetFloat("AssetCopyTask_ExpectTime", value); }
        }
        OperationLogCollect.Instance.RecordLauchEvent(1);
        OperationLogCollect.Instance.RecordEvent(1);
        SystemSetting.Instance.LetFPSUnLimit();
        Config.Instance.RegisterGlobalEvent();
        PackageRegedit.Init();
        GameNotice.OpenGameNotice();
#if UNITY_ANDROID && !UNITY_EDITOR
        switch (VersionConfig.Get().assetAccess)
        public override void Begin()
        {
            case InstalledAsset.FullAsset:
            case InstalledAsset.HalfAsset:
            case InstalledAsset.IngoreDownLoad:
                progressBuf = progress;
                timer = 0f;
                duration = 30f;
            m_CurrentStage = LaunchStage.AssetCopy;
            duration = Mathf.Max(0.1f, expectTime);
                if (!SDKUtility.Instance.AssetCopyFinished)
                {
                    m_CurrentStage = LaunchStage.AssetCopy;
                    SDKUtility.Instance.CopyAsset();
                    while (!SDKUtility.Instance.AssetCopyFinished)
                    {
                        timer += Time.deltaTime;
                        progress = Mathf.Clamp(progressBuf + timer / duration * 0.7f, progressBuf, progressBuf + 0.7f);
                        yield return null;
                    }
                }
                if (!AssetDeCompressTask.assetDeCompressCompleted)
                {
                    progressBuf = progress;
                    var decompressProgress = AssetDeCompressTask.DecompressAync(ResourcesPath.Instance.ExternalStorePath);
                    while (!decompressProgress.done)
                    {
                        progress = progressBuf + decompressProgress.progress * 0.2f;
                        yield return null;
                    }
                    AssetDeCompressTask.assetDeCompressVersion = VersionConfig.Get().version;
                    progressBuf = progress;
                    timer = 0f;
                    while (timer < 2f)
                    {
                        timer += Time.deltaTime;
                        progress = progressBuf + timer * 0.5f * 0.1f;
                        yield return null;
                    }
                    AssetDeCompressTask.Delete7zFiles(ResourcesPath.Instance.ExternalStorePath);
                }
                break;
            case InstalledAsset.NullAsset:
                progress = 1f;
                break;
        }
#endif
        progress = 0f;
#if UNITY_ANDROID
        m_CurrentStage = LaunchStage.ClientVersion;
        if (!Application.isEditor || InGameDownTestUtility.enable)
        {
            VersionUtility.Instance.RequestVersionCheck();
            progressBuf = progress;
            timer = 0f;
            duration = 1f;
            while (!VersionUtility.Instance.completed)
            {
                timer += Time.deltaTime;
                progress = Mathf.Clamp(progressBuf + timer / duration * 0.1f, progressBuf, progressBuf + 0.1f);
                yield return null;
            }
        }
#endif
#if UNITY_IOS
        if (!VersionUtility.Instance.InIosAuditTime())
        {
            m_CurrentStage = LaunchStage.ClientVersion;
            if (!Application.isEditor || InGameDownTestUtility.enable)
            {
                VersionUtility.Instance.RequestVersionCheck();
                progressBuf = progress;
                timer = 0f;
                duration = 1f;
                while (!VersionUtility.Instance.completed)
                {
                    timer += Time.deltaTime;
                    progress = Mathf.Clamp(progressBuf + timer / duration * 0.1f, progressBuf, progressBuf + 0.1f);
                    yield return null;
                }
            }
        }
#endif
#if UNITY_IOS && !UNITY_EDITOR
        if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
        {
            switch (VersionConfig.Get().assetAccess)
            {
                case InstalledAsset.FullAsset:
@@ -297,168 +364,608 @@
                case InstalledAsset.IngoreDownLoad:
                    if (!SDKUtility.Instance.AssetCopyFinished)
                    {
                        m_CurrentStage = LaunchStage.AssetCopy;
                        progressBuf = progress;
                        var allFiles = new List<FileInfo>();
                        FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, allFiles);
                        var count = allFiles.Count;
                        var index = 0;
                        while (index < count)
                        {
                            try
                            {
                                var fileInfo = allFiles[index];
                                var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
                                if (File.Exists(destPath))
                                {
                                    index++;
                                    continue;
                                }
                                var destDirectoryName = Path.GetDirectoryName(destPath);
                                if (!Directory.Exists(destDirectoryName))
                                {
                                    Directory.CreateDirectory(destDirectoryName);
                                }
                                DebugEx.LogFormat("拷贝文件:{0}", fileInfo.Name);
                                File.Copy(fileInfo.FullName, destPath, true);
                                index++;
                            }
                            catch (Exception ex)
                            {
                                DebugEx.Log(ex);
                            }
                            finally
                            {
                                progress = Mathf.Clamp(progressBuf + ((float)index / count) * 0.3f, progressBuf, progressBuf + 0.3f);
                            }
                            yield return null;
                        }
                        LocalSave.SetString("AssetCopyCompleted_IOS", VersionConfig.Get().version);
                        SDKUtility.Instance.CopyAsset();
                        done = false;
                        progress = 0f;
                    }
                    else
                    {
                        done = true;
                    }
                    break;
                case InstalledAsset.NullAsset:
                    progress = 0.1f;
                    done = true;
                    break;
            }
#endif
#if UNITY_IOS
            if (VersionUtility.Instance.versionInfo != null && VersionUtility.Instance.versionInfo.downAsset == 1)
            {
                switch (VersionConfig.Get().assetAccess)
                {
                    case InstalledAsset.FullAsset:
                    case InstalledAsset.HalfAsset:
                    case InstalledAsset.IngoreDownLoad:
                        if (!SDKUtility.Instance.AssetCopyFinished)
                        {
                            copyTasks = new List<FileInfo>();
                            FileExtersion.GetAllDirectoryFileInfos(ResourcesPath.Instance.StreamingAssetPath, copyTasks);
                            for (var i = copyTasks.Count - 1; i >= 0; i--)
                            {
                                var fileInfo = copyTasks[i];
                                var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
                                if (File.Exists(destPath))
                                {
                                    copyTasks.RemoveAt(i);
                                }
                            }
                            completedCount = 0;
                            totalCount = copyTasks.Count;
                        }
                        if (totalCount > 0)
                        {
                            done = false;
                            progress = 0f;
                        }
                        else
                        {
                            done = true;
                        }
                        break;
                    case InstalledAsset.NullAsset:
                        done = true;
                        break;
                }
            }
            else
            {
                done = true;
            }
#endif
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
#if UNITY_IOS
            LocalSave.SetString("AssetCopyCompleted_IOS", VersionConfig.Get().version);
#endif
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
#if UNITY_ANDROID
            if (!SDKUtility.Instance.AssetCopyFinished)
            {
                done = false;
                progress = timer / duration;
            }
            else
            {
                done = true;
            }
#endif
#if UNITY_IOS
            if (totalCount > 0)
            {
                if (completedCount < totalCount)
                {
                    var fileInfo = copyTasks[0];
                    var destPath = fileInfo.FullName.Replace(ResourcesPath.Instance.StreamingAssetPath, ResourcesPath.Instance.ExternalStorePath);
                    var destDirectoryName = Path.GetDirectoryName(destPath);
                    if (!Directory.Exists(destDirectoryName))
                    {
                        Directory.CreateDirectory(destDirectoryName);
                    }
                    DebugEx.LogFormat("拷贝文件:{0}", fileInfo.Name);
                    File.Copy(fileInfo.FullName, destPath, true);
                    copyTasks.RemoveAt(0);
                    completedCount++;
                    done = false;
                    progress = (float)completedCount / totalCount;
                }
                else
                {
                    done = true;
                }
            }
            else
            {
                done = true;
            }
        }
#endif
            ExceptionReport();
        }
    }
        OperationLogCollect.Instance.RecordLauchEvent(2);
        OperationLogCollect.Instance.RecordEvent(2);
    public class AssetDecompressTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("AssetDecompressTask_ExpectTime", 5f); }
            protected set { LocalSave.SetFloat("AssetDecompressTask_ExpectTime", value); }
        }
        if (VersionUtility.Instance.NeedDownAsset())
        AssetDeCompressTask.DecompressProgress deCompressProgress = null;
        float waitTimer = 0f;
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.AssetCopy;
            duration = Mathf.Max(0.1f, expectTime);
            if (!AssetDeCompressTask.assetDeCompressCompleted)
            {
                deCompressProgress = AssetDeCompressTask.DecompressAync(ResourcesPath.Instance.ExternalStorePath);
                done = false;
            }
            else
            {
                done = true;
            }
        }
        public override void End()
        {
            AssetDeCompressTask.assetDeCompressVersion = VersionConfig.Get().version;
            AssetDeCompressTask.Delete7zFiles(ResourcesPath.Instance.ExternalStorePath);
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
            progress = timer / duration;
            if (deCompressProgress == null || deCompressProgress.done)
            {
                waitTimer += Time.deltaTime;
                if (waitTimer > 2f)
                {
                    done = true;
                }
            }
        }
    }
    public class GetVersionInfoTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("GetVersionInfoTask_ExpectTime", 1f); }
            protected set { LocalSave.SetFloat("GetVersionInfoTask_ExpectTime", value); }
        }
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.ClientVersion;
            duration = expectTime;
#if UNITY_ANDROID
            if (InGameDownTestUtility.enable || !Application.isEditor)
            {
                VersionUtility.Instance.RequestVersionCheck();
                done = false;
                progress = 0f;
            }
            else
            {
                done = true;
            }
#endif
#if UNITY_IOS
            if (!VersionUtility.Instance.InIosAuditTime())
            {
                VersionUtility.Instance.RequestVersionCheck();
                done = false;
                progress = 0f;
            }
            else
            {
                done = true;
            }
#endif
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
            if (!VersionUtility.Instance.completed)
            {
                done = false;
                progress = timer / expectTime;
            }
            else
            {
                done = true;
            }
            ExceptionReport();
        }
    }
    public class CheckAssetValidTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("CheckAssetValidTask_ExpectTime", 3f); }
            protected set { LocalSave.SetFloat("CheckAssetValidTask_ExpectTime", value); }
        }
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.CheckAsset;
            duration = Mathf.Max(0.1f, expectTime);
            ServerListCenter.Instance.RequestJumpUrl();
            OperationLogCollect.Instance.RecordLauchEvent(2);
            OperationLogCollect.Instance.RecordEvent(2);
            if (VersionUtility.Instance.NeedDownAsset())
            {
                AssetVersionUtility.GetAssetVersionFile();
                done = false;
                progress = 0f;
            }
            else
            {
                done = true;
            }
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
            if (!AssetVersionUtility.checkAssetCompleted)
            {
                done = false;
                progress = timer / expectTime;
            }
            else
            {
                done = true;
            }
            ExceptionReport();
        }
    }
    public class DownLoadAssetTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("DownLoadAssetTask_ExpectTime", 3f); }
            protected set { LocalSave.SetFloat("DownLoadAssetTask_ExpectTime", value); }
        }
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.DownLoad;
            progressBuf = progress;
            timer = 0f;
            duration = 1.5f;
            AssetVersionUtility.GetAssetVersionFile();
            while (!AssetVersionUtility.checkAssetCompleted)
            duration = Mathf.Max(0.1f, expectTime);
            if (VersionUtility.Instance.NeedDownAsset())
            {
                timer += Time.deltaTime;
                progress = Mathf.Clamp(progressBuf + timer / duration * 0.3f, progressBuf, progressBuf + 0.3f);
                yield return null;
            }
            if (!AssetVersionUtility.priorAssetDownLoadDone)
            {
                AssetVersionUtility.BeginDownLoadTask(true);
                while (!AssetVersionUtility.priorAssetDownLoadDone)
                if (!AssetVersionUtility.priorAssetDownLoadDone)
                {
                    yield return null;
                    AssetVersionUtility.BeginDownLoadTask(true);
                    done = false;
                    progress = 0f;
                }
                else
                {
                    done = true;
                }
                yield return WaitingForSecondConst.WaitMS200;
            }
            else
            {
                done = true;
            }
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
            if (!AssetVersionUtility.unPriorAssetDownLoadDone)
            {
                AssetVersionUtility.BeginDownLoadTask(false);
            }
        }
        if (!AssetSource.allFromEditor)
        public override void Update()
        {
            StartCoroutine(AssetBundleUtility.Instance.Initialize());
        }
        m_CurrentStage = LaunchStage.ConfigLoad;
        LaunchPostProcess.Instance.Begin();
        progressBuf = progress;
        while (!LaunchPostProcess.Instance.completed
            && LaunchPostProcess.Instance.progress < (Application.platform == RuntimePlatform.WindowsEditor ? 1f : 0.8f))
        {
            progress = Mathf.Clamp(progressBuf + LaunchPostProcess.Instance.progress * (1 - progressBuf), progressBuf, 1f);
            yield return null;
        }
        OperationLogCollect.Instance.RecordLauchEvent(3);
        OperationLogCollect.Instance.RecordEvent(3);
        LuaUtility.Instance.Init();
        CSharpCallLua.Init();
        ShaderUtility.WarmUpAll();
        SpeechTranslate.Instance.RequestGetToken();
        if (!AssetSource.allFromEditor)
        {
            progressBuf = progress;
            timer = 0f;
            duration = 3f;
            while (!AssetBundleUtility.Instance.initialized)
            if (done)
            {
                timer += Time.deltaTime;
                progress = Mathf.Clamp(progressBuf + timer / duration * 0.2f, progressBuf, 1f);
                yield return null;
                return;
            }
            AssetBundleUtility.Instance.Sync_LoadAll("ui/prioritywindow");
            SnxxzGame.Instance.StartCoroutine(AssetBundleUtility.Instance.InitalizeUIResources());
        }
        UI3DModelExhibition.CreateStage();
        var launchWin = WindowCenter.Instance.Get<LaunchWin>();
        if (launchWin != null)
        {
            launchWin.FadeOut();
        }
        WindowCenter.Instance.Open<LaunchBackGroundWin>(true);
        var launchBackGroundWin = WindowCenter.Instance.Get<LaunchBackGroundWin>();
        launchBackGroundWin.transform.SetAsFirstSibling();
        progressBuf = progress;
        timer = 0f;
        duration = 1f;
        while (timer < duration)
        {
            timer += Time.deltaTime;
            progress = Mathf.Clamp(progressBuf + timer / duration, progressBuf, 1f);
            yield return null;
            if (!AssetVersionUtility.priorAssetDownLoadDone)
            {
                done = false;
                progress = 0f;
            }
            else
            {
                done = true;
            }
            ExceptionReport();
        }
        StageManager.Instance.LoadLoginStage();
        Debug.LogFormat("启动耗时:{0}", Time.time - startTime);
    }
    public enum LaunchStage
    public class AssetBundleInitTask : LaunchTask
    {
        None,
        AssetCopy,
        ClientVersion,
        DownLoad,
        ConfigLoad,
        Complete,
        public override float expectTime {
            get { return LocalSave.GetFloat("AssetBundleInitTask_ExpectTime", 0.5f); }
            protected set { LocalSave.SetFloat("AssetBundleInitTask_ExpectTime", value); }
        }
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.AssetBundleInit;
            duration = Mathf.Max(0.1f, expectTime);
            if (!AssetSource.allFromEditor)
            {
                AssetBundleUtility.Instance.Sync_LoadAll("ui/prioritywindow");
                SnxxzGame.Instance.StartCoroutine(AssetBundleUtility.Instance.Initialize());
                SnxxzGame.Instance.StartCoroutine(AssetBundleUtility.Instance.InitalizeUIResources());
                done = false;
                progress = 0f;
            }
            else
            {
                done = true;
            }
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            if (AssetBundleUtility.Instance.initialized && AssetBundleUtility.Instance.initializedUIAssetBundle)
            {
                done = true;
            }
            else
            {
                done = false;
                progress = timer / duration;
            }
            ExceptionReport();
        }
    }
    public class ConfigInitTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("ConfigInitTask_ExpectTime", 5f); }
            protected set { LocalSave.SetFloat("ConfigInitTask_ExpectTime", value); }
        }
        float threshold = 1f;
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.ConfigInit;
            duration = Mathf.Max(0.1f, expectTime);
            threshold = Application.platform == RuntimePlatform.WindowsEditor ? 1f : 0.9f;
            LaunchPostProcess.Instance.Begin();
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
            OperationLogCollect.Instance.RecordLauchEvent(3);
            OperationLogCollect.Instance.RecordEvent(3);
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
            if (!LaunchPostProcess.Instance.completed && LaunchPostProcess.Instance.progress < threshold)
            {
                done = false;
                progress = timer / duration;
            }
            else
            {
                done = true;
            }
            ExceptionReport();
        }
    }
    public class LaunchFadeOutTask : LaunchTask
    {
        public override float expectTime {
            get { return LocalSave.GetFloat("LaunchFadeOutTask_ExpectTime", 1f); }
            protected set { LocalSave.SetFloat("LaunchFadeOutTask_ExpectTime", value); }
        }
        bool launchBackGroundLoadedOk = false;
        bool openBackGround = false;
        public override void Begin()
        {
            m_CurrentStage = LaunchStage.Complete;
            duration = Mathf.Max(0.1f, expectTime);
            LuaUtility.Instance.Init();
            CSharpCallLua.Init();
            ShaderUtility.WarmUpAll();
            SpeechTranslate.Instance.RequestGetToken();
            UI3DModelExhibition.CreateStage();
            var launchWin = WindowCenter.Instance.Get<LaunchWin>();
            if (launchWin != null)
            {
                launchWin.FadeOut();
            }
            UILoader.LoadWindowAsync("LaunchBackGroundWin",
                (bool ok, UnityEngine.Object @object) =>
                {
                    if (ok)
                    {
                        launchBackGroundLoadedOk = true;
                    }
                });
        }
        public override void End()
        {
            expectTime = timer;
            DebugEx.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
            if (!openBackGround)
            {
                WindowCenter.Instance.Open<LaunchBackGroundWin>(true);
            }
            var launchBackGroundWin = WindowCenter.Instance.Get<LaunchBackGroundWin>();
            launchBackGroundWin.transform.SetAsFirstSibling();
        }
        public override void Update()
        {
            if (done)
            {
                return;
            }
            timer += Time.deltaTime;
            if (!openBackGround)
            {
                if (launchBackGroundLoadedOk)
                {
                    WindowCenter.Instance.Open<LaunchBackGroundWin>();
                    openBackGround = true;
                }
            }
            if (timer >= expectTime)
            {
                done = true;
            }
            else
            {
                done = false;
                progress = Mathf.Clamp01(timer / expectTime);
            }
            ExceptionReport();
        }
    }
    public class WaitTask : LaunchTask
    {
        public WaitTask(float seconds)
        {
            expectTime = Mathf.Max(0.1f, seconds);
        }
        public override void Begin()
        {
        }
        public override void End()
        {
        }
        public override void Update()
        {
            timer += Time.deltaTime;
            if (timer >= expectTime)
            {
                done = true;
            }
            else
            {
                done = false;
                progress = Mathf.Clamp01(timer / expectTime);
            }
        }
    }
    public struct ProgressInfo
    {
        public LaunchStage stage;
        public float totalProgress;
        public float partProgress;
        public ProgressInfo(LaunchStage stage, float totalProgress, float partProgress)
        {
            this.stage = stage;
            this.totalProgress = totalProgress;
            this.partProgress = partProgress;
        }
    }
}
Core/GameEngine/Model/ConfigManager.cs
@@ -359,7 +359,7 @@
                    return 1;
                }
            case RuntimePlatform.WindowsEditor:
                return 50;
                return 4;
            default:
                return 1;
        }
@@ -396,7 +396,7 @@
                    return 1;
                }
            case RuntimePlatform.WindowsEditor:
                return 50;
                return 20;
            default:
                return 5;
        }
System/Launch/LaunchWin.cs
@@ -18,8 +18,11 @@
        [SerializeField] UIAlphaTween m_AlphaTween;
        [SerializeField] Image m_BackGround;
        [SerializeField] RectTransform m_AndroidProgressContainer;
        [SerializeField] SmoothSlider m_ProgressSlider;
        [SerializeField] Text m_Progress;
        [SerializeField] SmoothSlider m_PartProgressSlider;
        [SerializeField] Text m_PartProgress;
        [SerializeField] SmoothSlider m_TotalProgressSlider;
        [SerializeField] Text m_TotalProgress;
        [SerializeField] Text m_StageDescription;
        [SerializeField] RectTransform m_IosProgressContainer;
        [SerializeField] Text m_IosProgressTip;
        [SerializeField] Text m_BuildTime;
@@ -28,12 +31,8 @@
        bool assetBuildTimeShowed = false;
        Launch.LaunchStage showStage = Launch.LaunchStage.None;
        string stepDescription = string.Empty;
        float behaviourProgress = 0f;
        float timer = 0.1f;
        float interval = 0.1f;
        float backGroundTimer = 0f;
        int backGroundIndex = 0;
@@ -66,8 +65,7 @@
        {
            backGroundTimer = 0f;
            backGroundIndex = 0;
            behaviourProgress = 0f;
            m_ProgressSlider.ResetValue(0f);
            m_TotalProgressSlider.ResetValue(0f);
            m_AlphaTween.SetStartState();
            m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex);
@@ -84,16 +82,14 @@
            {
                m_AndroidProgressContainer.gameObject.SetActive(false);
                m_IosProgressContainer.gameObject.SetActive(true);
                m_IosProgressTip.text = Language.GetFromLocal(30);
            }
            else
            {
                m_AndroidProgressContainer.gameObject.SetActive(true);
                m_IosProgressContainer.gameObject.SetActive(false);
                m_Progress.text = VersionUtility.Instance.IsShangGu() ? "" : StringUtility.Contact(0, "%");
                UpdateLoadingProgress(Launch.currentStage, Launch.progress);
                Launch.progressEvent += UpdateLoadingProgress;
            }
            UpdateProgress();
        }
        protected override void OnAfterOpen()
@@ -102,7 +98,6 @@
        protected override void OnPreClose()
        {
            Launch.progressEvent -= UpdateLoadingProgress;
        }
        protected override void OnAfterClose()
@@ -115,51 +110,36 @@
            m_AlphaTween.Play();
        }
        void UpdateLoadingProgress(Launch.LaunchStage _stage, float _progress)
        string GetLaunchStageDescription(Launch.LaunchStage _stage)
        {
            behaviourProgress = _progress;
            switch (_stage)
            {
                case Launch.LaunchStage.SDKInit:
                    return Language.GetFromLocal(36);
                case Launch.LaunchStage.AssetCopy:
                    stepDescription = Language.GetFromLocal(14);
                    break;
                    return Language.GetFromLocal(37);
                case Launch.LaunchStage.ClientVersion:
                    stepDescription = Language.GetFromLocal(15);
                    break;
                    return Language.GetFromLocal(38);
                case Launch.LaunchStage.CheckAsset:
                    return Language.GetFromLocal(39);
                case Launch.LaunchStage.DownLoad:
                    stepDescription = Language.GetFromLocal(16);
                    break;
                case Launch.LaunchStage.ConfigLoad:
                    stepDescription = Language.GetFromLocal(17);
                    break;
                    return Language.GetFromLocal(40);
                case Launch.LaunchStage.AssetBundleInit:
                    return Language.GetFromLocal(41);
                case Launch.LaunchStage.ConfigInit:
                    return Language.GetFromLocal(42);
                case Launch.LaunchStage.Complete:
                    return Language.GetFromLocal(43);
                default:
                    return "";
            }
        }
        protected override void LateUpdate()
        {
            base.LateUpdate();
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                m_IosProgressContainer.gameObject.SetActive(Launch.currentStage != Launch.LaunchStage.DownLoad);
                var remainder = ((int)Time.time) % 3;
                var dot = remainder == 0 ? "." : remainder == 1 ? ".." : "...";
                m_IosProgressTip.text = StringUtility.Contact(Language.GetFromLocal(30), dot);
            }
            else
            {
                m_ProgressSlider.value = behaviourProgress;
                m_Progress.text = VersionUtility.Instance.IsShangGu() ? stepDescription :
                    StringUtility.Contact(stepDescription, Mathf.RoundToInt(behaviourProgress * 100), "%");
                if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue)
                {
                    assetBuildTimeShowed = true;
                    var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes;
                    m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString());
                }
            }
            UpdateProgress();
            backGroundTimer += Time.deltaTime;
            if (backGroundTimer >= 3f)
@@ -174,6 +154,45 @@
            WindowCenter.Instance.OpenFromLocal<UserHelpWin>();
        }
        private void UpdateProgress()
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                m_IosProgressContainer.gameObject.SetActive(Launch.progressInfo.stage != Launch.LaunchStage.DownLoad);
                var remainder = ((int)Time.time) % 3;
                var dot = remainder == 0 ? "." : remainder == 1 ? ".." : "...";
                m_IosProgressTip.text = StringUtility.Contact(Language.GetFromLocal(30), dot);
            }
            else
            {
                var progressInfo = Launch.progressInfo;
                m_TotalProgressSlider.value = progressInfo.totalProgress;
                m_TotalProgress.text = StringUtility.Contact(Mathf.RoundToInt(progressInfo.totalProgress * 100), "%");
                m_PartProgressSlider.value = progressInfo.partProgress;
                m_PartProgress.text = StringUtility.Contact(Mathf.RoundToInt(progressInfo.partProgress * 100), "%");
                DisplayStageDescription(progressInfo.stage);
                if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue)
                {
                    assetBuildTimeShowed = true;
                    var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes;
                    m_Version.text = StringUtility.Contact(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString());
                }
            }
        }
        private void DisplayStageDescription(Launch.LaunchStage stage)
        {
            if (showStage != stage)
            {
                showStage = stage;
                m_StageDescription.text = GetLaunchStageDescription(stage);
            }
        }
    }
}
System/Login/ServerListCenter.cs
@@ -188,38 +188,42 @@
    {
        if (_ok)
        {
            serverListCommonPartGot = true;
            serverInfoCommon = JsonMapper.ToObject<ServerInfoCommon>(_result);
            serverInfoCommon.recommend = new ServerGroup();
            serverInfoCommon.recommend.group_title = Language.GetFromLocal(18);
            var recommendServers = new List<ServerData>();
            for (int i = 0; i < serverInfoCommon.common.Length; i++)
            {
                var serverList = serverInfoCommon.common[i].group_list;
                foreach (var server in serverList)
                {
                    if (server.is_recommend == 1)
                    {
                        recommendServers.Add(server);
                    }
                }
            }
            serverInfoCommon.recommend.group_list = recommendServers.ToArray();
            FiltrateDefaultServerAndServerGroup();
            ServerListParser.Instance.PushCommonServerListRawData(_result);
            NetLinkWin.Hide();
            if (onServerListRefreshEvent != null)
            {
                onServerListRefreshEvent();
            }
        }
        else
        {
            Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestServerCommonList);
        }
    }
    public void SetServerlistCommon(ServerInfoCommon common)
    {
        serverInfoCommon = common;
        serverInfoCommon.recommend = new ServerGroup();
        serverInfoCommon.recommend.group_title = Language.GetFromLocal(18);
        var recommendServers = new List<ServerData>();
        for (int i = 0; i < serverInfoCommon.common.Length; i++)
        {
            var serverList = serverInfoCommon.common[i].group_list;
            foreach (var server in serverList)
            {
                if (server.is_recommend == 1)
                {
                    recommendServers.Add(server);
                }
            }
        }
        serverInfoCommon.recommend.group_list = recommendServers.ToArray();
        FiltrateDefaultServerAndServerGroup();
        serverListCommonPartGot = true;
        if (onServerListRefreshEvent != null)
        {
            onServerListRefreshEvent();
        }
    }
@@ -252,9 +256,7 @@
        if (_ok)
        {
            serverListPlayerPartGot = true;
            serverInfoPlayer = JsonMapper.ToObject<ServerInfoPlayer>(_result);
            ProcessRecentServerData();
            FiltrateDefaultServerAndServerGroup();
            ServerListParser.Instance.PushPlayerServerListRawData(_result);
        }
        else
        {
@@ -268,6 +270,12 @@
        }
    }
    public void SetServerListPlayer(ServerInfoPlayer serverInfoPlayer)
    {
        ProcessRecentServerData();
        FiltrateDefaultServerAndServerGroup();
    }
    public bool TryGetServerGroup(string _key, out ServerGroup _group)
    {
        if (serverInfoPlayer != null && serverInfoPlayer.player != null && _key == serverInfoPlayer.player.group_title)
System/Login/ServerListParser.cs
New file
@@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading;
using LitJson;
public class ServerListParser : SingletonMonobehaviour<ServerListParser>
{
    bool hasCommonResult = false;
    ServerInfoCommon serverInfoCommon;
    bool hasPlayerResult = false;
    ServerInfoPlayer serverInfoPlayer;
    public void PushCommonServerListRawData(string content)
    {
        hasCommonResult = false;
        ThreadPool.QueueUserWorkItem((object aaa) =>
        {
            serverInfoCommon = JsonMapper.ToObject<ServerInfoCommon>(content);
            hasCommonResult = true;
        });
    }
    public void PushPlayerServerListRawData(string content)
    {
        hasPlayerResult = false;
        ThreadPool.QueueUserWorkItem((object aaa) =>
        {
            serverInfoPlayer = JsonMapper.ToObject<ServerInfoPlayer>(content);
            hasPlayerResult = true;
        });
    }
    public void ReportCommonResult()
    {
        if (serverInfoCommon != null)
        {
            ServerListCenter.Instance.SetServerlistCommon(serverInfoCommon);
        }
    }
    public void ReportPlayerResult()
    {
        if (serverInfoPlayer != null)
        {
            ServerListCenter.Instance.SetServerListPlayer(serverInfoPlayer);
        }
    }
    private void Update()
    {
        if (hasCommonResult)
        {
            ReportCommonResult();
            hasCommonResult = false;
        }
        if (hasPlayerResult)
        {
            ReportPlayerResult();
            hasPlayerResult = false;
        }
    }
}
System/Login/ServerListParser.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b9bd5530884d0a445aa130e1980993f8
timeCreated: 1547868402
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: