| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using DG.Tweening; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | |
| | | //经验区 |
| | | [SerializeField] Text playerLevelText; |
| | | [SerializeField] SmoothSlider expSlider; |
| | | [SerializeField] UIEffectPlayer fullEffect; |
| | | [SerializeField] UIEffectPlayer headEffect; |
| | | [SerializeField] Button officialUpBtn; |
| | | [SerializeField] Transform officialTip; |
| | | |
| | | //任务区 |
| | | [SerializeField] Button taskButton; //引导或者领取任务奖励 |
| | |
| | | [SerializeField] UIEffectPlayer autoOpenEffect; |
| | | [SerializeField] Button blessLVBtn; |
| | | [SerializeField] Text blessLVText; |
| | | [SerializeField] Button mailBtn; |
| | | |
| | | //其他功能入口 |
| | | [SerializeField] Button monthCardBtn; |
| | | //右侧功能 |
| | | [SerializeField] Button funcColBtn; |
| | | [SerializeField] RightFuncInHome rightFuncInHome; |
| | | |
| | | [SerializeField] Button FirstChargeBtn; |
| | | |
| | | /// <summary> |
| | | /// 初始化组件 |
| | |
| | | |
| | | autoBtn.AddListener(() => |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen(108, true)) |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.AutoFight, true)) |
| | | { |
| | | return; |
| | | } |
| | |
| | | }); |
| | | |
| | | |
| | | monthCardBtn.AddListener(() => |
| | | |
| | | |
| | | FirstChargeBtn.AddListener(() => |
| | | { |
| | | InvestModel.Instance.BuyInvest(InvestModel.monthCardType); |
| | | UIManager.Instance.OpenWindow<FirstChargeWin>(); |
| | | }); |
| | | |
| | | blessLVBtn.AddListener(() => |
| | | { |
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlessLV, true)) |
| | | { |
| | | return; |
| | | } |
| | | UIManager.Instance.OpenWindow<BlessLVWin>(); |
| | | }); |
| | | |
| | | mailBtn.AddListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<MailWin>(); |
| | | }); |
| | | |
| | | officialUpBtn.AddListener(() => |
| | |
| | | }); |
| | | |
| | | restBtn.AddListener(GotoRest); |
| | | funcColBtn.AddListener(()=> |
| | | { |
| | | rightFuncInHome.ShowFuncCol(true); |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | DisplayLevel(); |
| | | DisplayRestState(); |
| | | |
| | | funcColBtn.SetActive(FuncOpen.Instance.IsFuncOpen(GeneralDefine.mainRightFuncOpenFuncID)); |
| | | officialTip.SetActive(OfficialRankManager.Instance.CanOfficialLVUP()); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | |
| | | AutoFightModel.Instance.OnFightEvent += ChangeMode; |
| | | TeamManager.Instance.OnTeamChange += DisplayCard; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChange; |
| | | FirstChargeManager.Instance.OnUpdateFirstChargeInfo += OnUpdateFirstChargeInfo; |
| | | GlobalTimeEvent.Instance.secondEvent += OnSecondEvent; |
| | | HeroUIManager.Instance.OnUnLockHeroCountEvent += OnUnLockHeroCountEvent; |
| | | OfficialRankManager.Instance.OnOfficialCanLVUpEvent += OnOfficialCanLVUpEvent; |
| | | FirstChargeManager.Instance.OnFirstChargeTaskUpdateEvent += OnFirstChargeTaskUpdateEvent; |
| | | OfficialRankManager.Instance.RealmMissionRefreshEvent += OnOfficialCanLVUpEvent; |
| | | Display(); |
| | | DisplayFirstChargeBtn(); |
| | | |
| | | // var battleWin = UIManager.Instance.OpenWindow<BattleWin>(); |
| | | // battleWin.SetBattleField(BattleManager.Instance.storyBattleField); |
| | | } |
| | |
| | | AutoFightModel.Instance.OnFightEvent -= ChangeMode; |
| | | TeamManager.Instance.OnTeamChange -= DisplayCard; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChange; |
| | | FirstChargeManager.Instance.OnUpdateFirstChargeInfo -= OnUpdateFirstChargeInfo; |
| | | GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent; |
| | | HeroUIManager.Instance.OnUnLockHeroCountEvent -= OnUnLockHeroCountEvent; |
| | | OfficialRankManager.Instance.OnOfficialCanLVUpEvent -= OnOfficialCanLVUpEvent; |
| | | FirstChargeManager.Instance.OnFirstChargeTaskUpdateEvent -= OnFirstChargeTaskUpdateEvent; |
| | | OfficialRankManager.Instance.RealmMissionRefreshEvent -= OnOfficialCanLVUpEvent; |
| | | // 关闭的时候把战斗界面也给关了 虽然是在外面开的 |
| | | UIManager.Instance.CloseWindow<BattleWin>(); |
| | | } |
| | | |
| | | void OnOfficialCanLVUpEvent() |
| | | { |
| | | officialTip.SetActive(OfficialRankManager.Instance.CanOfficialLVUP()); |
| | | } |
| | | |
| | | private void OnClickEnterBoss() |
| | | { |
| | | BattleField battleField = BattleManager.Instance.GetBattleFieldByMapID(2); //BOSS战斗 |
| | | // BattleField battleField = BattleManager.Instance.GetBattleFieldByMapID(2); //BOSS战斗 |
| | | |
| | | if (null != battleField) |
| | | { |
| | | FullScreenBattleWin fsBattleWin = UIManager.Instance.OpenWindow<FullScreenBattleWin>(); |
| | | fsBattleWin.SetBattleField(battleField); |
| | | return; |
| | | } |
| | | // if (null != battleField) |
| | | // { |
| | | // StoryBossBattleWin fsBattleWin = UIManager.Instance.OpenWindow<StoryBossBattleWin>(); |
| | | // fsBattleWin.SetBattleField(battleField); |
| | | // return; |
| | | // } |
| | | |
| | | UIManager.Instance.OpenWindow<MainBossEnterWin>(); |
| | | } |
| | |
| | | break; |
| | | case PlayerDataType.LV: |
| | | if (lastLV != PlayerDatas.Instance.baseData.LV) |
| | | { |
| | | { |
| | | lastLV = PlayerDatas.Instance.baseData.LV; |
| | | lvUPEffect.Play(); |
| | | fullEffect.Play(closePMA: true); |
| | | headEffect.Stop(); |
| | | } |
| | | playerLevelText.text = PlayerDatas.Instance.baseData.LV.ToString(); |
| | | break; |
| | | case PlayerDataType.ExAttr1: |
| | | case PlayerDataType.ExAttr2: |
| | | DisplayLevel(); |
| | | break; |
| | | |
| | | case PlayerDataType.RealmLevel: |
| | | OnOfficialCanLVUpEvent(); |
| | | break; |
| | | } |
| | | |
| | |
| | | |
| | | void RefreshRecharge() |
| | | { |
| | | monthCardBtn.SetActive(!InvestModel.Instance.IsInvested(InvestModel.monthCardType)); |
| | | //monthCardBtn.SetActive(!InvestModel.Instance.IsInvested(InvestModel.monthCardType)); |
| | | } |
| | | |
| | | |
| | |
| | | private void UpdatePlayerInfo() |
| | | { |
| | | playerLevelText.text = PlayerDatas.Instance.baseData.LV.ToString(); |
| | | ShowExp(); |
| | | headEffect.transform.localPosition = new Vector3(400 * expSlider.value - 200 - 24, 0, 0); |
| | | ShowExp(false); |
| | | |
| | | } |
| | | |
| | | void ShowExp() |
| | | void ShowExp(bool showEffect = true) |
| | | { |
| | | var lvConfig = PlayerLVConfig.Get(PlayerDatas.Instance.baseData.LV); |
| | | expSlider.value = (float)PlayerDatas.Instance.baseData.curExp / lvConfig.EXP; |
| | | expSlider.Text.text = PlayerDatas.Instance.baseData.curExp + "/" + PlayerLVConfig.Get(PlayerDatas.Instance.baseData.LV).EXP; |
| | | if (showEffect) |
| | | { |
| | | headEffect.transform.DOLocalMove(new Vector3(400 * expSlider.value - 200 - 24, 0, 0), 0.5f); |
| | | headEffect.Play(closePMA:true); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | taskButton.SetActive(true); |
| | | var taskConfig = TaskConfig.Get(task.TaskID); |
| | | if (taskConfig == null) |
| | | { |
| | | Debug.LogError("找不到任务 " + task.TaskID); |
| | | return; |
| | | } |
| | | taskText.text = taskConfig.TaskDescribe; |
| | | taskNumText.text = string.Format("({0}/{1})", task.CurValue, taskConfig.NeedValue); |
| | | taskNumText.color = task.CurValue >= taskConfig.NeedValue ? UIHelper.GetUIColor(TextColType.NavyYellow) : UIHelper.GetUIColor(TextColType.Red); |
| | |
| | | getReward.RewardType = 66; |
| | | getReward.DataEx = (uint)TaskManager.Instance.mainTask.TaskID; |
| | | GameNetSystem.Instance.SendInfo(getReward); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | //根据任务类型引导 |
| | | } |
| | | |
| | | TaskManager.Instance.ClickTask(); |
| | | } |
| | | |
| | | void DisplayCard(TeamType teamType) |
| | | { |
| | | if (teamType != TeamType.Story) |
| | | return; |
| | | var team = TeamManager.Instance.GetTeam(teamType); |
| | | var heros = team.GetHerosOnTeam(); |
| | | //显示卡牌 |
| | | for (int i = 0; i < heroFightingCardCells.Length; i++) |
| | | { |
| | | heroFightingCardCells[i].Display(i); |
| | | heroFightingCardCells[i].Display(i, heros); |
| | | } |
| | | } |
| | | |
| | |
| | | //【普通】关卡名字1-6 |
| | | levelName.text = Language.Get("mainui7", chapterConfig.Level, chapterConfig.ChapterName, chapterID, levelNum); |
| | | |
| | | bool canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss(); |
| | | bool canChallengeBoss = MainLevelManager.Instance.CanChallengeBoss(); |
| | | //BOSS |
| | | if (canChallengeBoss) |
| | | { |
| | |
| | | } |
| | | |
| | | void GotoRest() |
| | | { |
| | | { |
| | | if (BattleManager.Instance.storyBattleField != null && |
| | | BattleManager.Instance.storyBattleField.GetBattleMode() != BattleMode.Stop) |
| | | { |
| | | BattleManager.Instance.storyBattleField.HaveRest(); |
| | | } |
| | | } |
| | | |
| | | private void DisplayFirstChargeBtn() |
| | | { |
| | | bool isFirstChargeFuncOpen = FirstChargeManager.Instance.IsFuncOpen(); |
| | | if (FirstChargeManager.Instance.IsAllFirstChargeRewardsClaimed() && |
| | | FirstChargeManager.Instance.IsNextDayAfterAllClaimed()) |
| | | { |
| | | FirstChargeBtn.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | FirstChargeBtn.SetActive(isFirstChargeFuncOpen); |
| | | } |
| | | } |
| | | |
| | | private void OnFirstChargeTaskUpdateEvent() |
| | | { |
| | | DisplayFirstChargeBtn(); |
| | | } |
| | | |
| | | private void OnFuncStateChange(int funcId) |
| | | { |
| | | if (funcId == GeneralDefine.mainRightFuncOpenFuncID) |
| | | { |
| | | funcColBtn.SetActive(FuncOpen.Instance.IsFuncOpen(GeneralDefine.mainRightFuncOpenFuncID)); |
| | | } |
| | | } |
| | | |
| | | private void OnUpdateFirstChargeInfo() |
| | | { |
| | | DisplayFirstChargeBtn(); |
| | | } |
| | | |
| | | private void OnSecondEvent() |
| | | { |
| | | DisplayFirstChargeBtn(); |
| | | } |
| | | |
| | | void OnUnLockHeroCountEvent() |
| | | { |
| | | DisplayCard(TeamType.Story); |
| | | } |
| | | } |