| | |
| | |
|
| | | public bool IsInDungeon { get; private set; }
|
| | |
|
| | | bool m_IsDungeonTargetDone = false;
|
| | | public bool IsDungeonTargetDone
|
| | | {
|
| | | get { return m_IsDungeonTargetDone; }
|
| | | private set
|
| | | {
|
| | | if (m_IsDungeonTargetDone != value)
|
| | | {
|
| | | m_IsDungeonTargetDone = value;
|
| | | if (dugeonTargetStateRefresh != null)
|
| | | {
|
| | | dugeonTargetStateRefresh();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public event Action onMapNpcCountRefresh;
|
| | | public event Action dugeonTargetStateRefresh;
|
| | |
|
| | | HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | | DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | |
| | | ParseConfig();
|
| | |
|
| | | StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
|
| | | GlobalTimeEvent.Instance.secondEvent += PerSecond;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | | public override void UnInit()
|
| | | {
|
| | | StageLoad.Instance.onStageLoadFinish -= OnStageLoadFinish;
|
| | | GlobalTimeEvent.Instance.secondEvent -= PerSecond;
|
| | | }
|
| | |
|
| | | private void PerSecond()
|
| | | {
|
| | | if (IsInDungeon)
|
| | | {
|
| | | IsDungeonTargetDone = GetDungeonTargetDone();
|
| | | }
|
| | | }
|
| | |
|
| | | void ParseConfig()
|
| | |
| | | m_MapNpcCount.Clear();
|
| | |
|
| | | IsInDungeon = false;
|
| | | m_IsDungeonTargetDone = false;
|
| | | if (IsInGrassDungeon(mapId))
|
| | | {
|
| | | IsInDungeon = true;
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | bool GetDungeonTargetDone()
|
| | | {
|
| | | var dungeonHintId = 0;
|
| | | if (ClientDungeonStageUtility.isClientDungeon)
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | | if (config != null)
|
| | | {
|
| | | dungeonHintId = dungeonModel.GetDungeonHintId(config.dungeonId, 0);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | dungeonHintId = dungeonModel.GetDungeonHintId(PlayerDatas.Instance.baseData.MapID, 0);
|
| | | }
|
| | | if (dungeonHintId != 0)
|
| | | {
|
| | | var config = DungeonHintConfig.Get(dungeonHintId);
|
| | | if (config != null)
|
| | | {
|
| | | if (config.targetType1 != 0)
|
| | | {
|
| | | var times = GetCompleteTimes(config.targetType1, config.NPC1ID);
|
| | | if (times < config.targetValue1[0])
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | if (config.targetType2 != 0)
|
| | | {
|
| | | var times = GetCompleteTimes(config.targetType2, config.NPC2ID);
|
| | | if (times < config.targetValue2[0])
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | if (config.targetType3 != 0)
|
| | | {
|
| | | var times = GetCompleteTimes(config.targetType3, config.NPC3ID);
|
| | | if (times < config.targetValue3[0])
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | int GetCompleteTimes(int type, int[] npcIds)
|
| | | {
|
| | | var times = 0;
|
| | | for (int i = 0; i < npcIds.Length; i++)
|
| | | {
|
| | | switch (type)
|
| | | {
|
| | | case 11:
|
| | | times += dungeonModel.GetDugneonNpcCollectCount(npcIds[i]);
|
| | | break;
|
| | | case 12:
|
| | | times += dungeonModel.GetDungeonNpcAttackCount(npcIds[i]);
|
| | | break;
|
| | | }
|
| | | }
|
| | | return times;
|
| | | }
|
| | |
|
| | | public int GetClientMapId(int incidentId)
|
| | | {
|
| | | var config = HazyRegionConfig.Get(incidentId);
|