using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using UnityEngine;
|
using System;
|
|
|
namespace vnxbqy.UI
|
{
|
|
public class ActivityNotifyBehaviour : MonoBehaviour
|
{
|
int m_NotifyType;
|
|
[SerializeField] Button CloseBtn;
|
[SerializeField] Text title;
|
[SerializeField] Image icon;
|
[SerializeField] Button confirmBtn;
|
[SerializeField] Text confirmBtnText;
|
|
DailyQuestModel m_DailyQuestModel;
|
DailyQuestModel dailyQuestModel
|
{
|
get
|
{
|
return m_DailyQuestModel ?? (m_DailyQuestModel = ModelCenter.Instance.GetModel<DailyQuestModel>());
|
}
|
}
|
|
DungeonModel m_DungeonModel;
|
DungeonModel dungeonModel
|
{
|
get
|
{
|
return m_DungeonModel ?? (m_DungeonModel = ModelCenter.Instance.GetModel<DungeonModel>());
|
}
|
}
|
|
ActivityNotifyWin m_NotifyWin;
|
|
ActivityModel m_ActivityModel
|
{
|
get
|
{
|
return ModelCenter.Instance.GetModel<ActivityModel>();
|
}
|
}
|
|
private void Awake()
|
{
|
CloseBtn.onClick.AddListener(OnClose);
|
confirmBtn.onClick.AddListener(OnConfirmClick);
|
}
|
|
private void OnConfirmClick()
|
{
|
switch ((DailyQuestType)m_NotifyType)
|
{
|
case DailyQuestType.FairyGrabBoss:
|
case DailyQuestType.WyTaiChi:
|
break;
|
default:
|
if (PlayerDatas.Instance.extersion.pkState == 1)
|
{
|
SysNotifyMgr.Instance.ShowTip("PK_Leave");
|
return;
|
}
|
if (PlayerDatas.Instance.extersion.bossState == 1)
|
{
|
SysNotifyMgr.Instance.ShowTip("Boss_Leave");
|
return;
|
}
|
break;
|
}
|
|
var config = DailyQuestConfig.Get((int)m_NotifyType);
|
if (config != null)
|
{
|
switch ((DailyQuestType)m_NotifyType)
|
{
|
case DailyQuestType.FairyLand:
|
case DailyQuestType.IceCrystal:
|
case DailyQuestType.Demon:
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, 0);
|
WindowCenter.Instance.Open<NormalDungeonEntranceWin>();
|
break;
|
case DailyQuestType.GuardSky:
|
var fairyData = PlayerDatas.Instance.fairyData;
|
if (!fairyData.HasFairy)
|
{
|
break;
|
}
|
var fairyModel = ModelCenter.Instance.GetModel<FairyModel>();
|
if (fairyData.fairy == null
|
|| fairyData.fairy.FamilyLV < fairyModel.guardSkyOpenFairyLv)
|
{
|
SysNotifyMgr.Instance.ShowTip("GuardSkyOpenLvError", fairyModel.guardSkyOpenFairyLv);
|
break;
|
}
|
if (fairyModel.completeGuardSky)
|
{
|
SysNotifyMgr.Instance.ShowTip("TheEmperor1");
|
break;
|
}
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, 0);
|
WindowCenter.Instance.Open<NormalDungeonEntranceWin>();
|
break;
|
case DailyQuestType.Kirin:
|
{
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, 0);
|
WindowCenter.Instance.Open<MultipleDifficultyDungeonWin>();
|
}
|
break;
|
case DailyQuestType.FairyFeast:
|
dungeonModel.SingleChallenge(31230);
|
break;
|
case DailyQuestType.FairyChuanGong:
|
case DailyQuestType.default3:
|
WindowCenter.Instance.Open<UnionPanel>(false, 1);
|
break;
|
case DailyQuestType.Trial:
|
{
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, 0);
|
WindowCenter.Instance.Open<TrialDungeonSelectWin>();
|
}
|
break;
|
case DailyQuestType.AncientBattleGround:
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, dungeonModel.GetBelongToLine(config.ID));
|
WindowCenter.Instance.Open<NormalDungeonEntranceWin>();
|
break;
|
case DailyQuestType.HeavenBattle:
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, dungeonModel.GetBelongToLine(config.ID));
|
WindowCenter.Instance.Open<HeavenBattleWin>();
|
break;
|
case DailyQuestType.WyTaiChi:
|
if (!VersionConfig.Get().isBanShu)
|
{
|
dungeonModel.currentDungeon = new Dungeon(config.RelatedID, 0);
|
WindowCenter.Instance.Open<TaiChilDungeonEntranceWin>();
|
}
|
break;
|
case DailyQuestType.FairyLeague:
|
WindowCenter.Instance.Open<UnionPanel>(false, 4);
|
break;
|
case DailyQuestType.FairyGrabBoss:
|
WindowCenter.Instance.Open<LootPreciousFrameWin>(false, 1);
|
break;
|
case DailyQuestType.CrossServerPk:
|
WindowCenter.Instance.Open<CrossServerWin>(false, 0);
|
break;
|
case DailyQuestType.default4:
|
WindowCenter.Instance.Open<CrossServerWin>(false, 3);
|
break;
|
case DailyQuestType.AllianceBoss:
|
WindowCenter.Instance.Open<LootPreciousFrameWin>(false, 3);
|
break;
|
case DailyQuestType.HazyRegion:
|
WindowCenter.Instance.Open<HazyRegionFrameWin>();
|
break;
|
case DailyQuestType.ActivityPlace:
|
WindowCenter.Instance.Open<ActivityPlaceWin>();
|
break;
|
case DailyQuestType.RidingPetActivity:
|
WindowCenter.Instance.Open<LootPreciousFrameWin>(false, 1);
|
break;
|
}
|
}
|
else
|
{
|
switch ((ActivityModel.SpecialActivity)m_NotifyType)
|
{
|
case ActivityModel.SpecialActivity.FairyBoss:
|
WindowCenter.Instance.Open<FairyBoss>();
|
break;
|
}
|
}
|
|
OnClose();
|
}
|
|
public void Init(int type, ActivityNotifyWin _notifyWin)
|
{
|
m_NotifyWin = _notifyWin;
|
m_NotifyType = type;
|
DailyQuestConfig cfg = DailyQuestConfig.Get((int)type);
|
confirmBtnText.text = Language.Get("Z1074");
|
if (cfg != null)
|
{
|
title.text = cfg.Title;
|
icon.SetSprite(cfg.Icon);
|
}
|
else
|
{
|
var _index = type - (int)ActivityModel.SpecialActivity.None;
|
ActivityModel.SpecialActivityData _data;
|
if (m_ActivityModel.TryGetSpecialActivityData(_index,out _data))
|
{
|
title.text = Language.Get(_data.Title);
|
icon.SetSprite(_data.Icon);
|
}
|
}
|
}
|
|
|
private void OnClose()
|
{
|
if (m_NotifyWin != null)
|
{
|
m_NotifyWin.Release(m_NotifyType);
|
}
|
}
|
}
|
}
|
|