| | |
| | | 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; }
|
| | |
| | |
|
| | |
|
| | | float m_LoadingProgress = 0f;
|
| | | float loadingProgress {
|
| | | float loadingProgress
|
| | | {
|
| | | get { return m_LoadingProgress; }
|
| | | set {
|
| | | set
|
| | | {
|
| | | m_LoadingProgress = value;
|
| | | if (loadingProgressEvent != null)
|
| | | {
|
| | |
| | | // 由于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)
|
| | | {
|