少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-08 f1163e8c9ec21cfc8f10d0ae41d11bc51c106adc
5045 根据终端的不同,确定不同的同时下载任务数。
1个文件已修改
41 ■■■■■ 已修改文件
System/AssetVersion/InGameDownLoad.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/AssetVersion/InGameDownLoad.cs
@@ -5,10 +5,8 @@
using Snxxz.UI;
using System.Text.RegularExpressions;
[XLua.LuaCallCSharp]
public class InGameDownLoad : SingletonMonobehaviour<InGameDownLoad>
{
    public const int BYTE_PER_KILOBYTE = 1024;
    public const int BYTE_PER_MILLIONBYTE = 1048576;
@@ -81,6 +79,8 @@
            }
        }
    }
    public int maxWorkingTask = 2;
    TaskModel taskModel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
@@ -323,7 +323,7 @@
        while (okCount < totalCount)
        {
            while (workingQueue.Count < 2 && downLoadTasksQueues.Count > 0)
            while (workingQueue.Count < maxWorkingTask && downLoadTasksQueues.Count > 0)
            {
                var assetVersion = downLoadTasksQueues.Dequeue();
                var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", assetVersion.relativePath);
@@ -631,6 +631,41 @@
        }
    }
    private int GetMaxTask()
    {
        switch (Application.platform)
        {
            case RuntimePlatform.Android:
                if (DeviceUtility.cpu >= 4 && DeviceUtility.memory > 3.2f * 1024)
                {
                    return 2;
                }
                else
                {
                    return 1;
                }
            case RuntimePlatform.IPhonePlayer:
                if (DeviceUtility.cpu > 1 && DeviceUtility.memory > 1.5f * 1024)
                {
                    return 2;
                }
                else
                {
                    return 1;
                }
            case RuntimePlatform.WindowsEditor:
                return 2;
            default:
                return 1;
        }
    }
    private void Awake()
    {
        maxWorkingTask = GetMaxTask();
    }
    public struct Reward
    {
        public int id;