| | |
| | |
|
| | | public class DungeonInspireWin : Window
|
| | | {
|
| | | [SerializeField]
|
| | | Button coinInspireBtn;
|
| | | [SerializeField]
|
| | | GameObject coinInspireMark;
|
| | | [SerializeField]
|
| | | Button fairyInspireBtn;
|
| | | [SerializeField]
|
| | | GameObject fairyInspireMark;
|
| | | [SerializeField]
|
| | | Text coinInspireInfoText;
|
| | | [SerializeField]
|
| | | Text fairyInspireInfoText;
|
| | | [SerializeField] Text m_InpsireLvTxt;
|
| | | [SerializeField]
|
| | | Button confirmBtn;
|
| | | [SerializeField]
|
| | | Button cancelBtn;
|
| | | [SerializeField]
|
| | | Button m_CloseBtn;
|
| | | [SerializeField] Button m_CoinInspire;
|
| | | [SerializeField] RectTransform m_CoinInspireCheck;
|
| | | [SerializeField] Button m_FairyInspire;
|
| | | [SerializeField] RectTransform m_FairyInspireCheck;
|
| | | [SerializeField] Text m_CoinCost;
|
| | | [SerializeField] Text m_FairyCost;
|
| | | [SerializeField] Text m_InspireLevel;
|
| | | [SerializeField] Text m_Remind;
|
| | | [SerializeField] Button m_Confirm;
|
| | | [SerializeField] Button m_Cancel;
|
| | | [SerializeField] Button m_Close;
|
| | |
|
| | | DungeonModel m_Model;
|
| | | DungeonModel model
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private bool isCoinInspire = false;
|
| | | private bool isFairyInspire = false;
|
| | | private DungeonInspireConfig coinInspireCfg = null;
|
| | | private DungeonInspireConfig fairyInspireCfg = null;
|
| | | private bool coinInspire = false;
|
| | | private bool fairyInspire = false;
|
| | | private DungeonInspireConfig coinInspireConfig = null;
|
| | | private DungeonInspireConfig fairyInspireConfig = null;
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | |
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | coinInspireBtn.onClick.AddListener(OnCoinInspire);
|
| | | fairyInspireBtn.onClick.AddListener(OnFairyInspire);
|
| | | confirmBtn.onClick.AddListener(OnConfirmBtn);
|
| | | cancelBtn.onClick.AddListener(OnCancelBtn);
|
| | | m_CloseBtn.onClick.AddListener(CloseClick);
|
| | | m_CoinInspire.onClick.AddListener(CoinInspire);
|
| | | m_FairyInspire.onClick.AddListener(FairyInspire);
|
| | | m_Confirm.onClick.AddListener(Confirm);
|
| | | m_Cancel.onClick.AddListener(Cancel);
|
| | | m_Close.onClick.AddListener(CloseClick);
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | coinInspireCfg = null;
|
| | | fairyInspireCfg = null;
|
| | | coinInspireConfig = null;
|
| | | fairyInspireConfig = null;
|
| | |
|
| | | for (int i = 0; i < _list.Count; i++)
|
| | | {
|
| | | if (_list[i].InspireType == 1)
|
| | | if (_list[i].InspireType == 3)
|
| | | {
|
| | | coinInspireCfg = _list[i];
|
| | | coinInspireConfig = _list[i];
|
| | | }
|
| | | else if (_list[i].InspireType == 2)
|
| | | else if (_list[i].InspireType == 2
|
| | | || _list[i].InspireType == 1 || _list[i].InspireType == 5)
|
| | | {
|
| | | fairyInspireCfg = _list[i];
|
| | | fairyInspireConfig = _list[i];
|
| | | }
|
| | | }
|
| | |
|
| | | coinInspireBtn.gameObject.SetActive(coinInspireCfg != null);
|
| | | isCoinInspire = coinInspireCfg == null ? false : true;
|
| | | isFairyInspire = !isCoinInspire;
|
| | | InitData();
|
| | | m_CoinInspire.gameObject.SetActive(coinInspireConfig != null);
|
| | |
|
| | | coinInspire = coinInspireConfig == null ? false : true;
|
| | | fairyInspire = !coinInspire;
|
| | |
|
| | | Display();
|
| | | UpdateInspireType();
|
| | | DisplayRemind();
|
| | |
|
| | | model.dungeonInspireLvEvent += DungeonEncourageEvent;
|
| | | }
|
| | |
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | var _list = model.GetDungeonInspire(PlayerDatas.Instance.baseData.MapID);
|
| | | if (_list == null)
|
| | | {
|
| | | CloseImmediately();
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | |
| | |
|
| | | private void DungeonEncourageEvent()
|
| | | {
|
| | | var lv = model.dungeonCoinInspireCount + model.dungeonJadeInspireCount;
|
| | | if (lv >= fairyInspireCfg.InspireCount && !InFairyLandGuiding())
|
| | | var level = model.GetDungeonInspireLevel();
|
| | | if (level >= model.GetInspireMaxCount(PlayerDatas.Instance.baseData.MapID)
|
| | | && !InGuiding())
|
| | | {
|
| | | CloseImmediately();
|
| | | return;
|
| | | }
|
| | | DisplayCost();
|
| | | UpdateInspireType();
|
| | | }
|
| | |
|
| | | private void OnCoinInspire()
|
| | | private void CoinInspire()
|
| | | {
|
| | | if (!isCoinInspire)
|
| | | if (!coinInspire)
|
| | | {
|
| | | if (model.dungeonCoinInspireCount >= coinInspireCfg.InspireCount)
|
| | | if (model.GetDungeonInspireLevel(3) >= coinInspireConfig.InspireCount)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("Xjmj_CopperInspireFull");
|
| | | return;
|
| | | }
|
| | | isCoinInspire = true;
|
| | | isFairyInspire = false;
|
| | | coinInspire = true;
|
| | | fairyInspire = false;
|
| | | }
|
| | | else
|
| | | {
|
| | | isCoinInspire = false;
|
| | | coinInspire = false;
|
| | | }
|
| | | UpdateInspireType();
|
| | | }
|
| | | private void OnFairyInspire()
|
| | | private void FairyInspire()
|
| | | {
|
| | | if (coinInspireCfg == null)
|
| | | if (coinInspireConfig == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | isCoinInspire = false;
|
| | | isFairyInspire = !isFairyInspire;
|
| | | coinInspire = false;
|
| | | fairyInspire = !fairyInspire;
|
| | | UpdateInspireType();
|
| | | }
|
| | |
|
| | | private void OnConfirmBtn()
|
| | | private void Confirm()
|
| | | {
|
| | | if (isFairyInspire)
|
| | | if (fairyInspire)
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.GoldPaper + PlayerDatas.Instance.baseData.Gold < fairyInspireCfg.MoneyCount
|
| | | && !InFairyLandGuiding())
|
| | | uint money = 0;
|
| | | switch (fairyInspireConfig.InspireType)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("Xjmj_InspireNoEnoughFairy");
|
| | | case 1:
|
| | | money += PlayerDatas.Instance.baseData.Gold;
|
| | | break;
|
| | | case 2:
|
| | | money += PlayerDatas.Instance.baseData.GoldPaper;
|
| | | break;
|
| | | case 5:
|
| | | money = PlayerDatas.Instance.baseData.GoldPaper + PlayerDatas.Instance.baseData.Gold;
|
| | | break;
|
| | | }
|
| | | if (money < model.GetDungeonInspireCost(fairyInspireConfig)
|
| | | && !InGuiding())
|
| | | {
|
| | | CloseImmediately();
|
| | | WindowCenter.Instance.Open<RechargeTipWin>();
|
| | | }
|
| | | else
|
| | | {
|
| | | CA508_tagCMDoFBAction inspirepack = new CA508_tagCMDoFBAction();
|
| | | inspirepack.ActionType = 0;
|
| | | inspirepack.ActionInfo = (uint)fairyInspireCfg.InspireType;
|
| | | GameNetSystem.Instance.SendInfo(inspirepack);
|
| | | CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction();
|
| | | pak.ActionType = 0;
|
| | | pak.ActionInfo = (uint)fairyInspireConfig.InspireType;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | }
|
| | | else if (isCoinInspire)
|
| | | else if (coinInspire)
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.Silver < coinInspireCfg.MoneyCount
|
| | | && !InFairyLandGuiding())
|
| | | if (UIHelper.GetMoneyCnt(3) < (ulong)model.GetDungeonInspireCost(coinInspireConfig)
|
| | | && !InGuiding())
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("Xjmj_InspireNoEnoughGold");
|
| | | }
|
| | | else
|
| | | {
|
| | | CA508_tagCMDoFBAction inspirepack = new CA508_tagCMDoFBAction();
|
| | | inspirepack.ActionType = 0;
|
| | | inspirepack.ActionInfo = (uint)coinInspireCfg.InspireType;
|
| | | GameNetSystem.Instance.SendInfo(inspirepack);
|
| | | CA508_tagCMDoFBAction pak = new CA508_tagCMDoFBAction();
|
| | | pak.ActionType = 0;
|
| | | pak.ActionInfo = (uint)coinInspireConfig.InspireType;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnCancelBtn()
|
| | | private void Cancel()
|
| | | {
|
| | | CloseImmediately();
|
| | | }
|
| | |
|
| | | private void InitData()
|
| | | private void Display()
|
| | | {
|
| | | if (coinInspireCfg != null)
|
| | | {
|
| | | coinInspireInfoText.text = Language.Get("FairyLand_Func9", coinInspireCfg.MoneyCount, coinInspireCfg.InspireCount);
|
| | | }
|
| | | fairyInspireInfoText.text = Language.Get("FairyLand_Func10", fairyInspireCfg.MoneyCount);
|
| | | DisplayCost();
|
| | | }
|
| | |
|
| | | bool InFairyLandGuiding()
|
| | | private void DisplayCost()
|
| | | {
|
| | | if (NewBieCenter.Instance.inGuiding && NewBieCenter.Instance.currentGuide == GeneralConfig.Instance.fairyLandGuideId)
|
| | | if (coinInspireConfig != null)
|
| | | {
|
| | | m_CoinCost.text = Language.Get("FairyLand_Func9", model.GetDungeonInspireCost(coinInspireConfig), coinInspireConfig.InspireCount);
|
| | | }
|
| | | if (fairyInspireConfig != null)
|
| | | {
|
| | | m_FairyCost.text = Language.Get("FairyLand_Func10", model.GetDungeonInspireCost(fairyInspireConfig));
|
| | | }
|
| | | }
|
| | |
|
| | | void DisplayRemind()
|
| | | {
|
| | | m_Remind.gameObject.SetActive(fairyInspireConfig != null && fairyInspireConfig.InspireType == 5);
|
| | | }
|
| | |
|
| | | bool InGuiding()
|
| | | {
|
| | | if (NewBieCenter.Instance.inGuiding
|
| | | && NewBieCenter.Instance.currentGuide == GeneralConfig.Instance.fairyLandGuideId)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
| | |
|
| | | private void UpdateInspireType()
|
| | | {
|
| | | var lv = model.dungeonJadeInspireCount + model.dungeonCoinInspireCount;
|
| | | m_InpsireLvTxt.text = lv == 0 ? Language.Get("FairyLand_Func4")
|
| | | : Language.Get("HaveInspired", StringUtility.Contact("<color=#109d06>", lv * model.dungeonInspireUper, "%</color>"));
|
| | | coinInspireMark.SetActive(isCoinInspire);
|
| | | fairyInspireMark.SetActive(isFairyInspire);
|
| | | var level = model.GetDungeonInspireLevel();
|
| | | m_InspireLevel.text = level == 0 ? Language.Get("FairyLand_Func4")
|
| | | : Language.Get("HaveInspired", StringUtility.Contact("<color=#109d06>", |
| | | level * model.GetDungeonInspireUpper(PlayerDatas.Instance.baseData.MapID), "%</color>"));
|
| | | m_CoinInspireCheck.gameObject.SetActive(coinInspire);
|
| | | m_FairyInspireCheck.gameObject.SetActive(fairyInspire);
|
| | | }
|
| | | }
|
| | |
|