| | |
| | | [SerializeField] UIEffectPlayer fightEffect; |
| | | [SerializeField] UIEffectPlayer openCloseAnim; |
| | | [SerializeField] FillTween cdTween; |
| | | [SerializeField] Transform nextCantAttackMask; |
| | | [SerializeField] Text hammerText; |
| | | [SerializeField] Text multiFightText; |
| | | |
| | |
| | | AutoFightModel.Instance.OnFightEvent += OnSkillCast; |
| | | RenameManager.Instance.OnUpdateRenameResultEvent += OnUpdateRenameResultEvent; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | GlobalTimeEvent.Instance.MSEvent += OnMSEvent; |
| | | EventBroadcast.Instance.AddListener<string>(EventName.BATTLE_START, OnBattleStart); |
| | | base.OnPreOpen(); |
| | | |
| | | // 刷新UI |
| | |
| | | AutoFightModel.Instance.OnFightEvent -= OnSkillCast; |
| | | RenameManager.Instance.OnUpdateRenameResultEvent -= OnUpdateRenameResultEvent; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | GlobalTimeEvent.Instance.MSEvent -= OnMSEvent; |
| | | EventBroadcast.Instance.RemoveListener<string>(EventName.BATTLE_START, OnBattleStart); |
| | | |
| | | base.OnPreClose(); |
| | | isForcePlayFightUIAnim = true; |
| | | } |
| | |
| | | { |
| | | if (currentSubUI != null && currentSubUI.name == "HomeWin") |
| | | { |
| | | fightEffect.Play(); |
| | | //手动自动一起处理 |
| | | AutoFightModel.Instance.StartFight(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | void OnBattleStart(string guid) |
| | | { |
| | | if (string.IsNullOrEmpty(guid)) |
| | | { |
| | | var tmpHero = TeamManager.Instance.GetTeam(TeamType.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 = tmpHero.SkinID; |
| | | fightHeroImg.SetOrgSprite(HeroSkinConfig.Get(AutoFightModel.Instance.fightingHeroSkinID).SquareIcon, "HeroHead"); |
| | | nextCantAttackMask.localScale = Vector3.one; |
| | | } |
| | | }); |
| | | fightHeroScale.SetStartState(); |
| | |
| | | } |
| | | |
| | | 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) |
| | |
| | | { |
| | | if (currentSubUI != null && currentSubUI.IsActive()) |
| | | { |
| | | // RestoreFuncBtn 造成 |
| | | //点击挑战标签又关闭时,会触发 RestoreFuncBtn 造成 |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (functionOrder != -1) |
| | | { |
| | | //主动点击功能栏的情况 |
| | | lastWinOrder = functionOrder; |
| | | } |
| | | |
| | | //lastWinOrder 是默认恢复使用 |
| | | if (lastWinOrder == -1) |
| | | { |
| | | lastWinOrder = 0; |