| | |
| | |
|
| | | HazyRegionModel model { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | | FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
|
| | | HazyDemonKingModel hazyDemonKingModel { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
|
| | |
|
| | | int incidentId = 0;
|
| | |
|
| | |
| | |
|
| | | float timer = 0f;
|
| | |
|
| | | DateTime requestPlayerCountTime = DateTime.Now;
|
| | |
|
| | | HazyRegionIncidentType incidentType = HazyRegionIncidentType.Adventure;
|
| | |
|
| | | private void Awake()
|
| | |
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | incidentType = (HazyRegionIncidentType)config.incidentType;
|
| | |
|
| | | m_BossAlive = false;
|
| | | if (incidentType == HazyRegionIncidentType.DemonKing)
|
| | | {
|
| | | m_BossAlive = findPreciousModel.IsBossAlive(config.npcId);
|
| | |
| | | model.onHazyRegionIncidentRefresh += OnHazyRegionIncidentRefresh;
|
| | | findPreciousModel.bossInfoUpdateEvent -= BossInfoUpdateEvent;
|
| | | findPreciousModel.bossInfoUpdateEvent += BossInfoUpdateEvent;
|
| | | hazyDemonKingModel.onPlayerCountRefresh -= OnPlayerCountRefresh;
|
| | | hazyDemonKingModel.onPlayerCountRefresh += OnPlayerCountRefresh;
|
| | | }
|
| | |
|
| | | void DisplayBase()
|
| | |
| | | {
|
| | | if (model.InFakeHazyRegion)
|
| | | {
|
| | | var fighting = ClientDungeonStageUtility.isClientDungeon;
|
| | | var fighting = ClientDungeonStageUtility.isClientDungeon &&
|
| | | ClientDungeonStageUtility.clientMapId == HazyDemonKingModel.Client_MapID;
|
| | | m_PlayerCount.gameObject.SetActive(true);
|
| | | m_RebornTime.gameObject.SetActive(false);
|
| | | m_PlayerCount.text = Language.Get("HazyDemonKingPlayerCount", fighting ? 1 : 0);
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | m_PlayerCount.text = Language.Get("HazyDemonKingPlayerCount", 0);
|
| | | SendRequestPlayerCount();
|
| | | DisplayPlayerCount();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | void DisplayPlayerCount()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null)
|
| | | {
|
| | | m_PlayerCount.text = Language.Get("HazyDemonKingPlayerCount",
|
| | | hazyDemonKingModel.GetDungeonPlayerCount(config.dungeonId, config.lineId));
|
| | | }
|
| | | }
|
| | |
|
| | | private void LateUpdate()
|
| | | {
|
| | | timer += Time.deltaTime;
|
| | |
| | |
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | bossAlive = findPreciousModel.IsBossAlive(config.npcId);
|
| | |
|
| | | if (bossAlive)
|
| | | {
|
| | | if ((DateTime.Now - requestPlayerCountTime).TotalSeconds > 5)
|
| | | {
|
| | | SendRequestPlayerCount();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | m_ContainerCompleted.gameObject.SetActive(incident.state == HazyRegionModel.IncidentState.Complete);
|
| | | m_ContainerProcessing.gameObject.SetActive(incident.state == HazyRegionModel.IncidentState.Processing);
|
| | | }
|
| | | }
|
| | |
|
| | | void SendRequestPlayerCount()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null && config.incidentType == (int)HazyRegionIncidentType.DemonKing
|
| | | && !model.InFakeHazyRegion)
|
| | | {
|
| | | var pak = new CA004_tagCGGetFBLinePlayerCnt();
|
| | | pak.MapID = (uint)config.dungeonId;
|
| | | pak.FBLineID = (byte)config.lineId;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | |
|
| | | requestPlayerCountTime = DateTime.Now;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void OnPlayerCountRefresh()
|
| | | {
|
| | | if (incidentType == HazyRegionIncidentType.DemonKing
|
| | | && !model.InFakeHazyRegion && bossAlive)
|
| | | {
|
| | | DisplayPlayerCount();
|
| | | }
|
| | | }
|
| | |
|
| | | public override void Dispose()
|
| | | {
|
| | | base.Dispose();
|
| | | hazyDemonKingModel.onPlayerCountRefresh -= OnPlayerCountRefresh;
|
| | | findPreciousModel.bossInfoUpdateEvent -= BossInfoUpdateEvent;
|
| | | model.selectIncidentRefresh -= SelectIncidentRefresh;
|
| | | model.onHazyRegionIncidentRefresh -= OnHazyRegionIncidentRefresh;
|