|  |  |  | 
|---|
|  |  |  | [SerializeField] UIEffectPlayer fightEffect; | 
|---|
|  |  |  | [SerializeField] UIEffectPlayer openCloseAnim; | 
|---|
|  |  |  | [SerializeField] FillTween cdTween; | 
|---|
|  |  |  | int index = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public bool isFirstOpen = true; //首次打开 | 
|---|
|  |  |  | public Text hammerText; | 
|---|
|  |  |  | 
|---|
|  |  |  | UpdateCurrency(); | 
|---|
|  |  |  | UpdatePlayerInfo(); | 
|---|
|  |  |  | RefreshFightBtn(); | 
|---|
|  |  |  | DisplayTopBar(index); | 
|---|
|  |  |  | DisplayTopBar(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnPreOpen() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh; | 
|---|
|  |  |  | AutoFightModel.Instance.OnFightEvent += OnSkillCast; | 
|---|
|  |  |  | ChallengeTabWin.OnCloseChallengeTabWin += OnCloseChallengeTabWin; | 
|---|
|  |  |  | BattleManager.Instance.onBattleFieldCreate += OnBattleFieldCreate; | 
|---|
|  |  |  | BattleManager.Instance.onBattleFieldDestroy += OnBattleFieldDestroy; | 
|---|
|  |  |  | base.OnPreOpen(); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh; | 
|---|
|  |  |  | AutoFightModel.Instance.OnFightEvent -= OnSkillCast; | 
|---|
|  |  |  | ChallengeTabWin.OnCloseChallengeTabWin -= OnCloseChallengeTabWin; | 
|---|
|  |  |  | BattleManager.Instance.onBattleFieldCreate -= OnBattleFieldCreate; | 
|---|
|  |  |  | BattleManager.Instance.onBattleFieldDestroy -= OnBattleFieldDestroy; | 
|---|
|  |  |  | base.OnPreClose(); | 
|---|
|  |  |  | 
|---|
|  |  |  | Refresh(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnBattleFieldDestroy(string guid, BattleField battleField) | 
|---|
|  |  |  | private void OnBattleFieldDestroy() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Refresh(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnCloseChallengeTabWin() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | tabButtons[3].state = TitleBtnState.Normal; | 
|---|
|  |  |  | tabButtons[3].UpdateButtonState(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //外部调用点击功能 | 
|---|
|  |  |  | public void ClickFunc(int functionOrder) | 
|---|
|  |  |  | 
|---|
|  |  |  | tabButtons[functionOrder].SelectBtn(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void DisplayTopBar(int index) | 
|---|
|  |  |  | public void DisplayTopBar() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool isOtherBattleInProgress = BattleManager.Instance.IsOtherBattleInProgress(); | 
|---|
|  |  |  | switch (index) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | case 0: | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | topBar.SetActive(true); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | topBar.SetActive(false); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | topBar.SetActive(!isOtherBattleInProgress); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | topBar.SetActive(true); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | topBar.SetActive(functionOrder == 0 || functionOrder == 2); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void SelectBottomTab(int index) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TabChangeEvent?.Invoke(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 如果点击当前已选中的标签,不做处理 | 
|---|
|  |  |  | if (functionOrder == index && currentSubUI != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | ClickAnimation(index); | 
|---|
|  |  |  | // 更新当前选中的标签索引 | 
|---|
|  |  |  | functionOrder = index; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DisplayTopBar(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 关闭当前打开的子界面 | 
|---|
|  |  |  | CloseCurrentSubUI(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | protected override void OnTabButtonClicked(int index) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | this.index = index; | 
|---|
|  |  |  | int funcId = 32; | 
|---|
|  |  |  | bool isOtherBattleInProgress = BattleManager.Instance.IsOtherBattleInProgress(); | 
|---|
|  |  |  | // 如果正在非主线战斗中,没满足解锁条件则不允许切换 | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string tip = FuncOpen.Instance.GetErrorTip(funcId); | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip("SwitchOutOfBattle", tip); | 
|---|
|  |  |  | tabButtons[functionOrder].SelectBtn(); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DisplayTopBar(index); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SelectBottomTab(index); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|