少年修仙传客户端代码仓库
client_Wu Xijin
2018-11-26 d037267bed73b7fcdc691697bec96cf3e9329867
5038 【1.3】4G环境下,地图分包下载显示优化
3个文件已修改
43 ■■■■■ 已修改文件
System/AssetVersion/InGameDownLoad.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WorldMap/MapModel.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/WorldMap/WorldMapAreaBehaviour.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/AssetVersion/InGameDownLoad.cs
@@ -189,6 +189,20 @@
        return completeCount / (float)total;
    }
    int mapId = 0;
    Action mapAssetDownLoadOk;
    public void RegisterMapAssetDownLoadOk(int mapId, Action callBack)
    {
        this.mapId = mapId;
        mapAssetDownLoadOk = callBack;
    }
    public void UnRegisterMapAssetDownLoadOk()
    {
        this.mapId = 0;
        mapAssetDownLoadOk = null;
    }
    public void TryDownLoad(Dominant _dominant)
    {
        if (!inGameDownLoadAllow)
@@ -473,6 +487,21 @@
                networkReachability = Application.internetReachability;
            }
        }
        if (mapId != 0)
        {
            var progress = GetMapAssetDownLoadProgress(mapId);
            if (progress > 0.9999f)
            {
                if (mapAssetDownLoadOk != null)
                {
                    mapAssetDownLoadOk();
                    mapAssetDownLoadOk = null;
                    mapId = 0;
                }
            }
        }
    }
    public bool CheckDominantDownLoad()
System/WorldMap/MapModel.cs
@@ -12,7 +12,7 @@
{
    [XLua.LuaCallCSharp]
    public class MapModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IMapInitOk
    public class MapModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk, IMapInitOk
    {
        Dictionary<int, WorldMapArea> worldMapAreas = new Dictionary<int, WorldMapArea>();
        Dictionary<int, bool> worldMapUnLockStates = new Dictionary<int, bool>();
@@ -124,6 +124,7 @@
                return;
            }
            InGameDownLoad.Instance.UnRegisterMapAssetDownLoadOk();
            var map = Config.Instance.Get<MapConfig>(_mapId);
            var position = new Vector3(map.BornPoints[0].x, 0, map.BornPoints[0].y);
            MapTransferUtility.Send_WorldTransfer(_mapId, position, MapTransferType.WorldTransport, (byte)_lineId, 0);
System/WorldMap/WorldMapAreaBehaviour.cs
@@ -100,7 +100,17 @@
            if (mapAssetDownLoadProgress != null)
            {
                mapAssetDownLoadProgress.OnComplete(null);
                InGameDownLoad.Instance.RegisterMapAssetDownLoadOk(this.m_MapArea.id, () =>
                {
                    var config = Config.Instance.Get<MapConfig>(this.m_MapArea.id);
                    ConfirmCancel.ShowPopConfirm(
                        "Mail101",
                        Language.Get("LoadMap1", config.Name),
                        () => { model.RequestMapTransport(this.m_MapArea.id); }
                        );
                });
            }
            StopAllCoroutines();
        }
@@ -150,6 +160,7 @@
                                behaviour.transform.SetParentEx(m_Conainter.transform, Vector3.zero, Vector3.zero, Vector3.one);
                            }
                            InGameDownLoad.Instance.UnRegisterMapAssetDownLoadOk();
                            mapAssetDownLoadProgress.mapId = m_MapArea.id;
                            mapAssetDownLoadProgress.OnComplete(() =>
                            {