少年修仙传客户端代码仓库
client_Hale
2018-12-20 58413ad17a5688abd4d135f9591881f5cd618c73
update 客户端切图不等待服务端回包逻辑
1个文件已修改
67 ■■■■■ 已修改文件
Fight/Stage/StageManager.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/Stage/StageManager.cs
@@ -18,32 +18,40 @@
    public event Action<float> loadingProgressEvent;
    bool m_IsServerPreparing = false;
    public bool isServerPreparing {
    public bool isServerPreparing
    {
        get { return m_IsServerPreparing; }
        set { m_IsServerPreparing = value; }
    }
    public Stage.E_StageType StageType {
        get {
    public Stage.E_StageType StageType
    {
        get
        {
            return m_StageType;
        }
    }
    public Stage CurrentStage {
        get {
    public Stage CurrentStage
    {
        get
        {
            return m_CurrentStage;
        }
    }
    int m_CurrentMapId;
    public int currentMapId {
    public int currentMapId
    {
        get { return m_CurrentMapId; }
        private set { m_CurrentMapId = value; }
    }
    int m_CurrentMapResID;
    public int currentMapResId {
        get {
    public int currentMapResId
    {
        get
        {
            return m_CurrentMapResID;
        }
        private set { m_CurrentMapResID = value; }
@@ -54,9 +62,11 @@
    float m_LoadingProgress = 0f;
    float loadingProgress {
    float loadingProgress
    {
        get { return m_LoadingProgress; }
        set {
        set
        {
            m_LoadingProgress = value;
            if (loadingProgressEvent != null)
            {
@@ -322,24 +332,35 @@
        // 由于0401包只是通知服务端开始加载地图, 并不表示已经加载完毕
        // 客户端由0401开始加载地图, 可能存在客户端加载完毕但是服务端还没准备好的情况
        // 所以针对副本地图需要在这里等待服务端0109回包才能发送此包
        progressBuf = loadingProgress;
        timer = 0f;
        duration = 1f;
        while (isServerPreparing)
        if (!isClientChangeMap)
        {
            timer += Time.deltaTime;
            loadingProgress = Mathf.Clamp(progressBuf + timer / duration * 0.2f, progressBuf, progressBuf + 0.2f);
            yield return null;
            progressBuf = loadingProgress;
            timer = 0f;
            duration = 1f;
            while (isServerPreparing)
            {
                timer += Time.deltaTime;
                loadingProgress = Mathf.Clamp(progressBuf + timer / duration * 0.2f, progressBuf, progressBuf + 0.2f);
                yield return null;
            }
        }
        if (m_StageType == Stage.E_StageType.Dungeon)
        {
            var mapOk = new C0107_tagCInitMapOK();
            mapOk.MapID = PlayerDatas.Instance.baseData.MapID;
            mapOk.Type = 0;
            GameNetSystem.Instance.SendInfo(mapOk);
            if (!isClientChangeMap)
            {
                var mapOk = new C0107_tagCInitMapOK();
                mapOk.MapID = PlayerDatas.Instance.baseData.MapID;
                mapOk.Type = 0;
                if (!GameNetSystem.Instance.crossServerSocketConnected)
                {
                    GameNetSystem.Instance.SendInfo(mapOk);
                }
                else
                {
                    GameNetSystem.Instance.SendToCrossServer(mapOk);
                }
            }
            var _mapData = H2Engine.MapData.LoadFormFile("map_" + _stageId);
            if (_mapData != null)
            {