| | |
| | | [SerializeField] UIEffectPlayer fightEffect; |
| | | [SerializeField] UIEffectPlayer openCloseAnim; |
| | | [SerializeField] FillTween cdTween; |
| | | [SerializeField] Transform nextCantAttackMask; |
| | | [SerializeField] Text hammerText; |
| | | |
| | | [SerializeField] Text multiFightText; |
| | | |
| | | [SerializeField] Transform gameTip; //10连 |
| | | [SerializeField] Transform mgTip; |
| | | |
| | | bool isForcePlayFightUIAnim = true; //强制播放战斗锤子框动画 |
| | | |
| | | public static event Action TabChangeEvent; |
| | | protected override void InitComponent() |
| | | { |
| | | base.InitComponent(); |
| | | |
| | | avatarCell.button.AddListener(() => { }); |
| | | avatarCell.redpoint.redpointId = MainRedDot.PhantasmPavilionRepoint; |
| | | avatarCell.SetListener(() => |
| | | { |
| | | UIManager.Instance.OpenWindow<PlayerProfileWin>(); |
| | | }); |
| | | } |
| | | |
| | | void Display() |
| | |
| | | { |
| | | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh; |
| | | AutoFightModel.Instance.OnFightEvent += OnSkillCast; |
| | | RenameManager.Instance.OnUpdateRenameResultEvent += OnUpdateRenameResultEvent; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | GlobalTimeEvent.Instance.MSEvent += OnMSEvent; |
| | | RedpointCenter.Instance.redpointValueChangeEvent += OnRedpointValueChangeEvent; |
| | | var xbInfo = HappyXBModel.Instance.GetXBInfoByType((int)HappXBTitle.HeroCallAdvanced); |
| | | gameTip.SetActive(false); |
| | | if (xbInfo != null && xbInfo.treasureCount < GeneralDefine.herocall10TipLimit) |
| | | { |
| | | GlobalTimeEvent.Instance.fiveSecondEvent += OnFiveSecondEvent; |
| | | } |
| | | EventBroadcast.Instance.AddListener<string>(EventName.BATTLE_START, OnBattleStart); |
| | | base.OnPreOpen(); |
| | | |
| | | mgTip.SetActive(false); |
| | | // 刷新UI |
| | | Display(); |
| | | } |
| | |
| | | { |
| | | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh; |
| | | AutoFightModel.Instance.OnFightEvent -= OnSkillCast; |
| | | RenameManager.Instance.OnUpdateRenameResultEvent -= OnUpdateRenameResultEvent; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | GlobalTimeEvent.Instance.MSEvent -= OnMSEvent; |
| | | GlobalTimeEvent.Instance.fiveSecondEvent -= OnFiveSecondEvent; |
| | | EventBroadcast.Instance.RemoveListener<string>(EventName.BATTLE_START, OnBattleStart); |
| | | RedpointCenter.Instance.redpointValueChangeEvent -= OnRedpointValueChangeEvent; |
| | | |
| | | base.OnPreClose(); |
| | | isForcePlayFightUIAnim = true; |
| | | } |
| | | |
| | | private void OnUpdateRenameResultEvent() |
| | | { |
| | | Display(); |
| | | } |
| | | |
| | | void OnRedpointValueChangeEvent(int id) |
| | | { |
| | | if (id == (MainRedDot.RedPoint_Mingge * 10 + 4)) |
| | | { |
| | | mgTip.SetActive(MinggeManager.Instance.redpointAuto.state != RedPointState.None); |
| | | } |
| | | } |
| | | |
| | | |
| | | //用于10连提示,没有10连会取消时间事件委托 |
| | | void OnFiveSecondEvent() |
| | | { |
| | | if (HappyXBModel.Instance.bestXB10Red.state != RedPointState.None) |
| | | { |
| | | gameTip.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | gameTip.SetActive(false); |
| | | var xbInfo = HappyXBModel.Instance.GetXBInfoByType((int)HappXBTitle.HeroCallAdvanced); |
| | | if (xbInfo != null && xbInfo.treasureCount >= GeneralDefine.herocall10TipLimit) |
| | | { |
| | | GlobalTimeEvent.Instance.fiveSecondEvent -= OnFiveSecondEvent; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | void DisplayTopBar() |
| | | { |
| | | topBar.SetActive(functionOrder == 0 || functionOrder == 2); |
| | | } |
| | | |
| | | |
| | | void OnCloseWindow(UIBase _ui) |
| | | { |
| | | if (_ui.name == "AutoFightWin") |
| | | { |
| | | multiFightText.text = Language.Get("MultiFight", AutoFightModel.Instance.fightCost); |
| | | } |
| | | if (_ui.name == "MinggeWin") |
| | | { |
| | | mgTip.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | //战斗按钮动画 |
| | | void ClickAnimation(int index) |
| | | { |
| | |
| | | case PlayerDataType.default26: |
| | | hammerText.text = UIHelper.GetMoneyCnt(41).ToString(); |
| | | break; |
| | | |
| | | case PlayerDataType.ExAttr3: |
| | | officialRankText.InitUI(PlayerDatas.Instance.baseData.realmLevel, PlayerDatas.Instance.baseData.TitleID); |
| | | break; |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | if (currentSubUI != null && currentSubUI.name == "HomeWin") |
| | | { |
| | | fightEffect.Play(); |
| | | //手动自动一起处理 |
| | | AutoFightModel.Instance.StartFight(); |
| | | } |
| | |
| | | { |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | ClickAnimation(index); |
| | | // 更新当前选中的标签索引 |
| | |
| | | currentSubUI = UIManager.Instance.OpenWindow<AffairBaseWin>(); |
| | | break; |
| | | case 2: |
| | | if (gameTip.gameObject.activeSelf) |
| | | { |
| | | if (!NewBieCenter.Instance.inGuiding) |
| | | { |
| | | HappyXBModel.Instance.startTenCallGuide = true; |
| | | } |
| | | } |
| | | currentSubUI = UIManager.Instance.OpenWindow<HeroBaseWin>(0); |
| | | break; |
| | | // case 3: |
| | |
| | | fightOtherWinBG.SetActive(false); |
| | | fightOtherWinWarnImg.SetActive(false); |
| | | fightBG.SetActive(true); |
| | | multiFightText.text = Language.Get("MultiFight", AutoFightModel.Instance.fightCost); |
| | | |
| | | |
| | | if (BattleManager.Instance.storyBattleField != null && |
| | |
| | | { |
| | | //非主城界面 |
| | | fightOtherWinBG.SetActive(true); |
| | | multiFightText.text = ""; |
| | | fightBG.SetActive(false); |
| | | if (BattleManager.Instance.storyBattleField != null && |
| | | BattleManager.Instance.storyBattleField.GetBattleMode() == BattleMode.Stop) |
| | |
| | | } |
| | | } |
| | | |
| | | void OnBattleStart(string guid) |
| | | { |
| | | if (string.IsNullOrEmpty(guid)) |
| | | { |
| | | var tmpHero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetNextServerHero(""); |
| | | if (tmpHero != null) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = tmpHero.SkinID; |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("没有找到下一个攻击武将"); |
| | | return; |
| | | } |
| | | |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | } |
| | | } |
| | | |
| | | void RefreshFightIng(bool isfighting = false) |
| | | { |
| | | if (isfighting) |
| | | { |
| | | fightEffect.Play(); |
| | | if (!fightEffect.isPlaying) |
| | | fightEffect.Play(); |
| | | nextCantAttackMask.localScale = Vector3.zero; |
| | | cdTween.SetStartState(); |
| | | cdTween.Play(() => |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = TeamManager.Instance.GetTeam(TeamType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid).SkinID; |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | var tmpHero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid); |
| | | if (tmpHero != null) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = tmpHero.SkinID; |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | nextCantAttackMask.localScale = Vector3.one; |
| | | } |
| | | }); |
| | | fightHeroScale.SetStartState(); |
| | | fightHeroScale.Play(); |
| | |
| | | |
| | | if (AutoFightModel.Instance.fightingHeroSkinID == 0) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = TeamManager.Instance.GetTeam(TeamType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid).SkinID; |
| | | var tmpHero = TeamManager.Instance.GetTeam(BattlePreSetType.Story).GetNextServerHero(AutoFightModel.Instance.heroGuid); |
| | | if (tmpHero != null) |
| | | { |
| | | AutoFightModel.Instance.fightingHeroSkinID = tmpHero.SkinID; |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("没有找到下一个攻击武将"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | } |
| | | |
| | | void OnMSEvent() |
| | | { |
| | | if (nextCantAttackMask.localScale == Vector3.one) |
| | | { |
| | | if (BattleManager.Instance.storyBattleField.IsCanRequestFight()) |
| | | { |
| | | nextCantAttackMask.localScale = Vector3.zero; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void OnSkillCast(bool isfighting) |
| | |
| | | public void RestoreSubUI() |
| | | { |
| | | if (functionOrder != -1) |
| | | return; |
| | | { |
| | | if (currentSubUI != null && currentSubUI.IsActive()) |
| | | { |
| | | //点击挑战标签又关闭时,会触发 RestoreFuncBtn 造成 |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (functionOrder != -1) |
| | | { |
| | | //主动点击功能栏的情况 |
| | | lastWinOrder = functionOrder; |
| | | } |
| | | |
| | | //lastWinOrder 是默认恢复使用 |
| | | if (lastWinOrder == -1) |
| | | { |
| | | lastWinOrder = 0; |
| | | } |
| | | |
| | | OnTabButtonClicked(lastWinOrder); |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | } |