| | |
| | | |
| | | //关卡 |
| | | [SerializeField] Button bossBtn; |
| | | [SerializeField] MainLevelWaveCell[] mainLevelWaves; |
| | | [SerializeField] ScrollRect mainLevelScrollRect; |
| | | [SerializeField] Text levelName; |
| | | |
| | | [SerializeField] Button changeHeroPosBtn; |
| | | [SerializeField] GameObject restMark; |
| | | [SerializeField] Button restBtn; |
| | | [SerializeField] GameObject fightMark; |
| | | [SerializeField] ScaleTween bossTween; |
| | | [SerializeField] GameObject bossmask; //完成进度遮挡管道 纯显示 |
| | | [SerializeField] GameObject bossActiveGo; |
| | | [SerializeField] GameObject bitemeGo; |
| | | [SerializeField] Text processText; |
| | | |
| | | |
| | | //卡牌 |
| | | [SerializeField] HeroFightingCardCell[] heroFightingCardCells; |
| | | [SerializeField] Button changeHeroPosBtn; |
| | | |
| | | //底部功能 |
| | | [SerializeField] Button autoBtn; |
| | |
| | | |
| | | autoBtn.AddListener(() => |
| | | { |
| | | // //测试拾取所有物品 |
| | | // var items = PackManager.Instance.GetItems(PackType.DropItem); |
| | | // List<int> dropindexs = new List<int>(); |
| | | // for (int i = 0; i < items.Count; i++) |
| | | // { |
| | | // var item = items[i]; |
| | | // if (dropindexs.Count > 5) |
| | | // { |
| | | // EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); |
| | | // dropindexs.Clear(); |
| | | // } |
| | | |
| | | // dropindexs.Add(item.gridIndex); |
| | | // } |
| | | // if (dropindexs.Count > 0) |
| | | // { |
| | | // EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); |
| | | // dropindexs.Clear(); |
| | | // } |
| | | if (!FuncOpen.Instance.IsFuncOpen(108, true)) |
| | | { |
| | | return; |
| | |
| | | return; |
| | | UIManager.Instance.OpenWindow<OfficialUpWin>(); |
| | | }); |
| | | |
| | | restBtn.AddListener(GotoRest); |
| | | } |
| | | |
| | | |
| | |
| | | ShowBlessLV(); |
| | | DisplayAutoFight(); |
| | | DisplayCard(TeamType.Story); |
| | | DisplayLevel(); |
| | | DisplayRestState(); |
| | | |
| | | } |
| | | |
| | |
| | | TaskManager.Instance.OnTaskUpdate += UpdateTask; |
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent += ShowBlessLV; |
| | | AutoFightModel.Instance.ChangeAutoEvent += DisplayAutoFight; |
| | | AutoFightModel.Instance.OnFightEvent += ChangeMode; |
| | | TeamManager.Instance.OnTeamChange += DisplayCard; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | Display(); |
| | |
| | | TaskManager.Instance.OnTaskUpdate -= UpdateTask; |
| | | BlessLVManager.Instance.OnBlessLVUpdateEvent -= ShowBlessLV; |
| | | AutoFightModel.Instance.ChangeAutoEvent -= DisplayAutoFight; |
| | | AutoFightModel.Instance.OnFightEvent -= ChangeMode; |
| | | TeamManager.Instance.OnTeamChange -= DisplayCard; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | |
| | |
| | | break; |
| | | case PlayerDataType.LV: |
| | | playerLevelText.text = PlayerDatas.Instance.baseData.LV.ToString(); |
| | | break; |
| | | case PlayerDataType.ExAttr1: |
| | | case PlayerDataType.ExAttr2: |
| | | DisplayLevel(); |
| | | break; |
| | | } |
| | | |
| | |
| | | autoCloseImg.SetActive(true); |
| | | autoOpenEffect.Stop(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | DisplayCard(TeamType.Story); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void DisplayLevel() |
| | | { |
| | | var value = PlayerDatas.Instance.baseData.ExAttr2; |
| | | var chapterID = value / 10000; |
| | | var levelNum = value % 10000 / 100; |
| | | var waveID = value % 100; |
| | | |
| | | var config = MainLevelConfig.GetMainLevelConfig(chapterID, levelNum); |
| | | var totalWave = MainLevelConfig.GetwaveCount(config); |
| | | for (int i = 0; i < mainLevelWaves.Length; i++) |
| | | { |
| | | if (i < totalWave) |
| | | { |
| | | mainLevelWaves[i].SetActive(true); |
| | | mainLevelWaves[i].Display(i); |
| | | } |
| | | else |
| | | { |
| | | mainLevelWaves[i].SetActive(false); |
| | | } |
| | | } |
| | | |
| | | mainLevelScrollRect.normalizedPosition = new Vector2(waveID > 3 ? 1 : 0, 0); |
| | | |
| | | var chapterConfig = MainChapterConfig.Get(chapterID); |
| | | //【普通】关卡名字1-6 |
| | | levelName.text = Language.Get("mainui7", chapterConfig.Level, chapterConfig.ChapterName, chapterID, levelNum); |
| | | |
| | | bool canChallengeBoss = AutoFightModel.Instance.CanChallengeBoss(); |
| | | //BOSS |
| | | if (canChallengeBoss) |
| | | { |
| | | bossActiveGo.SetActive(true); |
| | | processText.SetActive(false); |
| | | bossTween.Play(); |
| | | bitemeGo.SetActive(true); |
| | | bossmask.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | bossActiveGo.SetActive(false); |
| | | processText.SetActive(true); |
| | | processText.text = (waveID - 1) * 100 / totalWave + "%"; |
| | | bossTween.Stop(); |
| | | bitemeGo.SetActive(false); |
| | | bossmask.SetActive(false); |
| | | } |
| | | |
| | | } |
| | | |
| | | void DisplayRestState() |
| | | { |
| | | if (BattleManager.Instance.storyBattleField != null && |
| | | BattleManager.Instance.storyBattleField.GetBattleMode() == BattleMode.Stop) |
| | | { |
| | | //休息中 |
| | | restMark.SetActive(true); |
| | | fightMark.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | //战斗中 |
| | | restMark.SetActive(false); |
| | | fightMark.SetActive(true); |
| | | } |
| | | |
| | | } |
| | | |
| | | void ChangeMode(bool isFight) |
| | | { |
| | | if (isFight) |
| | | return; |
| | | DisplayRestState(); |
| | | DisplayLevel(); |
| | | } |
| | | |
| | | void GotoRest() |
| | | { |
| | | if (BattleManager.Instance.storyBattleField != null && |
| | | BattleManager.Instance.storyBattleField.GetBattleMode() != BattleMode.Stop) |
| | | { |
| | | BattleManager.Instance.storyBattleField.HaveRest(); |
| | | } |
| | | } |
| | | } |