| | |
| | | private void OnEnable() |
| | | { |
| | | model.updateMissionEvent += UpdateMissionEvent; |
| | | model.onCollectNpcInfoRefresh += UpdateMissionEvent; |
| | | } |
| | | |
| | | private void UpdateMissionEvent() |
| | |
| | | var desc = config.targetDescription1[step < config.targetDescription1.Length ? step : 0]; |
| | | var npcId = config.NPC1ID.Length == 0 ? 0 : config.NPC1ID[step < config.NPC1ID.Length ? step : 0]; |
| | | var targetValue = config.targetValue1.Length == 0 ? 0 : config.targetValue1[step < config.targetValue1.Length ? step : 0]; |
| | | GetTargetInfo(0, desc, targetValue, step, config.targetType1, npcId); |
| | | GetTargetInfo(0, desc, targetValue, step, config.targetType1, npcId, config.NPC1ID); |
| | | } |
| | | if (config.targetNum >= 2) |
| | | { |
| | | var desc = config.targetDescription2[step < config.targetDescription2.Length ? step : 0]; |
| | | var npcId = config.NPC2ID.Length == 0 ? 0 : config.NPC2ID[step < config.NPC2ID.Length ? step : 0]; |
| | | var targetValue = config.targetValue2.Length == 0 ? 0 : config.targetValue2[step < config.targetValue2.Length ? step : 0]; |
| | | GetTargetInfo(1, desc, targetValue, step, config.targetType2, npcId); |
| | | GetTargetInfo(1, desc, targetValue, step, config.targetType2, npcId, config.NPC2ID); |
| | | } |
| | | if (config.targetNum >= 3) |
| | | { |
| | | var desc = config.targetDescription3[step < config.targetDescription2.Length ? step : 0]; |
| | | var npcId = config.NPC3ID.Length == 0 ? 0 : config.NPC3ID[step < config.NPC3ID.Length ? step : 0]; |
| | | var targetValue = config.targetValue3.Length == 0 ? 0 : config.targetValue3[step < config.targetValue3.Length ? step : 0]; |
| | | GetTargetInfo(2, desc, targetValue, step, config.targetType3, npcId); |
| | | GetTargetInfo(2, desc, targetValue, step, config.targetType3, npcId, config.NPC3ID); |
| | | } |
| | | |
| | | switch (dateMapId)
|
| | |
| | | } |
| | | } |
| | | |
| | | private void GetTargetInfo(int _index, string desc, int _targetValue, int _targetStep, int _targetType, int npcId = 0) |
| | | private void GetTargetInfo(int _index, string desc, int _targetValue, int _targetStep, int _targetType, int npcId, int[] npcIds) |
| | | { |
| | | m_TargetDescs[_index].text = desc; |
| | | m_TargetNums[_index].text = string.Empty; |
| | |
| | | break; |
| | | } |
| | | m_TargetNums[_index].text = model.mission.step.ToString(); |
| | | break;
|
| | | case DungeonTargetType.Collect: |
| | | var collectCount = 0; |
| | | for (int i = 0; i < npcIds.Length; i++)
|
| | | {
|
| | | collectCount += model.GetDugneonNpcCollectCount(npcIds[i]);
|
| | | } |
| | | if (_targetValue > 0)
|
| | | { |
| | | m_TargetNums[_index].text = StringUtility.Contact(collectCount, "/", _targetValue); |
| | | break; |
| | | } |
| | | m_TargetNums[_index].text = collectCount.ToString(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | model.updateMissionEvent -= UpdateMissionEvent; |
| | | model.updateMissionEvent -= UpdateMissionEvent;
|
| | | model.onCollectNpcInfoRefresh -= UpdateMissionEvent; |
| | | } |
| | | } |
| | | } |