local UIBattleAttackPanel = UIViewClass() local ColorOne = Color.New(1,1,1,1) local ColorRed = Color.New(1,0,0,1) local EventSystem = require('Event/EventSystem') local CONST_CLICKEFFECT_INTERNAL = 0.3 local Battle_Camera_Target = "Battle_Camera_Target" local Battle_Camera_TargetPressed = "Battle_Camera_TargetPressed" local ChargeUIImagePath = ConstAssetPathConfig.ChargeUIImagePath local CDBgNormal_cding = ConstAssetPathConfig.CDBgNormal_cding local CDBgNormal_noCD = ConstAssetPathConfig.CDBgNormal_noCD local Const_SlashBtnIcon = ConstAssetPathConfig.Const_SlashBtnIcon local LuaConst = LuaConst local SkillKeyPosition = LuaConst.ESkillKeyPosition local ESkillKeyStyle = LuaConst.ESkillKeyStyle local ESkillJoystickUEType=LuaConst.ESkillJoystickUEType local DriveExtraUIType_UIAim=LuaConst.DriveExtraUIType.UIAim; local SkillType_AdjutantMusou=LuaConst.SkillType.AdjutantMusou local SkillType_Serial = LuaConst.SkillType.Serial local SkillType_Charge=LuaConst.SkillType.Charge local SkillType_Enegy = LuaConst.SkillType.Enegy local SkillType_Roulette = LuaConst.SkillType.Roulette local RealtimeAttrType_sa=LuaConst.RealtimeAttrType.sa local AttrType_salmt=LuaConst.AttrType.salmt local tonumberV1=FP.tonumberV1 local UIUtils=UIUtils local FREEZE_FRAME_WHEN_CHANGE_SKILLBTN_STYLE = 20 local ButtonHideMode= { [1] = {SkillKeyPosition.Skill1,SkillKeyPosition.Skill2,SkillKeyPosition.MusouNormal,SkillKeyPosition.Dodge,SkillKeyPosition.Adjutant}, -- 只显示普攻和计略技能 [2] = {SkillKeyPosition.Skill1,SkillKeyPosition.Skill2,SkillKeyPosition.MusouNormal,SkillKeyPosition.Dodge}, -- 显示普攻和副将技能和计略技能 } local SKILL_KEY_NAME_GROUPS = { --这里面的顺序一旦确定就不允许再修改了 [ESkillKeyStyle.COMMON_FOUR_KEY] = { groupName = "group_FourSkill", info_Slash = "info_Slash", info_Dodge = "info_Dodge", info_Skill1 = "info_Skill1", info_Skill2 = "info_Skill2", info_Musou = "info_Musou", info_Adjutant = "info_Adjutant", info_StratagemSkill = "info_StratagemSkill", info_LightEffectSkill = "info_LightEffectSkill", changeAnimTo2 = "UIFourToFive", showSkillKeyStyles = {[ESkillKeyStyle.COMMON_FOUR_KEY] = ESkillKeyStyle.COMMON_FOUR_KEY, [ESkillKeyStyle.COMMON_FIVE_KEY] = ESkillKeyStyle.COMMON_FIVE_KEY}, }, [ESkillKeyStyle.COMMON_FIVE_KEY] = { groupName = "group_FiveSkill", info_Slash = "info_Slash", info_Dodge = "info_Dodge", info_Skill1 = "info_Skill1_2", info_Skill2 = "info_Skill2_2", info_Skill3 = "info_Skill3_2", info_Musou = "info_Musou_2", info_Adjutant = "info_Adjutant_2", info_StratagemSkill = "info_StratagemSkill_2", info_LightEffectSkill = "info_LightEffectSkill_2", changeAnimTo1 = "UIFiveToFour", showSkillKeyStyles = {[ESkillKeyStyle.COMMON_FOUR_KEY] = ESkillKeyStyle.COMMON_FOUR_KEY, [ESkillKeyStyle.COMMON_FIVE_KEY] = ESkillKeyStyle.COMMON_FIVE_KEY}, }, [ESkillKeyStyle.COMMON_SIX_KEY] = { groupName = "group_SixSkill", info_Slash = "info_Slash", info_Dodge = "info_Skill1_3", info_Skill1 = "info_Skill2_3", info_Skill2 = "info_Skill3_3", info_Skill3 = "info_Skill4_3", info_Musou = "info_Musou_3", info_Adjutant = "info_Adjutant_3", info_StratagemSkill = "info_StratagemSkill_3", info_LightEffectSkill = "info_LightEffectSkill_3", changeAnimTo1 = "UIFiveToFour", changeAnimTo2 = "UIFourToFive", showSkillKeyStyles = {[ESkillKeyStyle.COMMON_SIX_KEY] = ESkillKeyStyle.COMMON_SIX_KEY}, }, } -- 按键实际位置到技能配置的映射 local SKILL_BTN_POSITION_GROUP = { [LuaConst.ESkillKeyStyle.COMMON_FOUR_KEY] = { [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_NORMAL] = SkillKeyPosition.Slash, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_1] = SkillKeyPosition.Skill1, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_2] = SkillKeyPosition.Skill2, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_3] = SkillKeyPosition.MusouNormal, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_4] = SkillKeyPosition.Adjutant, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_DODGE] = SkillKeyPosition.Dodge, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_STRATAGEM] = SkillKeyPosition.Stratagem, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_FAXIANG] = SkillKeyPosition.BuffSkill1, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_GODBEAST] = SkillKeyPosition.BuffSkill2, }, [LuaConst.ESkillKeyStyle.COMMON_FIVE_KEY] = { [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_NORMAL] = SkillKeyPosition.Slash, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_DODGE] = SkillKeyPosition.Skill1,--故意这样写的,目前是为吕布变身后使用,闪避键位被替换成了一个技能 [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_1] = SkillKeyPosition.Skill2, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_2] = SkillKeyPosition.Skill3, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_3] = SkillKeyPosition.MusouNormal, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_4] = SkillKeyPosition.Adjutant, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_STRATAGEM] = SkillKeyPosition.Stratagem, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_FAXIANG] = SkillKeyPosition.BuffSkill1, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_GODBEAST] = SkillKeyPosition.BuffSkill2, }, [ESkillKeyStyle.COMMON_SIX_KEY] = { [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_NORMAL] = SkillKeyPosition.Slash, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_DODGE] = SkillKeyPosition.Dodge, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_1] = SkillKeyPosition.Skill1, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_2] = SkillKeyPosition.Skill2, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_3] = SkillKeyPosition.Skill3, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_4] = SkillKeyPosition.MusouNormal, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_5] = SkillKeyPosition.Adjutant, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_STRATAGEM] = SkillKeyPosition.Stratagem, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_FAXIANG] = SkillKeyPosition.BuffSkill1, [LuaConst.KeyMapEnum.EW_KEYMAP_SKILL_BTN_GODBEAST] = SkillKeyPosition.BuffSkill2, } } function UIBattleAttackPanel:OnCreated() self.isCheatModel = false self.ProofCDList = {} -- 需要校验CD的技能 self.proofTimer = 0 self.curSkillKeyNameGroup = SKILL_KEY_NAME_GROUPS[LuaConst.ESkillKeyStyle.COMMON_FOUR_KEY] self:ResetSkillKeyNameGroup(true) self.skillJoystickOverrideDic = {} --key=原始双摇杆技能ID,value=替换后的双摇杆技能ID self.godBeastPointSelectList = {self.img_selected1, self.img_selected2, self.img_selected3} self.godBeastPointUnSelectList = {self.img_Unselect1, self.img_Unselect2, self.img_Unselect3} end function UIBattleAttackPanel:OnOpened(context) self.thisTrans = self.gameObject.transform self:RegistTriggerEvent(self.info_Dodge.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Dodge.event_Button, UIEventTriggerType.PointerUp) -- self:RegistTriggerEvent(self.info_Dodge.event_Button1, UIEventTriggerType.PointerDown) -- self:RegistTriggerEvent(self.info_Dodge.event_Button1, UIEventTriggerType.PointerUp) -- self:RegistTriggerEvent(self.info_Dodge.event_Button2, UIEventTriggerType.PointerDown) -- self:RegistTriggerEvent(self.info_Dodge.event_Button2, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Dodge.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Dodge.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Slash.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Slash.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Slash.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Slash.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill1.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill1.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill1.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill1.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill2.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill2.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Musou.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Musou.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Musou.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Musou.event_Button, UIEventTriggerType.EndDrag) --新增副将技双摇杆↓ self:RegistTriggerEvent(self.info_Adjutant.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Adjutant.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Adjutant.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Adjutant.event_Button, UIEventTriggerType.Drag) --新增副将技双摇杆↑ --新增神兽技双摇杆↓ self:RegistTriggerEvent(self.info_BeastSkill.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_BeastSkill.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_BeastSkill.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_BeastSkill.event_Button, UIEventTriggerType.Drag) --新增神兽技双摇杆↑ self:RegistTriggerEvent(self.info_StratagemSkill.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_StratagemSkill.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_LightEffectSkill.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_LightEffectSkill.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_BeastSkill.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_BeastSkill.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill1_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill1_2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill1_2.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill1_2.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill2_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill2_2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill2_2.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill2_2.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill3_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill3_2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill3_2.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill3_2.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Musou_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Musou_2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Musou_2.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Musou_2.event_Button, UIEventTriggerType.EndDrag) --新增副将技双摇杆↓ self:RegistTriggerEvent(self.info_Adjutant_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Adjutant_2.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Adjutant_2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Adjutant_2.event_Button, UIEventTriggerType.Drag) --新增副将技双摇杆↑ self:RegistTriggerEvent(self.info_StratagemSkill_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_StratagemSkill_2.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_StratagemSkill_2.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_StratagemSkill_2.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_LightEffectSkill_2.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_LightEffectSkill_2.event_Button, UIEventTriggerType.PointerUp) --region 六键技能(如:诸葛亮) self:RegistTriggerEvent(self.info_Skill1_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill1_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill1_3.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill1_3.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill2_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill2_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill2_3.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill2_3.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill3_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill3_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill3_3.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill3_3.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Skill4_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Skill4_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Skill4_3.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Skill4_3.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Musou_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Musou_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Musou_3.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_Musou_3.event_Button, UIEventTriggerType.EndDrag) --新增副将技双摇杆↓ self:RegistTriggerEvent(self.info_Adjutant_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_Adjutant_3.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_Adjutant_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_Adjutant_3.event_Button, UIEventTriggerType.Drag) --新增副将技双摇杆↑ self:RegistTriggerEvent(self.info_StratagemSkill_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_StratagemSkill_3.event_Button, UIEventTriggerType.EndDrag) self:RegistTriggerEvent(self.info_StratagemSkill_3.event_Button, UIEventTriggerType.PointerUp) self:RegistTriggerEvent(self.info_StratagemSkill_3.event_Button, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.info_LightEffectSkill_3.event_Button, UIEventTriggerType.PointerDown) self:RegistTriggerEvent(self.info_LightEffectSkill_3.event_Button, UIEventTriggerType.PointerUp) --endregion self:RegistSystemEvent(EventID.TimeLine_Update, self.OnTimeLine) --三选1 self.skillRoulette = {self.pointerEnter_Green, self.pointerEnter_White, self.pointerEnter_Red} self.skillRoulette_ZuoCi = {self.pointerEnter_Green_ZuoCi, self.pointerEnter_White_ZuoCi, self.pointerEnter_Red_ZuoCi} self.skillRouletteName2CompDic = {} for i,v in ipairs(self.skillRoulette) do --self:RegistTriggerEvent(v, UIEventTriggerType.Drop) self:RegistTriggerEvent(v, UIEventTriggerType.Drag) self.skillRouletteName2CompDic[v.name] = v end self.skillRouletteZuoCiName2CompDic = {} for i,v in ipairs(self.skillRoulette_ZuoCi) do self:RegistTriggerEvent(v, UIEventTriggerType.Drag) self.skillRouletteZuoCiName2CompDic[v.name] = v end UIUtils.SetActive(self.group_Bg.gameObject, false) UIUtils.SetActive(self.group_Bg_ZuoCi.gameObject, false) UIUtils.SetActive(self.cancel_area.gameObject, false) self:InitBtn() self:StartRepeatFunc(self.OnUpdateFun, 0) --self:ShowDriveBtn(false) --UIUtils.SetActive(self.event_OffDrive.gameObject,false) UIUtils.SetActive(self.sprite_Aim,false) UIUtils.SetActive(self.event_Camera,false) UIUtils.SetActive(self.event_CameraSwitchTarget, false) self.effect_AutoFight:StopUIEffect() UIUtils.SetActiveByScale(self.obj_NormalSkill,true) self:ResetBtns() self:RegistSystemEvent(EventID.Level_SwitchHero,self.OnSwitchHero) self:RegistSystemEvent(EventID.UIBattle_AttackPad_UpdateMusouState,self.UpdateMusouState) self:RegistSystemEvent(EventID.Player_SkillCoolDown,self.UpdateSkillCD) self:RegistSystemEvent(EventID.Player_InterruptSkill, self.OnPlayerInterruptSkill) self:RegistSystemEvent(EventID.Player_AdjutantCoolDown,self.UpdateAdjutantCD) self:RegistSystemEvent(EventID.Player_StratagemSkillCoolDown,self.UpdateStratagemSkillCD) self:RegistSystemEvent(EventID.Player_SkillProgress,self.UpdateSkillProgress) self:RegistSystemEvent(EventID.Level_Pause, self.PauseCD) self:RegistSystemEvent(EventID.Level_HideSkillInput, self.HideSkillBtns) self:RegistSystemEvent(EventID.Player_ChargeSkillSub,self.ChargeSkillSub) self:RegistSystemEvent(EventID.Player_ChargeSkillAdd,self.ChargeSkillAdd) self:RegistSystemEvent(EventID.Player_ReplaceSkill,self.ReplaceNormalSkill) self:RegistSystemEvent(EventID.Player_SkillEnegyChanged,self.OnSkillEnegyChanged) self:RegistSystemEvent(EventID.Set_CurEntity, self.OnEntityChanged) self:RegistSystemEvent(EventID.Player_SetSkillList, self.ResetBtns) self:RegistSystemEvent(EventID.Camera_TargetStart, self.EnableTargetCameraButton) self:RegistSystemEvent(EventID.Camera_TargetEnd, self.DisableTargetCameraButton) self:RegistSystemEvent(EventID.Camera_TargetChangePattern, self.OnTargetCameraPatternChange) self:RegistSystemEvent(EventID.Camera_TargetPrepareEntity, self.OnTargetCameraPrepareEntity) self:RegistSystemEvent(EventID.Player_DriveEntity, self.ResetDriveSkillBtns) self:RegistSystemEvent(EventID.Player_OffDriveEntity, self.ResetOffDriveSkillBtns) self:RegistSystemEvent(EventID.UIBattle_Drive_Collimator, self.SetCollimator) self:RegistSystemEvent(EventID.Player_BanKeyPositions, self.OnBanKeyPositions) self:RegistSystemEvent(EventID.Player_CancelBanKeyPosition, self.OnCancelBanKeyPosition) self:RegistSystemEvent(EventID.UIBattle_MainPlayerAutoFightChanged, self.OnAutoFightStateChanged) self:RegistSystemEvent(EventID.UI_Guide_ResetSlashBtn,self.ResetSlashBtn) self:RegistSystemEvent(EventID.UI_KeyboardControl_Skill_Press, self.KeyboardPressSkill) self:RegistSystemEvent(EventID.UI_KeyboardControl_Skill_Release, self.KeyboardReleaseSkill) self:RegistSystemEvent(EventID.UI_EnterCheatModel, self.EnterCheatModel) self:RegistSystemEvent(EventID.UI_Auto_Fight, self.RefreshShowAutoFightTips) self:RegistSystemEvent(EventID.UI_MainEntityAddSpecialViewBuff,self.OnMainEntityAddSpecialViewBuff) self:RegistSystemEvent(EventID.UI_MainEntityRemoveSpecialViewBuff,self.OnMainEntityRemoveSpecialViewBuff) self:RegistSystemEvent(EventID.Player_BelongSkillProgress,self.BelongSkillProgress ) self:RegistSystemEvent(EventID.UIBattle_ShowOrHideSkillProgress, self.SkillProgress_BattleEffect) self:RegistSystemEvent(EventID.Player_ChangeAvatar,self.OnPlayerChangeAvatar) -- 道具相关 ↓ self:RegistSystemEvent(EventID.UIBattle_AddNewBattleProp, self.ResetBattlePropBtn) self:RegistSystemEvent(EventID.UIBattle_FinishUseBattleProp, self.ResetBattlePropBtn) self:RegistSystemEvent(EventID.UIBattle_AbortUseBattleProp, self.ResetBattlePropBtn) self:RegistSystemEvent(EventID.UIBattle_StartUseBattleProp, self.StartUseBattleProp) self:RegistSystemEvent(EventID.UIBattle_RefreshBattleProp, self.ResetBattlePropBtn) -- 道具相关 ↑ self:RegistSystemEvent(EventID.UIBattle_OnBuffSkillCDReady, self.OnBuffSkillCDReady) self:RegistSystemEvent(EventID.UIBattle_OnBuffSkillEnterCD, self.OnBuffSkillEnterCD) self:RegistSystemEvent(EventID.UIBattle_OnSwitchGodBeastSkill, self.OnSwitchGodBeastSkill) self:RegistSystemEvent(EventID.UIBattle_OnAddBuffSkill, self.OnAddBuffSkill) self:RegistSystemEvent(EventID.UIBattle_OnReplaceBuffSkill, self.OnReplaceBuffSkill) self:RegistSystemEvent(EventID.SetSkillMaxChargetCount, self.OnSetSkillMaxChargetCount) self:RegistSystemEvent(EventID.UIBattle_SkillJoystickSetDragging, self.OnSkillJoystickSetDragging) self:RegistSystemEvent(EventID.UIBattle_SetOverrideSkillJoystick, self.SetOverrideSkillJoystick) self:RegistSystemEvent(EventID.UI_BattleAttack_ResetBtn, self.OnSkillDecoratorResetBtn) self:RegistSystemEvent(EventID.Timeline_OnFinish, self.OnTimelineFinish) local levelInfo = BattleDataGetter.GetLevelInfoData() if levelInfo then self.canAutoFight = levelInfo.AutoBattle end self.isPass = (not levelInfo.AutoBattleFirstPass) and true or MDL.Level.GetLevelPassDataById(levelInfo.LevelID) self.canAutoFight = self.canAutoFight and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.AutoFight) self.canAutoFight = self.canAutoFight and self:IsCurLevelCanAutoFight() UIUtils.SetActive(self.event_AutoFight, self.canAutoFight or false) UIUtils.SetActive(self.AutomaticWayfinding, false) self.canAutoFight = self.canAutoFight and self.isPass if not BattleDataGetter.ShouldKeepSyncLevel() and self.canAutoFight then self:SetPveAutoFightState(BattleDataGetter.GetInitAutoFightState()) elseif ( BattleDataGetter.IsWorldBossLevel() or BattleDataGetter.IsWarZoneWorldBossLevel()) and self.canAutoFight then local autoFightState = BattleDataGetter.GetAutoFightState() and not BattleDataGetter.AutoFightIsSystemLevel() local isAutoFight, isExist = CTL.Level.GetIsAutoFight(BattleDataGetter.GetCurLevelType()) if (not isExist or CTL.Level.GetIsAutoFight(BattleDataGetter.GetCurLevelType())) and not autoFightState then LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.AutoFight) end else self:RefreshAutoFightEffect() if not self.canAutoFight then LuaInputManager.EnqueueSpecialCommand(LuaConst.SpecialCommandType.StopAutoFight) end end self.KeyboardEventData={position={}} self.isShowNormalAttackRange = LevelManager.IsPVPLevel() -- 是否展示普攻的特效 self.slashDownTimer = nil -- 普攻按钮按下的时长 self.isSkillJoystickDragging = false --如果是上车状态时打开了这个界面, 需要显示车的技能 if LogicUpdateManager._curEntity then local carEntity = LogicUpdateManager._curEntity.components.drive:GetDrivedEntity() if carEntity then self:ResetDriveSkillBtns(carEntity, LogicUpdateManager._curEntity) end UIUtils.SetActive(self.group_BattleProp.gameObject,LogicUpdateManager._curEntity.components.battleProp:GetBattlePropTotalNum() ~= 0 and (not carEntity)) end self.event_CameraSwitchTarget.enabled = true self.skillBarSplits = {self.skillBar.Split1.gameObject, self.skillBar.Split2.gameObject, self.skillBar.Split3.gameObject, self.skillBar.Split4.gameObject} -- 目前4个够用了 self.skillBarSplitsEffect = {self.skillBar.effect_1, self.skillBar.effect_2, self.skillBar.effect_3, self.skillBar.effect_4} -- 目前4个够用了 UIUtils.SetActive(self.skillBar.slider_Skill ,false) self:HideIdsInReplay() UIUtils.SetActive(self.img_ProgressBg, false) if GameAppInfo.IsPCOrMacPackage() then local canvasGroup = self.group_Button.gameObject:GetComponent(typeof(UnityEngine.CanvasGroup)) local pcAlpha = 0.75 canvasGroup.alpha = pcAlpha if GameAppInfo.IsVersionGreaterThan121000() then self.info_Musou.effect_Ready.EffectAlpha = pcAlpha end end end function UIBattleAttackPanel:HideIdsInReplay() local curInfo_Dodge = self.curSkillKeyNameGroup.info_Dodge and self[self.curSkillKeyNameGroup.info_Dodge] or self.info_Dodge local dodgeIds = curInfo_Dodge.gameObject.transform:Find("txt_SkillType").gameObject if BattleDataGetter.IsForbidSkillBtnView() then UIUtils.SetActive(dodgeIds,false) else UIUtils.SetActive(dodgeIds,true) end local adjutantIds = self[self.curSkillKeyNameGroup["info_Adjutant"]].gameObject.transform:Find("group_Info/txt_SkillType").gameObject if BattleDataGetter.IsForbidSkillBtnView() then UIUtils.SetActive(adjutantIds,false) else UIUtils.SetActive(adjutantIds,true) end end function UIBattleAttackPanel:IsCurLevelCanAutoFight() local curLevelCanAutoFight = true if BattleDataGetter.IsWorldBossLevel() or BattleDataGetter.IsWarZoneWorldBossLevel() then curLevelCanAutoFight = CTL.WarZone.IsWarZoneOpen() end if BattleDataGetter.IsWarZoneWorldBossLevel() then local limitLevel = DataSheetManager.ConstData:GetDataByID("ZoneBossOpenAutoBattle").IntValue curLevelCanAutoFight = MDL.Player.GetRoleLevel() >= limitLevel end if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.SyncDigTeamPVE) then -- 挖宝-组队副本 local playerInfo = LevelPlayerManager.GetPlayerInfoByPlayerIDInRoom(LevelPlayerManager.MyPlayerIDInRoom) curLevelCanAutoFight = not playerInfo.isFirstTeamDigTreasure end return curLevelCanAutoFight end function UIBattleAttackPanel:SetSkillKeyNameGroupByStyle(skillKeyStyle, isOnCreate) local changed = false local nameGroup = SKILL_KEY_NAME_GROUPS[skillKeyStyle] if nameGroup then if self.curSkillKeyNameGroup ~= nameGroup or isOnCreate then if self.curSkillKeyNameGroup then local changeAnim = self.curSkillKeyNameGroup["changeAnimTo" .. skillKeyStyle] if changeAnim then if self.oldChangeAnimHandle then self:StopUIAnimation(self.oldChangeAnimHandle, nil, true) end self.oldChangeAnimHandle = self:PlayUIAnimation(changeAnim) else logging.warn(LTAG.WARN, "HYW : changeAnim nil Error! curSkillKeyStyle : ", self.curSkillKeyStyle, " to style : ", skillKeyStyle) end end changed = true self.curSkillKeyNameGroup = nameGroup self.curSkillKeyStyle = skillKeyStyle self.validFrameCountdown = FREEZE_FRAME_WHEN_CHANGE_SKILLBTN_STYLE --变身后FREEZE_FRAME_WHEN_CHANGE_SKILLBTN_STYLE帧内禁用技能按键,不然容易出bug UIUtils.SetActive(self.group_Bg_ZuoCi.gameObject, false) UIUtils.SetActive(self.group_Bg.gameObject, false) UIUtils.SetActive(self.cancel_area.gameObject, false) end else logging.error(LTAG.ERROR, "HYW : nameGroup nil Error!! @UIBattleAttackPanel:SetSkillKeyNameGroupByStyle skillKeyStyle : ", skillKeyStyle) end return changed end function UIBattleAttackPanel:PauseCD(pause) if pause then for i,v in pairs(self.attackBtns) do if v.btnCollection.sprite_Mask then v.btnCollection.sprite_Mask:PauseTimer() end if v.btnCollection.sprite_Circle and not v.isMusou then v.btnCollection.sprite_Circle:PauseTimer() end if v.IsChargeSkill then v.btnCollection.img_ChargeBar:PauseTimer() end end self.paused = true else if not self.paused then --没暂停 ,别给我开 return end self.paused = false for i,v in pairs(self.attackBtns) do if v.btnCollection.sprite_Mask then v.btnCollection.sprite_Mask:ResumeTimer() end if v.btnCollection.sprite_Circle and not v.isMusou then v.btnCollection.sprite_Circle:ResumeTimer() end if v.IsChargeSkill then v.btnCollection.img_ChargeBar:ResumeTimer() end end end end function UIBattleAttackPanel:OnUpdateFun(deltaTime, time) if self.validFrameCountdown then self.validFrameCountdown = self.validFrameCountdown - 1 if self.validFrameCountdown <= 0 then self.validFrameCountdown = nil end end if self.leftJoySkillJoyStickData then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_InitStaticJoy, self.leftJoySkillJoyStickData, self.leftJoyStaticSkillData) self.leftJoySkillJoyStickData = nil end for _, btn in pairs(self.attackBtns) do if btn.ueType == ESkillJoystickUEType.SIMPLE_BTN or btn.ueType == ESkillJoystickUEType.DEFAULT or btn.ueType == ESkillJoystickUEType.JOYSTICK_RANGE_STATIC_RANGE then if btn.inPress and btn.keyPosition == SkillKeyPosition.Slash then if btn.timer <0 then btn.timer = CONST_CLICKEFFECT_INTERNAL btn.btnCollection.effect_Click:PlayUIEffect() else btn.timer = btn.timer - deltaTime end end end if btn.releaseAttackKeyFrame and BattleDataGetter.GetCurFrameIndex() >= btn.releaseAttackKeyFrame then btn.releaseAttackKeyFrame = nil LuaInputManager.ReleaseAttackKeyIfPressing(btn.keyPosition) end -- 充能特效计时关闭 if btn.closeChargeEffFrame and BattleDataGetter.GetCurFrameIndex() >= btn.closeChargeEffFrame then btn.closeChargeEffFrame = nil UIUtils.SetActive(btn.btnCollection.img_ChargeEff , false) end end --[[ if self.slashDownTimer then self.slashDownTimer = self.slashDownTimer + deltaTime if self.slashDownTimer > 0.5 then self:ShowNormalAttackRange() self.slashDownTimer = nil end end --]] if self.skillBarTotalTime then local beforVal = self.skillBarCurTime / self.skillBarTotalTime self.skillBarCurTime = self.skillBarCurTime + deltaTime local sliderVal = self.skillBarCurTime / self.skillBarTotalTime self.skillBar.slider_Skill.value = sliderVal for i,time in ipairs(self.skillBarEffectTimeList) do if sliderVal >= time and beforVal < time then if i == #self.skillBarEffectTimeList then self.skillBar.effect_total:PlayUIEffect() end self.skillBarSplitsEffect[i]:PlayUIEffect() break end end end if not self.paused then --没暂停 ,别给我开 self.proofTimer = self.proofTimer + deltaTime if self.proofTimer > 2 then self.proofTimer = 0 self:ProofCDTime() end end if LogicUpdateManager._curEntity then local curSkillData = LogicUpdateManager._curEntity.components.skillBase.CurSkillData if curSkillData then if curSkillData.AutoNextConditionStr == "pointerUp" then local belongSkill = BattleDataGetter.GetCurSkillUIEntity():GetSkillData(curSkillData.BelongTo) local skillButton = self:GetSkillBtnByKeyPos(belongSkill.KeyPosition) if not skillButton.inPress then if not LogicUpdateManager._curEntity.components.autoFight:IsAuto() then if curSkillData.AutoNextID > 0 then local nextSkillData = BattleDataGetter.GetCurSkillUIEntity():GetSkillData(curSkillData.AutoNextID) LuaInputManager.SetKeyPosition(nextSkillData.KeyPosition, true) elseif curSkillData.AutoNextID == LuaConst.InterruptSkillAutoNextID then LuaInputManager.EnqueueSpecialCommand(LuaConst.SpecialCommandType.SkillBtnPointerUp) else logging.error(LTAG.ERROR, "HYW : AutoNextID bad value Error! SkillID : ", curSkillData.ID) end end end end end end end --技能按钮有多 --rawName传不带后缀的UI组件名称,是prefab里group_FourSkill里的组件名称 --返回真正的UI组件对象,比如使用了SKILL_KEY_NAME_GROUPS[2]作为当前的btnSet,就会返回对应的group_FiveSkill里的加了_2后缀的UI组件 function UIBattleAttackPanel:GetUIComponentOfSkillBtnSet(rawName) if rawName then return self[self.curSkillKeyNameGroup[rawName]] end end function UIBattleAttackPanel:InitBtn() --以下为变量 self.sprite_Drive = self.event_Drive.gameObject:GetComponent(typeof(Image)) self:InitSkillBtn() end function UIBattleAttackPanel:InitSkillBtn() if self.attackBtns then self.lastAttackBtns = self.attackBtns --把上一组按钮信息存起来,用来处理一些边界情况,这些情况下需要使用上一组按钮信息,比如触发了InitSkillBtn的pointerDown之后的pointerUp end --初始化 self.attackBtns = {} self.attackBtns[SkillKeyPosition.Slash] = { btnCollection = self[self.curSkillKeyNameGroup["info_Slash"]], keyPosition = SkillKeyPosition.Slash, isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } self.attackBtns[SkillKeyPosition.Skill1] = { btnCollection = self[self.curSkillKeyNameGroup["info_Skill1"]], isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } self.attackBtns[SkillKeyPosition.Skill2] = { btnCollection = self[self.curSkillKeyNameGroup["info_Skill2"]], isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } local skill3Btn = self:GetUIComponentOfSkillBtnSet("info_Skill3") if skill3Btn then self.attackBtns[SkillKeyPosition.Skill3] = { btnCollection = skill3Btn, isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } else self.attackBtns[SkillKeyPosition.Skill3] = nil end self.attackBtns[SkillKeyPosition.MusouNormal] = { btnCollection = self[self.curSkillKeyNameGroup["info_Musou"]], skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } if self.curSkillKeyStyle == LuaConst.ESkillKeyStyle.COMMON_FIVE_KEY then --默认5键风格没有无双技能, isMusou设为false self.attackBtns[SkillKeyPosition.MusouNormal].isMusou = false else self.attackBtns[SkillKeyPosition.MusouNormal].isMusou = true end self.attackBtns[SkillKeyPosition.Dodge] = { btnCollection = self.curSkillKeyNameGroup["info_Dodge"] and self[self.curSkillKeyNameGroup["info_Dodge"]] or self.info_Dodge, isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } local adjutantBtnCollection = self[self.curSkillKeyNameGroup["info_Adjutant"]] self.attackBtns[SkillKeyPosition.Adjutant] = { btnCollection = self[self.curSkillKeyNameGroup["info_Adjutant"]], isAdjutant = true, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, } adjutantBtnCollection.sprite_Skill = adjutantBtnCollection.sprite_Icon self.attackBtns[SkillKeyPosition.Stratagem] = { btnCollection = self[self.curSkillKeyNameGroup["info_StratagemSkill"]], isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, isStratagem = true, } self.battlePropBtns = {} for i=1,5 do self.battlePropBtns[i] = { btnCollection = self.group_BattleProp["info_BattleProp"..i], skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, isBattleProp = true, propIndex = i, -- 道具按钮索引 } end self.attackBtns[SkillKeyPosition.BuffSkill1] = { btnCollection = self[self.curSkillKeyNameGroup["info_LightEffectSkill"]], isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, isStratagem = false, buffSkillBtnIndex = 1, } self.attackBtns[SkillKeyPosition.BuffSkill2] = { btnCollection = self.info_BeastSkill, isMusou = false, skillState = false, -- 技能初始状态(即是否存在此技能) isInCd = false, isBanned = false, isStratagem = false, buffSkillBtnIndex = 2, changeBeast = self.event_ChangeBeastSkill, } end function UIBattleAttackPanel:HideSkillBtns(hide, model) local hideList = ButtonHideMode[model] if hide then if hideList then for i, v in ipairs(hideList) do local btn = self.attackBtns[v] UIUtils.SetActive(btn.btnCollection.gameObject,false) end end else -- revert skill hide mode if hideList then for i, v in ipairs(hideList) do local btn = self.attackBtns[v] UIUtils.SetActive(btn.btnCollection.gameObject,btn.skillState) end else -- means revert all for i, btn in pairs(self.attackBtns) do UIUtils.SetActive(btn.btnCollection.gameObject,btn.skillState) end end end end function UIBattleAttackPanel:SetSkillBtnState(btn,active) UIUtils.SetActive(btn.btnCollection.gameObject, active) btn.skillState = active if btn.changeBeast then UIUtils.SetActive(btn.changeBeast.gameObject, active) end end function UIBattleAttackPanel:SetSkillUeType(btn, skillId, skillData) local skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) btn.ueType = skillJoyStickData and skillJoyStickData.UEType or ESkillJoystickUEType.DEFAULT if self.leftJoyStaticSkillData and self.leftJoyStaticSkillData.KeyPosition == skillData.KeyPosition then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_InitStaticJoy) -- 关闭常驻的双摇杆 self.leftJoyStaticSkillData = nil end if btn.ueType == ESkillJoystickUEType.JOYSTICK_RANGE_STATIC_RANGE then self.leftJoySkillJoyStickData = skillJoyStickData -- 发现了需要常驻的技能双摇杆,下一帧告知技能摇杆界面显示范围特效 self.leftJoyStaticSkillData = skillData -- 记录哪个按钮显示出来的常驻攻击范围圈 end end function UIBattleAttackPanel:SetSkillBtnState_Parent(btn,active) UIUtils.SetActive(btn.btnCollection.gameObject.transform.parent, active) btn.skillState = active end function UIBattleAttackPanel:OnEntityChanged() self.buffBar.sprite_Bg:EndTimer() self:ResetBtns() end --变身、切将、初始化 function UIBattleAttackPanel:ResetBtns() self:ResetSkillKeyNameGroup() self:ResetSkillBtns() self:ResetAdjutantBtns() self:ResetStratagemBtn() self:ResetBuffSkillBtns() self:ResetGodBeastSkillPoints() self:ResetBattlePropBtn() if GameAppInfo.IsPCOrMacPackage() and not GameAppInfo.IsMarketPackage() then self:SetPCKeyMapDescriptionText() end local curEntity = BattleDataGetter.GetCurEntity() if curEntity then self.curExpEntity = curEntity.ExpEntity local characterData = curEntity.components.base.CurCharacterData self.SlashRange = characterData.NormalAtkRange end end function UIBattleAttackPanel:ResetSkillKeyNameGroup(isOnCreate) local curEntity = BattleDataGetter.GetCurEntity() if curEntity then local characterData = DataSheetManager.HeroData:GetDataByID(curEntity:GetCurCharacterID()) local changed if characterData.SkillKeyStyle > 0 then changed = self:SetSkillKeyNameGroupByStyle(characterData.SkillKeyStyle, isOnCreate) else changed = self:SetSkillKeyNameGroupByStyle(LuaConst.ESkillKeyStyle.COMMON_FOUR_KEY, isOnCreate) end if changed and not isOnCreate then self:InitSkillBtn() end if isOnCreate or changed then local curShowSkillKeyStyle = characterData.SkillKeyStyle > 0 and characterData.SkillKeyStyle or ESkillKeyStyle.COMMON_FOUR_KEY for key,info in pairs(SKILL_KEY_NAME_GROUPS) do if info.showSkillKeyStyles[curShowSkillKeyStyle] then UIUtils.SetActive(self[info.groupName], true) UIUtils.SetActive(self[info.info_Dodge].gameObject, true) else UIUtils.SetActive(self[info.groupName], false) UIUtils.SetActive(self[info.info_Dodge].gameObject, false) end end end end end function UIBattleAttackPanel:ResetSkillBtns() LuaInputManager.ReleaseAttackKeyHard() for _, btn in pairs(self.attackBtns) do self:SetSkillBtnState(btn,false) end table.clearArray(self.ProofCDList) self.skillBarTotalTime = nil UIUtils.SetActive(self.img_ProgressBg, false) UIUtils.SetActive(self.skillBar.slider_Skill ,false) local curEntity = BattleDataGetter.GetCurSkillUIEntity() local CurSkillDataList = BattleDataGetter.GetEntityCurSkillDataListOfEntity(curEntity) if not CurSkillDataList then return end for _,skill in ipairs(CurSkillDataList) do skill = curEntity:GetSkillData(skill.ID) local keyPos = skill.KeyPosition if keyPos > 0 then local btn = self.attackBtns[keyPos] if btn then self:SetSkillUeType(btn, skill.ID, skill) local skillCD = BattleDataGetter.GetEntitySkillCDLeft(curEntity, skill.ID, skill.IgnoreCommonCD) if skillCD then self:SetSkillBtnState(btn,true) local continue = keyPos == SkillKeyPosition.Slash if not continue then self:ResetBtn( btn.btnCollection, keyPos, skill.Icon, skillCD, tonumberV1(curEntity.components.skillBase:GetFinalSkillCD(skill.ID, _tempFinalSkillCD)), skill) else btn.inPress = false UIUtils.SetActive(btn.btnCollection.group_disable.gameObject, btn.isBanned) end end end end end if self.draggingComp then self.skipDragOnce = true end if self.pointerDownComp then self.skipPointerOnce = true end end function UIBattleAttackPanel:ResetSlashBtn() --释放普攻技能一直按下的状态 解决新手引导一直按普攻时触发引导的问题 local skillButton = self.attackBtns[SkillKeyPosition.Slash] skillButton.inPress = true local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(skillButton.keyPosition) --local skillJoyStickData = DataSheetManager.SkillJoyStickData:GetDataByID(skillId) local skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) local ueType = skillJoyStickData and skillJoyStickData.UEType or ESkillJoystickUEType.DEFAULT if ueType == ESkillJoystickUEType.SIMPLE_BTN or ueType == ESkillJoystickUEType.DEFAULT then skillButton.inPress = false skillButton.releaseAttackKeyFrame = nil LuaInputManager.ReleaseAttackKey(skillButton.keyPosition) elseif ueType == ESkillJoystickUEType.JOYSTICK_RANGE or ueType == ESkillJoystickUEType.JOYSTICK_DIR then if not skillButton.inDrag then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_EndDrag, comp, eventData, skillJoyStickData) end end end function UIBattleAttackPanel:ResetDriveSkillBtns(carEntity, driverEntity) if driverEntity ~= LogicUpdateManager._curEntity then return end if not carEntity then return end --只有5键风格的需要设置成4键风格的,6键的不能,因为6键没有跟4键转换的动画。 并且6键的键位跟4键的键位目前有交叉的都是相同的,所以不需要设置回4键(将来可能需要) if self.curSkillKeyNameGroup == SKILL_KEY_NAME_GROUPS[LuaConst.ESkillKeyStyle.COMMON_FIVE_KEY] then if self:SetSkillKeyNameGroupByStyle(LuaConst.ESkillKeyStyle.COMMON_FOUR_KEY) then self:InitSkillBtn() end end self:CloseAllDisable()--开始驾驶时无脑隐藏所有蒙版 self.isShowNormalAttackRange = false local driveData = carEntity.components.drive:GetDriveData() --[[self:ShowDriveBtn(false) if not BattleDataGetter.CheckCurEntityHasBuff(LuaConst.SpecialBuffs.CantOffDrive) then UIUtils.SetActive(self.event_OffDrive,true) end--]] table.clearArray(self.ProofCDList) self.needProofAdjutantCD = false self.skillBarTotalTime = nil UIUtils.SetActive(self.skillBar.slider_Skill ,false) UIUtils.SetActive(self.group_BattleProp.gameObject,false) self.buffBar.sprite_Bg:PauseTimer() local CurSkillDataList = BattleDataGetter.GetEntityCurSkillDataListOfEntity(carEntity) if CurSkillDataList then LuaInputManager.ReleaseAttackKeyHard() for _, btn in pairs(self.attackBtns) do UIUtils.SetActive(btn.btnCollection.gameObject, false) if btn.btnCollection.sprite_Circle then btn.btnCollection.sprite_Circle:EndTimer() end end UIUtils.SetActive(self.attackBtns[SkillKeyPosition.Adjutant].btnCollection.gameObject,false) UIUtils.SetActive(self.attackBtns[SkillKeyPosition.Stratagem].btnCollection.gameObject,false) self:SetSkillBtnState(self.attackBtns[SkillKeyPosition.BuffSkill2], false) self:ResetGodBeastSkillPoints(true) for _,skill in pairs(CurSkillDataList) do local keyPos = skill.KeyPosition local btn = self.attackBtns[keyPos] if btn then self:SetSkillUeType(btn, skill.ID, skill) local skillCD = BattleDataGetter.GetEntitySkillCDLeft(carEntity, skill.ID, skill.IgnoreCommonCD) if skillCD then UIUtils.SetActive(btn.btnCollection.gameObject, true) local continue = keyPos == SkillKeyPosition.Slash if not continue then self:ResetBtn(btn.btnCollection,keyPos,skill.Icon,skillCD,tonumberV1(skill.SkillCD), skill) elseif not string.isNilOrEmpty(skill.Icon) then -- 普攻配置了图标则设置 UIUtils.SetImageByAssetBundle(btn.btnCollection.img_Icon,ConstAssetPathConfig.skillPath..skill.Icon..".png") end end end end end local driveData = carEntity.components.drive:GetDriveData() if driveData and driveData.ExtraUIType == DriveExtraUIType_UIAim then UIUtils.SetActive(self.sprite_Aim,true) end end function UIBattleAttackPanel:SetCollimator(show) UIUtils.SetActive(self.sprite_Aim,show) end function UIBattleAttackPanel:ResetOffDriveSkillBtns(entity, carEntity) if entity ~= LogicUpdateManager._curEntity then return end self.buffBar.sprite_Bg:ResumeTimer() self.isShowNormalAttackRange = LevelManager.IsPVPLevel() UIUtils.SetActive(self.group_BattleProp.gameObject,LogicUpdateManager._curEntity.components.battleProp:GetBattlePropTotalNum() ~= 0) UIUtils.SetImageByAssetBundle(self.attackBtns[SkillKeyPosition.Slash].btnCollection.img_Icon,Const_SlashBtnIcon) self:ResetBtns() if self.sprite_Aim.gameObject.activeInHierarchy then UIUtils.SetActive(self.sprite_Aim,false) end end function UIBattleAttackPanel:ResetAdjutantBtns() local btn = self.attackBtns[SkillKeyPosition.Adjutant] local adjutantSkills = BattleDataGetter.GetAdjutantCurSkillDataList() if not adjutantSkills then self:SetSkillBtnState(btn,false) return end local iconImage = "" for _,adjutantSkill in pairs(adjutantSkills) do if adjutantSkill.Type == SkillType_AdjutantMusou then iconImage = adjutantSkill.Icon break end end self:SetSkillBtnState(btn,true) btn.inSilence = false btn.inPress = false btn.inDrag = false UIUtils.SetLabelText(btn.btnCollection.lab_CDtime, 0) btn.keyPosition = -1 local skillPath = ConstAssetPathConfig.path2..iconImage..".png" UIUtils.SetImageByAssetBundle(btn.btnCollection.sprite_Skill,skillPath) btn.progressPercent = 1 local isMusouActive,isAdjutantActive= BattleDataGetter.IsMyEntityMagicWeaponActive() UIUtils.SetActive(btn.btnCollection.group_Locked,not isAdjutantActive) UIUtils.SetActive(btn.btnCollection.group_disable.gameObject, btn.isBanned) UIUtils.SetGray(btn.btnCollection.sprite_Skill, btn.isBanned) if isAdjutantActive then local curCD = BattleDataGetter.GetAdjutantCD() local totalCD = BattleDataGetter.GetAdjutantTotalCD() if curCD and curCD > 0 then ---CD有问题,需要除1000,点击其他技能按钮没反应 btn.btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) btn.btnCollection.effect_Ready:StopUIEffect() self.needProofAdjutantCD = true else btn.btnCollection.sprite_Mask:EndTimer() btn.btnCollection.effect_Ready:PlayUIEffect() self.needProofAdjutantCD = false end end end function UIBattleAttackPanel:ResetStratagemBtn() local btn = self.attackBtns[SkillKeyPosition.Stratagem] local stratagemSkillData = BattleDataGetter.GetStratagemSkill() if not stratagemSkillData then self:SetSkillBtnState(btn,false) return end self:SetSkillBtnState(btn,true) btn.inSilence = false btn.inPress = false UIUtils.SetLabelText(btn.btnCollection.lab_CDtime, 0) btn.keyPosition = -1 local skillPath = ConstAssetPathConfig.skillPath..stratagemSkillData.Icon..".png" UIUtils.SetImageByAssetBundle(btn.btnCollection.sprite_Skill,skillPath) btn.progressPercent = 1 local curCD = BattleDataGetter.GetStratagemCurCD() local totalCD = BattleDataGetter.GetStratagemTotalCD() if curCD and curCD > 0 then btn.btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) else btn.btnCollection.sprite_Mask:EndTimer() end end function UIBattleAttackPanel:ResetBuffSkillBtns() for i=SkillKeyPosition.BuffSkill1, SkillKeyPosition.BuffSkill5, -1 do self:ResetBuffSkillBtn(i) end end function UIBattleAttackPanel:ResetBuffSkillBtn(keyPosition) local btn = self.attackBtns[keyPosition] if btn then local buffSkillUpdate = BattleDataGetter.GetBuffSkillUpdateByKeyPosition(keyPosition) if buffSkillUpdate then local buffSkillData = buffSkillUpdate.BuffSkillData self:SetSkillBtnState(btn,true) btn.inSilence = false btn.inPress = false btn.isBuffSkill = true btn.buffSkillId = buffSkillData.ID UIUtils.SetLabelText(btn.btnCollection.lab_CDtime, 0) btn.keyPosition = -1 local skillPath = ConstAssetPathConfig.skillPath.. buffSkillData.Icon..".png" UIUtils.SetImageByAssetBundle(btn.btnCollection.sprite_Skill,skillPath) btn.progressPercent = 1 local curCD = buffSkillUpdate.CD local totalCD = buffSkillData.CD + buffSkillUpdate.CdChange if curCD and curCD > 0 then btn.btnCollection.sprite_Mask:EndTimer()--防止Pause造成错误 btn.btnCollection.sprite_Mask:SetAndContinueTimer(false, curCD / 1000, totalCD / 1000) else btn.btnCollection.sprite_Mask:EndTimer() end -- 道具的UI描述 if not string.isNilOrEmpty(buffSkillData.Description) then UIUtils.SetLabelText(btn.btnCollection.txt_SkillType, Const_IDS[buffSkillData.Description]) UIUtils.SetActive(btn.btnCollection.group_Tpye, true) else UIUtils.SetActive(btn.btnCollection.group_Tpye, false) end if buffSkillData.EnegyType == LuaConst.EBuffSkillEnegyType.GODBEAST then UIUtils.SetActive(btn.btnCollection.group_BeastCharge, false) end UIUtils.SetActive(btn.btnCollection.group_disable.gameObject, btn.isBanned) UIUtils.SetGray(btn.btnCollection.sprite_Skill, btn.isBanned) else self:SetSkillBtnState(btn,false) end --else --正常情况,因为有预留 end end function UIBattleAttackPanel:ResetGodBeastSkillPoints(forceHide) local curEntity = BattleDataGetter.GetCurEntity() if curEntity then local index = curEntity.components.buffSkill.curGodBeastSkillIndex local godBeastSkillCount = curEntity.components.buffSkill.godBeastSkillCount for i=1,3 do if i > godBeastSkillCount or forceHide then UIUtils.SetActive(self.godBeastPointSelectList[i], false) UIUtils.SetActive(self.godBeastPointUnSelectList[i], false) else UIUtils.SetActive(self.godBeastPointSelectList[i], i == index) UIUtils.SetActive(self.godBeastPointUnSelectList[i], i ~= index) end end end end -- 刷新所有道具显示 function UIBattleAttackPanel:ResetBattlePropBtn(btnIndex) if btnIndex then self:ResetBattlePropBtnByIndex(btnIndex) else for _, btn in ipairs(self.battlePropBtns) do self:ResetBattlePropBtnByIndex(btn.propIndex) end end local count = LogicUpdateManager._curEntity.components.battleProp:GetBattlePropTotalNum() local carEntity = LogicUpdateManager._curEntity.components.drive:GetDrivedEntity() UIUtils.SetActive(self.group_BattleProp.gameObject, count ~= 0 and (not carEntity)) end --刷新一个道具按钮的显示 function UIBattleAttackPanel:ResetBattlePropBtnByIndex(btnIndex) local btn = self.battlePropBtns[btnIndex] local battlePropID, curCD, totalCD, lifeTime, count, usingTime = BattleDataGetter.GetTopBattlePropInfos(btnIndex) if battlePropID == nil then -- 没有道具 btn.needProofTime = false btn.isInCd = false self:SetSkillBtnState_Parent(btn,false) else-- 有道具 local btnCollection = btn.btnCollection local battlePropData = DataSheetManager.BattlePropData:GetDataByID(battlePropID) self:SetSkillBtnState_Parent(btn,true) btn.inPress = false UIUtils.SetLabelText(btnCollection.lab_CDtime, 0) local iconPath = ConstAssetPathConfig.skillPath..battlePropData.Icon..".png" UIUtils.SetImageByAssetBundle(btnCollection.sprite_Skill,iconPath) btn.progressPercent = 1 UIUtils.SetActive(btnCollection.group_Disable.gameObject, btn.isBanned) -- 道具的UI描述 if not string.isNilOrEmpty(battlePropData.Description) then UIUtils.SetLabelText(btnCollection.txt_SkillType, Const_IDS[battlePropData.Description]) UIUtils.SetActive(btnCollection.group_Tpye, true) else UIUtils.SetActive(btnCollection.group_Tpye, false) end -- 道具个数 if count > 1 then UIUtils.SetLabel(btnCollection.txt_count,string.format("(%d)",count)) else UIUtils.SetLabel(btnCollection.txt_count,"") end -- 道具寿命 if lifeTime > 0 then btnCollection.txt_lifeTime:ResetAndBeginTimer(false, lifeTime / 1000) btn.needProofTime = true else btn.needProofTime = false btnCollection.txt_lifeTime:EndTimer() end if count <= 1 and lifeTime <= 0 then UIUtils.SetActive(btnCollection.group_Txt,false) else UIUtils.SetActive(btnCollection.group_Txt,true) end -- 道具的CD相关 if curCD == nil or curCD == 0 then btn.isInCd = false btnCollection.sprite_Mask:EndTimer() btnCollection.sprite_Circle:EndTimer() UIUtils.SetGray(btnCollection.sprite_Skill, btn.isInCd or btn.isBanned) UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable ,false) UIUtils.SetImageByAssetBundle(btnCollection.img_CDBgNormal,CDBgNormal_noCD) else if curCD > 0 then btn.isInCd = true btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) UIUtils.SetGray(btnCollection.sprite_Skill, btn.isInCd or btn.isBanned) UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable ,true) UIUtils.SetImageByAssetBundle(btnCollection.img_CDBgNormal,CDBgNormal_cding) end end -- 正在使用中的进度条 if usingTime and usingTime > 0 then btn.btnCollection.sprite_Circle:ResetAndBeginTimer(true, (battlePropData.Duration-usingTime) / 1000, battlePropData.Duration / 1000) else btn.btnCollection.sprite_Circle:EndTimer() end end end function UIBattleAttackPanel:ResetBtn(btnCollection, keyPos, icon, curCD, totalCD, skillData) local skillButton = self.attackBtns[keyPos] local skillJoyStickData = nil --注意这里的skillId、skillData、skillJoyStickData都不能缓存,因为同样的keyPos输入,BattleDataGetter.GetMainPlayerSkillIDByKeyPos返回的SkillID会不同,比如连续技的情况下。 local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(keyPos) local skillData = nil if skillId >= 0 then skillData = BattleDataGetter.GetMainPlayerManipulatingEntity():GetSkillData(skillId) --skillJoyStickData = DataSheetManager.SkillJoyStickData:GetDataByID(skillId) skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) --else --正常情况,有时候是因为在错误的时间点调用了ResetBtn导致的,但是这种情况一般在后续会立刻再次刷新,所以这里不报错了 --logging.error(LTAG.ERROR, "HYW : skillId bad value @UIBattleSkillButtonView:Reset") end skillButton.inSilence = false skillButton.inPress = false skillButton.inDrag = false UIUtils.SetLabelText(skillButton.btnCollection.lab_CDtime, 0) skillButton.keyPosition = keyPos skillButton.curCD = nil UIUtils.SetImageByAssetBundle(btnCollection.sprite_Skill,ConstAssetPathConfig.skillPath..icon..".png") skillButton.IsChargeSkill = nil skillButton.IsEnegySkill = nil if skillData.Type == SkillType_Charge then skillButton.IsChargeSkill = true UIUtils.SetActive(btnCollection.group_Charge,true) UIUtils.SetActive(btnCollection.group_Series,false) self:ResetChargeBtn(btnCollection, skillData) elseif skillData.Type == SkillType_Enegy then skillButton.IsEnegySkill = true self:ResetEnegyBtn(btnCollection, skillData) UIUtils.SetActive(btnCollection.group_Charge,true) --测试能量条,直接复用充能技能的 UIUtils.SetActive(btnCollection.img_ChargeEff, false) else UIUtils.SetActive(btnCollection.group_Charge,false) UIUtils.SetActive(btnCollection.group_Series,true) end skillButton.IsRoulette = skillData.SubSkills and #skillData.SubSkills > 0 -- 显示技能效果类型 if keyPos == SkillKeyPosition.Skill1 or keyPos == SkillKeyPosition.Skill2 or keyPos == SkillKeyPosition.Skill3 or keyPos == SkillKeyPosition.MusouNormal or keyPos == SkillKeyPosition.Dodge then local has, skillTipsData = DataSheetManager.SkillTipsData:TryGetDataByID(skillId) if has then local skillTips = skillTipsData.SkillFuncType if BattleDataGetter.IsForbidSkillBtnView() then UIUtils.SetLabel(btnCollection.txt_SkillType, "") else UIUtils.SetLabelText(btnCollection.txt_SkillType, Const_IDS[skillTips]) end end if btnCollection.group_Tpye then UIUtils.SetActive(btnCollection.group_Tpye, skillTipsData ~= nil) end end local curEntity = BattleDataGetter.GetCurSkillUIEntity() --region 显示按钮的当前状态(CD,置灰等信息) if skillButton.isMusou then local sa = BattleDataGetter.GetMainPlayerAttrValueNum(RealtimeAttrType_sa) local maxSa = BattleDataGetter.GetMainPlayerAttrValueNum(AttrType_salmt) skillButton.progressPercent = maxSa == 0 and 0 or sa/maxSa if skillButton.progressPercent>=1 then UIUtils.SetMusouSkillValue(btnCollection.sprite_Skill,1) btnCollection.effect_Ready:PlayUIEffect() UIUtils.SetImageByAssetBundle(btnCollection.sprite_BtnKuang,CDBgNormal_noCD) else UIUtils.SetMusouSkillValue(btnCollection.sprite_Skill, skillButton.progressPercent) btnCollection.effect_Ready:StopUIEffect() UIUtils.SetImageByAssetBundle(btnCollection.sprite_BtnKuang,CDBgNormal_cding) end if not BattleDataGetter.IsOneHeroLevel() then local isMusouActive,_ = BattleDataGetter.IsMyEntityMagicWeaponActive() UIUtils.SetActive(btnCollection.group_Locked,not isMusouActive) --UIUtils.SetActive(btnCollection.sprite_Circle,isMusouActive) else UIUtils.SetActive(btnCollection.group_Locked,false) end --没有无双值的单位的无双技能显示为Ready状态 local curManipulatingEntity = BattleDataGetter.GetMainPlayerManipulatingEntity() if curManipulatingEntity:GetAttrValue(LuaConst.AttrType.salmt) <= FP.Const.Zero then UIUtils.SetActive(btnCollection.group_Locked,false) -- UIUtils.SetActive(btnCollection.sprite_Circle,true) UIUtils.SetMusouSkillValue(btnCollection.sprite_Skill,1) btnCollection.effect_Ready:PlayUIEffect() UIUtils.SetImageByAssetBundle(btnCollection.sprite_BtnKuang,CDBgNormal_noCD) end if (totalCD and totalCD == 0) or (curCD and curCD == 0) then skillButton.isInCd = false btnCollection.sprite_Mask:EndTimer() else if curCD > 0 then skillButton.isInCd = true btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) table.insert(self.ProofCDList,keyPos) btnCollection.effect_Ready:StopUIEffect() end end --这里判断无双技能释放有cd 有cd 当普通技能处理 if totalCD > 0 then UIUtils.SetMusouGray(btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, 1) btnCollection.effect_Ready:StopUIEffect() else UIUtils.SetMusouGray(btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, skillButton.progressPercent) end elseif skillData.Type == SkillType_Charge then local count, totalCount, onceTime = BattleDataGetter.GetEntityChargeSkillInfo(curEntity, skillId) local useUp = count == 0 skillButton.isInCd = useUp-- 充能的isInCd表示能量用光了正在恢复第一格能量 UIUtils.SetGray(btnCollection.sprite_Skill, useUp or skillButton.isBanned) UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable ,useUp) UIUtils.SetImageByAssetBundle(btnCollection.img_CDBgNormal,CDBgNormal_noCD) btnCollection.sprite_Circle:EndTimer() if count < totalCount then -- 如已有消耗 local totalTime = totalCount * onceTime / 1000 local curTime = count * onceTime + (onceTime - curCD) curTime = curTime / 1000 btnCollection.img_ChargeBar:EndTimer()--防止Pause造成错误 btnCollection.img_ChargeBar:SetAndContinueTimer(true, curTime, totalTime) end else --new 连续技显示连续技进度条↓↓↓↓↓↓↓↓↓↓↓↓ local showSpriteCircle = false if not skillButton.isBanned then if skillData.ID ~= skillData.BelongTo then local curEntity = BattleDataGetter.GetCurSkillUIEntity() local belongToSkill = curEntity:GetSkillData(skillData.BelongTo) if belongToSkill.Type == SkillType_Serial then local updateData = curEntity.components.skillBase.CurUpdateDataGroup[belongToSkill.ID] if updateData then if updateData.ProgressTime and updateData.ProgressTime > FP.Const.Zero then showSpriteCircle = true btnCollection.sprite_Circle:ResetAndBeginTimer(false, tonumberV1(updateData.ProgressTime) / 1000) end end end end end --new 连续技显示连续技进度条↑↑↑↑↑↑↑↑↑ local continue = keyPos == SkillKeyPosition.Slash if (totalCD and totalCD == 0) or (curCD and curCD == 0) then if not continue then skillButton.isInCd = false btnCollection.sprite_Mask:EndTimer() if not showSpriteCircle then btnCollection.sprite_Circle:EndTimer() end UIUtils.SetGray(btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned) if btnCollection.sprite_Mask_Notavailable then UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable ,false) end if btnCollection.img_CDBgNormal then UIUtils.SetImageByAssetBundle(btnCollection.img_CDBgNormal,CDBgNormal_noCD) end end else if not continue then if curCD > 0 then skillButton.isInCd = true btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) UIUtils.SetGray(btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned) if btnCollection.sprite_Mask_Notavailable then UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable ,true) end if btnCollection.img_CDBgNormal then UIUtils.SetImageByAssetBundle(btnCollection.img_CDBgNormal,CDBgNormal_cding) end table.insert(self.ProofCDList,keyPos) end --progress还没有处理,估计不用处理,加一下注释 end end skillButton.progressPercent = 1 end local skillBaseComp = curEntity.components.skillBase skillButton.isBanned = skillBaseComp:IsKeyPosBanned(keyPos) UIUtils.SetActive(btnCollection.group_disable.gameObject, skillButton.isBanned) --endregion --region 额外的技能UI显示 local skillBaseComp = curEntity.components.skillBase skillBaseComp:CallSkillDecoratorFuncBySkillID(skillId, "OnUIBtn") --endregion end function UIBattleAttackPanel:ResetEnegyBtn(btnCollection, skillData) UIUtils.SetImageByAssetBundle(btnCollection.img_ChargeBar.CDMask,string.format(ChargeUIImagePath, "zd_jn_charge"..2)) btnCollection.img_ChargeBar.CDMask.fillAmount = 1 btnCollection.img_ChargeBar:EndTimer()-- 防止郭嘉充能时切到甄姬,甄姬的进度条不对的问题 end function UIBattleAttackPanel:ResetChargeBtn(btnCollection, skillData) local curEntity = BattleDataGetter.GetCurSkillUIEntity() local count = curEntity and curEntity.components.skillBase:GetMaxChargeCountOfSkillData(skillData) or skillData.ParamInt1 UIUtils.SetImageByAssetBundle(btnCollection.img_ChargeBg,string.format(ChargeUIImagePath, "zd_bg_jn_c"..count)) UIUtils.SetImageByAssetBundle(btnCollection.img_ChargeBar.CDMask,string.format(ChargeUIImagePath, "zd_jn_charge"..count)) UIUtils.SetImageByAssetBundle(btnCollection.img_ChargeEff,string.format(ChargeUIImagePath, "zd_jn_chargeEff"..count)) UIUtils.SetActive(btnCollection.img_ChargeEff, false) btnCollection.sprite_Mask:EndTimer() btnCollection.img_ChargeBar.CDMask.fillAmount = 1 btnCollection.img_ChargeBar:EndTimer() end function UIBattleAttackPanel:OnPlayerInterruptSkill(SkillData, reason) if reason ~= LuaConst.EInterruptSkillReason.BY_CMD then self.skipPointerOnce = true if SkillData and SkillData.Type == SkillType_Enegy then local skillButton = self.attackBtns[SkillData.KeyPosition] if skillButton and skillButton.inDrag then self.skipDragOnce = true end else self.skipDragOnce = true end end self:HideSkillProgressBarIfActive() LuaInputManager.ReleaseAttackKey() end function UIBattleAttackPanel:OnSwitchHero(switchHeroType, toEntity) UIUtils.SetActive(self.img_ProgressBg.gameObject, false) end function UIBattleAttackPanel:UpdateSkillCD(keyPos, cdTime, maxCDTime) local skillButton = self.attackBtns[keyPos] if not skillButton then return end if skillButton.IsChargeSkill or skillButton.IsEnegySkill then return end if cdTime and tonumberV1(cdTime) > 0 then skillButton.isInCd = true if maxCDTime then skillButton.btnCollection.sprite_Mask:ResetAndBeginTimer(false, tonumberV1(cdTime) / 1000, tonumberV1(maxCDTime) / 1000) else skillButton.btnCollection.sprite_Mask:ResetAndBeginTimer(false, tonumberV1(cdTime) / 1000) end if not skillButton.isMusou then UIUtils.SetGray(skillButton.btnCollection.sprite_Skill , skillButton.isInCd or skillButton.isBanned) UIUtils.SetActive(skillButton.btnCollection.sprite_Mask_Notavailable ,true) else skillButton.btnCollection.effect_Ready:StopUIEffect() UIUtils.SetMusouGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, 1) end if skillButton.btnCollection.img_CDBgNormal then UIUtils.SetImageByAssetBundle(skillButton.btnCollection.img_CDBgNormal,CDBgNormal_cding) end if not skillButton.isMusou and skillButton.btnCollection.sprite_Circle then skillButton.btnCollection.sprite_Circle:EndTimer() end if not maxCDTime then table.insert(self.ProofCDList,keyPos) else table.removebyvalue(self.ProofCDList, keyPos, true) end else skillButton.isInCd = false if not skillButton.isMusou then UIUtils.SetGray(skillButton.btnCollection.sprite_Skill , skillButton.isInCd or skillButton.isBanned) UIUtils.SetActive(skillButton.btnCollection.sprite_Mask_Notavailable ,false) else UIUtils.SetMusouGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, 1) end if skillButton.btnCollection.img_CDBgNormal then UIUtils.SetImageByAssetBundle(skillButton.btnCollection.img_CDBgNormal,CDBgNormal_noCD) end skillButton.btnCollection.sprite_Mask:EndTimer() if skillButton.btnCollection.effect_ExitCD then skillButton.btnCollection.effect_ExitCD:PlayUIEffect() end if not maxCDTime then table.removebyvalue(self.ProofCDList, keyPos, true) end end end --校对CD时间 function UIBattleAttackPanel:ProofCDTime() --logging.log(LTAG.LOG,"---------", self.ProofCDList) if #self.ProofCDList > 0 then local curEntity = BattleDataGetter.GetCurSkillUIEntity() for i,keyPos in ipairs(self.ProofCDList) do local skillButton = self.attackBtns[keyPos] local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(keyPos) local skillTotalCD = tonumberV1(curEntity.components.skillBase:GetFinalSkillCD(skillId)) if skillButton then local skillData = curEntity:GetSkillData(skillId) local cdTime = BattleDataGetter.GetEntitySkillCDLeft(curEntity, skillId, skillData.IgnoreCommonCD) if cdTime then skillButton.btnCollection.sprite_Mask:ResetAndBeginTimer(false, cdTime / 1000, skillTotalCD / 1000)--ResetAndBeginTimer end end end end if self.needProofAdjutantCD then local btn = self.attackBtns[SkillKeyPosition.Adjutant] local curCD = BattleDataGetter.GetAdjutantCD() local totalCD = BattleDataGetter.GetAdjutantTotalCD() if curCD and curCD > 0 then btn.btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) end end --道具存活时间 for _, btn in ipairs(self.battlePropBtns) do if btn.needProofTime or btn.isInCd then local battlePropID, curCD, totalCD, lifeTime, count, usingTime = BattleDataGetter.GetTopBattlePropInfos(btn.propIndex) if lifeTime > 0 then btn.btnCollection.txt_lifeTime:ResetAndBeginTimer(false, lifeTime / 1000) end if curCD and curCD > 0 then btn.btnCollection.sprite_Mask:ResetAndBeginTimer(false, curCD / 1000, totalCD / 1000) end end end end -- 替换技能 function UIBattleAttackPanel:ReplaceNormalSkill(entity, skillData) local curEntity = BattleDataGetter.GetCurSkillUIEntity() if entity == curEntity then local keyPos = skillData.KeyPosition if keyPos > 0 then local btn = self.attackBtns[keyPos] if btn then self:SetSkillUeType(btn, skillData.BelongTo, skillData) local skillCD = BattleDataGetter.GetEntitySkillCDLeft(curEntity, skillData.BelongTo, skillData.IgnoreCommonCD) if skillCD then self:SetSkillBtnState(btn,true) if keyPos == SkillKeyPosition.Slash then self:ResetSlashBtn() else self:ResetBtn( btn.btnCollection, keyPos, skillData.Icon, skillCD, tonumberV1(curEntity.components.skillBase:GetFinalSkillCD(skillData.ID)), skillData) end end end end end end function UIBattleAttackPanel:OnSkillEnegyChanged(keyPos, curEnegy, maxEnegy, isCut) local btnCollection = self.attackBtns[keyPos].btnCollection local fillAmount = FP.tonumberV1(curEnegy / maxEnegy) btnCollection.img_ChargeBar.CDMask.fillAmount = fillAmount if not isCut then isCut = false end UIUtils.SetActive(self.img_ProgressBg.gameObject, isCut) self.img_Fill.fillAmount = fillAmount end -- 消耗能量条 function UIBattleAttackPanel:ChargeSkillSub(keyPos, count, totalCount ,onceTime, curCD) local skillButton = self.attackBtns[keyPos] local btnCollection = skillButton.btnCollection local totalTime = totalCount * onceTime local curTime = count * onceTime if curCD > 0 and count < totalCount then curTime = curTime + (onceTime - curCD) end btnCollection.img_ChargeBar:EndTimer()--防止Pause造成错误 btnCollection.img_ChargeBar:SetAndContinueTimer(true, curTime / 1000, totalTime / 1000) if count == 0 then skillButton.isInCd = true -- 充能的isInCd表示能量用光了正在恢复第一格能量 UIUtils.SetGray(btnCollection.sprite_Skill, true) UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable ,true) end end -- 添加能量条 function UIBattleAttackPanel:ChargeSkillAdd(keyPos, count, totalCount ,onceTime, curCD) local skillButton = self.attackBtns[keyPos] local btnCollection = skillButton.btnCollection UIUtils.SetActive(btnCollection.img_ChargeEff , true) btnCollection.img_ChargeEff.rectTransform:SetLocalEulerAngles(0,0,-((count-1) / totalCount * 360)) self.attackBtns[keyPos].closeChargeEffFrame = BattleDataGetter.GetCurFrameIndex() + 2 if count == 1 then skillButton.isInCd = false -- 充能的isInCd表示能量用光了正在恢复第一格能量 UIUtils.SetGray(btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned) UIUtils.SetActive(btnCollection.sprite_Mask_Notavailable, false) end local totalTime = totalCount * onceTime local curTime = count * onceTime if curCD > 0 and count < totalCount then curTime = curTime + (onceTime - curCD) end btnCollection.img_ChargeBar:EndTimer()--防止Pause造成错误 btnCollection.img_ChargeBar:SetAndContinueTimer(true, curTime / 1000, totalTime / 1000) end function UIBattleAttackPanel:UpdateSkillProgress(keyPos, cdTime) local skillButton = self.attackBtns[keyPos] if skillButton == nil then --配置上不严谨的情况下,偶尔会进到这里,影响不大,不再报警告了 --logging.error(LTAG.ERROR, "HYW : skillButton nil Error! keyPos : ", keyPos) return end skillButton.lastSkillData = skillButton.curSkillData skillButton.curSkillData = BattleDataGetter.GetCurSkillUIEntity():GetSkillData(BattleDataGetter.GetMainPlayerSkillIDByKeyPos(keyPos)) if cdTime then if skillButton.lastSkillData and skillButton.lastSkillData.AutoNextConditionStr == "pointerUp" then skillButton.btnCollection.sprite_Circle:ResetAndBeginTimer(true,0, tonumberV1(cdTime) / 1000) else skillButton.btnCollection.sprite_Circle:ResetAndBeginTimer(false, tonumberV1(cdTime) / 1000) end else if skillButton.btnCollection.sprite_Circle then skillButton.btnCollection.sprite_Circle:EndTimer() --else --正常情况,有些按钮是没有sprite_Circle的 end end if skillButton.curSkillData and not string.isNilOrEmpty(skillButton.curSkillData.Icon) then UIUtils.SetImageByAssetBundle(skillButton.btnCollection.sprite_Skill,ConstAssetPathConfig.skillPath..skillButton.curSkillData.Icon..".png") end end function UIBattleAttackPanel:UpdateAdjutantCD(entity, cdTime) local isMusouActive,isAdjutantActive= BattleDataGetter.IsMyEntityMagicWeaponActive() local btn = self.attackBtns[SkillKeyPosition.Adjutant] if isAdjutantActive and BattleDataGetter.IsCurEntity(entity) then if cdTime then btn.btnCollection.effect_Ready:StopUIEffect() btn.btnCollection.sprite_Mask:ResetAndBeginTimer(false, cdTime / 1000) self.needProofAdjutantCD = true else btn.btnCollection.effect_Ready:PlayUIEffect() btn.btnCollection.sprite_Mask:EndTimer() self.needProofAdjutantCD = false end end end function UIBattleAttackPanel:UpdateStratagemSkillCD(entity, cdTime) local btn = self.attackBtns[SkillKeyPosition.Stratagem] if cdTime and cdTime > 0 then btn.isInCd = true btn.btnCollection.sprite_Mask:ResetAndBeginTimer(false, cdTime / 1000) else btn.btnCollection.sprite_Mask:EndTimer() btn.isInCd = false end end function UIBattleAttackPanel:UpdateMusouState(sa, maxSa) local progressPercent = maxSa == 0 and 0 or sa/maxSa local isMusouActive,_ = BattleDataGetter.IsMyEntityMagicWeaponActive() --if isMusouActive then local skillButton = self.attackBtns[SkillKeyPosition.MusouNormal] if skillButton.isMusou then UIUtils.SetMusouSkillValue(skillButton.btnCollection.sprite_Skill,progressPercent) end if progressPercent >= 1 then progressPercent = 1 if not skillButton.curCD and (skillButton.progressPercent and skillButton.progressPercent < 1) then if isMusouActive then skillButton.btnCollection.effect_ExitCD:PlayUIEffect() if skillButton.isMusou then skillButton.btnCollection.effect_Ready:PlayUIEffect() end UIUtils.SetImageByAssetBundle(skillButton.btnCollection.sprite_BtnKuang,CDBgNormal_noCD) end if skillButton.isMusou then UIUtils.SetMusouSkillValue(skillButton.btnCollection.sprite_Skill,1) end end elseif progressPercent < 1 then if skillButton.progressPercent and skillButton.progressPercent >= 1 then if skillButton.isMusou then UIUtils.SetMusouSkillValue(skillButton.btnCollection.sprite_Skill,progressPercent) skillButton.btnCollection.effect_Ready:StopUIEffect() end UIUtils.SetImageByAssetBundle(skillButton.btnCollection.sprite_BtnKuang,CDBgNormal_cding) end end skillButton.progressPercent = progressPercent --end end function UIBattleAttackPanel:StartUseBattleProp(btnIndex,battlePropData) local btn = self.battlePropBtns[btnIndex] if battlePropData then btn.btnCollection.sprite_Circle:ResetAndBeginTimer(true,0, battlePropData.Duration / 1000) end end function UIBattleAttackPanel:OnSetSkillMaxChargetCount(skillID) local skillData = BattleDataGetter.GetCurSkillUIEntity():GetSkillData(skillID) if skillData then local btn = self.attackBtns[skillData.KeyPosition] btn.isInCd = false -- 充能的isInCd表示能量用光了正在恢复第一格能量 self:ResetChargeBtn(btn.btnCollection, skillData) end end function UIBattleAttackPanel:OnSkillJoystickSetDragging(isDragging, draggingComp) self.isSkillJoystickDragging = isDragging if isDragging then self.skillJoystickDraggingComp = draggingComp else self.skillJoystickDraggingComp = nil end end function UIBattleAttackPanel:SetOverrideSkillJoystick(entity, replacedID, replacedByID) if entity:IsPlayerSelf() then if self.skillJoystickOverrideDic[replacedID] ~= replacedByID then self.skillJoystickOverrideDic[replacedID] = replacedByID self:OnSkillJoystickOverrided(replacedID, replacedByID) end end end function UIBattleAttackPanel:ClearOverrideSkillJoystick() for k,v in pairs(self.skillJoystickOverrideDic) do self.skillJoystickOverrideDic[k] = nil end end function UIBattleAttackPanel:OnSkillJoystickOverrided(replacedID, replacedByID) EventSystem.Dispatch(EventID.UIBattle_SkillJoystickOverrided, replacedID, replacedByID) end function UIBattleAttackPanel:OnDrag(comp, eventData) if BattleDataGetter.IsForbidSkillBtnView() then return -- 回放不让点击 end if self.skipDragOnce then return end if self.validFrameCountdown then return end local curEntity = BattleDataGetter.GetCurEntity() if curEntity and curEntity:IsAlive() then self.draggingComp = comp local skillButton = self:GetSkillBtnByComp(comp, true) if skillButton then skillButton.inDrag = true local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(skillButton.keyPosition) --local skillJoyStickData = DataSheetManager.SkillJoyStickData:GetDataByID(skillId) local skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) local skillData if skillButton.isAdjutant then local adjutantSkillJoystickData = BattleDataGetter.GetMainAdjutantSkillJoystickData() if adjutantSkillJoystickData == nil or adjutantSkillJoystickData.UEType == LuaConst.ESkillJoystickUEType.JOYSTICK_DIR then skillJoyStickData = LuaConst.AdjutantJoystickDataDir else skillJoyStickData = LuaConst.AdjutantJoystickDataRange end if skillId > 0 then skillData = curEntity:GetSkillData(skillId) end elseif skillButton.isBuffSkill then skillJoyStickData = BattleDataGetter.GetMainBuffSkillJoystickData(skillButton.buffSkillId) skillData = DataSheetManager.BuffSkillData:GetDataByID(skillButton.buffSkillId) else if skillId > 0 then skillData = curEntity:GetSkillData(skillId) end end if skillJoyStickData and (skillJoyStickData.UEType == ESkillJoystickUEType.JOYSTICK_RANGE or skillJoyStickData.UEType == ESkillJoystickUEType.JOYSTICK_DIR) then skillButton.timer = CONST_CLICKEFFECT_INTERNAL if not skillButton.isBanned then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_Drag, comp, eventData, skillJoyStickData, skillData) end end if eventData.pointerEnter then local dic local stateSelect local rouletteCompList if curEntity:GetCharacterID() == 46 then dic = self.skillRouletteZuoCiName2CompDic stateSelect = self.state_Select_ZuoCi rouletteCompList = self.skillRoulette_ZuoCi else dic = self.skillRouletteName2CompDic stateSelect = self.state_Select rouletteCompList = self.skillRoulette end local rouletteComp = dic[eventData.pointerEnter.name] if rouletteComp then self:SetIsRouletteInCancelArea(false) self.curSkillRouletteIndex = self:GetSkillRouletteIndex(rouletteComp, rouletteCompList) stateSelect:SetState(self.curSkillRouletteIndex - 1) elseif eventData.pointerEnter.name == "cancel_area" then self:SetIsRouletteInCancelArea(true) end end end end end function UIBattleAttackPanel:GetBattlePropBtnByComp(comp) for _, btn in pairs(self.battlePropBtns) do if btn.btnCollection.event_Button == comp then return btn end end return nil end function UIBattleAttackPanel:SetIsRouletteInCancelArea(isInCancelArea, forceRefresh) if self.isRouletteInCancelArea ~= isInCancelArea or forceRefresh then self.isRouletteInCancelArea = isInCancelArea self:SetRouletteEffectForbidState(self.isRouletteInCancelArea) end end function UIBattleAttackPanel:SetRouletteEffectForbidState(isForbid) local color if isForbid then color=ColorRed else color=ColorOne end UIUtils.SetImageColor(self.cancel_area , color) end -- function UIBattleAttackPanel:OnDrop(comp, eventData) -- local rouletteIndex = self:GetSkillRouletteIndex(comp) -- if rouletteIndex then -- if LuaInputManager.GetSpecialCommand() == 0 then -- LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.SubSkillIndex1 + rouletteIndex - 1) -- end -- end -- end function UIBattleAttackPanel:GetSkillRouletteIndex(comp, rouletteCompList) for i,v in ipairs(rouletteCompList) do if v == comp then return i end end return nil end --alsoFindFromLast 是否也从self.lastAttackBtns里找。如果改变过attackBtns,则有些时候需要从lastAttackBtns里找,比如pointerDown改变了技能轮盘后的pointerUp function UIBattleAttackPanel:GetSkillBtnByComp(comp, alsoFindFromLast) for _, btn in pairs(self.attackBtns) do if btn.btnCollection.event_Button == comp or btn.btnCollection.event_Button1 == comp or btn.btnCollection.event_Button2 == comp then return btn end end if alsoFindFromLast then if self.lastAttackBtns then for _, btn in pairs(self.lastAttackBtns) do if btn.btnCollection.event_Button == comp or btn.btnCollection.event_Button1 == comp or btn.btnCollection.event_Button2 == comp then return btn end end end end end function UIBattleAttackPanel:GetSkillBtnByKeyPos(keyPos) if keyPos then for _, btn in pairs(self.attackBtns) do if btn.keyPosition == keyPos then return btn end end else logging.error(LTAG.ERROR, "HYW : keyPos nil Error @UIBattleAttackPanel:GetSkillBtnByKeyPos") end end --顺序: OnPointerUp在前 , OnEndDrag在后 function UIBattleAttackPanel:OnEndDrag(comp, eventData) if BattleDataGetter.IsForbidSkillBtnView() then return -- 回放不让点击 end local skillButton = self:GetSkillBtnByComp(comp, true) skillButton.inDrag = false if self.skipDragOnce then self.skipDragOnce = false skillButton.inPress = false self.draggingComp = nil self:ClearOverrideSkillJoystick() return end if self.validFrameCountdown then self:ClearOverrideSkillJoystick() return end local curEntity = BattleDataGetter.GetCurEntity() if curEntity and curEntity:IsAlive() then local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(skillButton.keyPosition) --local skillJoyStickData = DataSheetManager.SkillJoyStickData:GetDataByID(skillId) local skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) if skillButton.isAdjutant then local adjutantSkillJoystickData = BattleDataGetter.GetMainAdjutantSkillJoystickData() if adjutantSkillJoystickData == nil or adjutantSkillJoystickData.UEType == LuaConst.ESkillJoystickUEType.JOYSTICK_DIR then skillJoyStickData = LuaConst.AdjutantJoystickDataDir else skillJoyStickData = LuaConst.AdjutantJoystickDataRange end elseif skillButton.isBuffSkill then skillJoyStickData = BattleDataGetter.GetMainBuffSkillJoystickData(skillButton.buffSkillId) end if skillJoyStickData == nil then --2022年1月26日新增 有时候策划只会给第1段配置双摇杆,后续不配,此时必须尝试使用BelongTo的双摇杆数据,否则会出现双摇杆特效不消失的问题 local successs, skillData = DataSheetManager.SkillData:TryGetDataByID(skillId) if skillData then skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillData.BelongTo] or skillData.BelongTo) -- else -- logging.error(LTAG.ERROR, "HYW : 技能数据丢失,如果是在变身瞬间出现,则是正常情况,否则请上报战斗程序") end end if skillJoyStickData and (skillJoyStickData.UEType == ESkillJoystickUEType.JOYSTICK_RANGE or skillJoyStickData.UEType == ESkillJoystickUEType.JOYSTICK_DIR) then if skillButton.lastSkillData == nil or skillButton.lastSkillData.AutoNextConditionStr ~= "pointerUp" then if not LuaInputManager.GetIsInSkillCancelArea() then self:TakeEffectOnce(skillButton,true) end --else -- 如果是抬手释放连接技的技能,在抬手的时候不再生效自身技能 end EventSystem.Dispatch(EventID.UIBattle_SkillBtn_EndDrag, comp, eventData, skillJoyStickData) --这个后调,在TakeEffectOnce后 end end skillButton.lastSkillData = nil self.draggingComp = nil self:ClearOverrideSkillJoystick() end local AnimPath = ConstAssetPathConfig.AnimPath function UIBattleAttackPanel:TakeEffectOnce(skillBtn,isRelease) skillBtn.btnCollection.effect_Click:PlayUIEffect() if skillBtn.btnCollection.buttonZoomAnim then self:PlayUIAnimation(skillBtn.btnCollection.buttonZoomAnim) else skillBtn.btnCollection.buttonZoomAnim = self:PlayUIAnimation(AnimPath, UIUtils.GetParentTransform(skillBtn.btnCollection.sprite_Skill)) end if not skillBtn.curCD then if skillBtn.isAdjutant then LuaInputManager.PressAdjutantKey() elseif skillBtn.isStratagem then LuaInputManager.PressStratagemKey() elseif skillBtn.isBattleProp then LuaInputManager.PressBattlePropKey(skillBtn.propIndex) elseif skillBtn.buffSkillBtnIndex then LuaInputManager.PressBuffSkillKey(skillBtn.buffSkillBtnIndex) else LuaInputManager.PressAttackKey(skillBtn.keyPosition) if skillBtn.ueType == ESkillJoystickUEType.JOYSTICK_RANGE_STATIC_RANGE then EventSystem.Dispatch(EventID.UIBattle_StaticSkillJoy_BtnDown,skillBtn.keyPosition) end end end if isRelease then skillBtn.releaseAttackKeyFrame = BattleDataGetter.GetCurFrameIndex() + 2 end end function UIBattleAttackPanel:OnButtonClicked(comp) if (not self.isFocus and not self.isCheatModel) or BattleDataGetter.IsForbidSkillBtnView() then return -- 回放不让点击 end local skillButton = self:GetSkillBtnByComp(comp) if skillButton then local curEntity = BattleDataGetter.GetCurEntity() if curEntity and curEntity:IsAlive() then if skillButton.isAdjutant then skillButton.timer = CONST_CLICKEFFECT_INTERNAL skillButton.inPress = false skillButton.btnCollection.effect_Click:PlayUIEffect() if skillButton.btnCollection.buttonZoomAnim then self:PlayUIAnimation(skillButton.btnCollection.buttonZoomAnim) else skillButton.btnCollection.buttonZoomAnim = self:PlayUIAnimation(AnimPath,UIUtils.GetParentTransform(skillButton.btnCollection.sprite_Skill)) end if not skillButton.inDrag then self:TakeEffectOnce(skillButton,true) end else local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(skillButton.keyPosition) --local skillJoyStickData = DataSheetManager.SkillJoyStickData:GetDataByID(skillId) local skillJoyStickData if skillButton.isBuffSkill then skillJoyStickData = BattleDataGetter.GetMainBuffSkillJoystickData(skillButton.buffSkillId) else skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) end local ueType = skillJoyStickData and skillJoyStickData.UEType or ESkillJoystickUEType.DEFAULT if ueType == ESkillJoystickUEType.JOYSTICK_RANGE or ueType == ESkillJoystickUEType.JOYSTICK_DIR then if skillButton.lastSkillData == nil or skillButton.lastSkillData.AutoNextConditionStr ~= "pointerUp" then if not skillButton.inDrag then self:TakeEffectOnce(skillButton,true) end end end skillButton.inPress = false end end elseif comp==self.event_Camera then NotSyncBattleSetter.ChangeCameraTargetPattern() elseif comp == self.event_CameraSwitchTarget then NotSyncBattleSetter.SwitchTargetCameraAim() elseif(comp==self.event_AutoFight) then self:OnClickAutoFightButton() elseif comp == self:GetUIComponentOfSkillBtnSet("info_Musou").mask_Locked then CTL.Tips.AddTipsMsg(Const_IDS["IDS_MagicWeapon_Musou_UnLock"]) elseif comp == self:GetUIComponentOfSkillBtnSet("info_Adjutant").mask_Locked then CTL.Tips.AddTipsMsg(Const_IDS["IDS_MagicWeapon_ViceMusou_UnLock"]) elseif comp == self.Arrow_1 then LuaInputManager.EnqueueSpecialCommand(LuaConst.SpecialCommandType.SwitchGodBeastSkillLeft) elseif comp == self.Arrow_2 then LuaInputManager.EnqueueSpecialCommand(LuaConst.SpecialCommandType.SwitchGodBeastSkillRight) else local battlePropBtn = self:GetBattlePropBtnByComp(comp) if battlePropBtn then local curEntity = BattleDataGetter.GetCurEntity() if curEntity and curEntity:IsAlive() then self:TakeEffectOnce(battlePropBtn,true) end end end end function UIBattleAttackPanel:OnPointerDown(comp, eventData) if (not self.isFocus and not self.isCheatModel) or BattleDataGetter.IsForbidSkillBtnView() then return -- 回放不让点击 end if self.validFrameCountdown then return end local curEntity = BattleDataGetter.GetCurEntity() if curEntity and curEntity:IsAlive() then self.pointerDownComp = comp local skillButton = self:GetSkillBtnByComp(comp, true) if skillButton.keyPosition == SkillKeyPosition.Slash then -- 首次点击普攻 if not BattleDataGetter.IsMonsterTestLevel() and not MDL.PlayerGuide.IsFinishTutorial() then EventSystem.Dispatch(EventID.BI_ViewClick, BIManager.ViewBIEvent.UIBattleAttackPanel_Slash) end end skillButton.inPress = true local skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(skillButton.keyPosition) skillButton.curSkillData = skillId>0 and curEntity:GetSkillData(skillId) or nil skillButton.lastSkillData = skillButton.curSkillData --初始时lastSkillData就等于curSkillData,而不是nil,方便后面做一个功能 --local skillJoyStickData = DataSheetManager.SkillJoyStickData:GetDataByID(skillId) local skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) local skillData if skillButton.isAdjutant then if skillButton.isInCd then return end if skillButton.isAdjutant then local adjutantSkillJoystickData = BattleDataGetter.GetMainAdjutantSkillJoystickData() if adjutantSkillJoystickData == nil or adjutantSkillJoystickData.UEType == LuaConst.ESkillJoystickUEType.JOYSTICK_DIR then skillJoyStickData = LuaConst.AdjutantJoystickDataDir else skillJoyStickData = LuaConst.AdjutantJoystickDataRange end end skillData = skillButton.curSkillData elseif skillButton.isBuffSkill then skillJoyStickData = BattleDataGetter.GetMainBuffSkillJoystickData(skillButton.buffSkillId) else skillData = skillButton.curSkillData end local ueType = skillJoyStickData and skillJoyStickData.UEType or ESkillJoystickUEType.DEFAULT if ueType ~= ESkillJoystickUEType.JOYSTICK_RANGE_STATIC_RANGE then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_PointerDown, comp, eventData, skillButton.curSkillData) end if ueType == ESkillJoystickUEType.SIMPLE_BTN or ueType == ESkillJoystickUEType.DEFAULT then if not skillButton.IsRoulette then skillButton.timer = CONST_CLICKEFFECT_INTERNAL self:TakeEffectOnce(skillButton, false) end elseif ueType == ESkillJoystickUEType.JOYSTICK_RANGE or ueType == ESkillJoystickUEType.JOYSTICK_DIR then if not skillButton.isBuffSkill then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_Drag, comp, eventData, skillJoyStickData, skillData)--这里为了方便就发EventID.UIBattle_SkillBtn_Drag了 end if skillJoyStickData.UseSkillOnPress then self:TakeEffectOnce(skillButton, false) end elseif ueType == ESkillJoystickUEType.JOYSTICK_RANGE_STATIC_RANGE then if skillJoyStickData.UseSkillOnPress then if skillButton.keyPosition == SkillKeyPosition.Slash then skillButton.timer = CONST_CLICKEFFECT_INTERNAL end self:TakeEffectOnce(skillButton, false) end end if skillButton.keyPosition == SkillKeyPosition.Slash and skillJoyStickData == nil then self.slashDownTimer = 0 self:ShowNormalAttackRange() end if skillButton.IsRoulette then local groupBg if curEntity:GetCharacterID() == 46 then groupBg = self.group_Bg_ZuoCi else groupBg = self.group_Bg end groupBg.transform:SetPosition(comp.transform:GetPosition()) UIUtils.SetActive(groupBg.gameObject, true) UIUtils.SetActive(self.cancel_area.gameObject, true) end else CTL.Tips.AddTipsMsg(Const_IDS["IDS_Dead_Hint3"]) end self:ClearOverrideSkillJoystick() end function UIBattleAttackPanel:OnTimeLine(value) if not value then LuaInputManager.ReleaseAttackKey() end end function UIBattleAttackPanel:OnPointerUp(comp, eventData) if (not self.isFocus and not self.isCheatModel) or BattleDataGetter.IsForbidSkillBtnView() then return -- 回放不让点击 end local curEntity = BattleDataGetter.GetCurEntity() if not curEntity or not curEntity:IsAlive() then return end local skillButton = self:GetSkillBtnByComp(comp, true) UIUtils.SetActive(self.group_Bg.gameObject, false) UIUtils.SetActive(self.group_Bg_ZuoCi.gameObject, false) UIUtils.SetActive(self.cancel_area.gameObject, false) if self.validFrameCountdown then self:ClearOverrideSkillJoystick() if skillButton then skillButton.inDrag = false end return end if self.skipPointerOnce then self.skipPointerOnce = false self.pointerDownComp = nil self:ClearOverrideSkillJoystick() if skillButton then skillButton.inDrag = false skillButton.inPress = false end if not eventData.dragging and self.skipDragOnce then self:OnEndDrag(comp, eventData) end return end if curEntity and curEntity:IsAlive() then if skillButton then if skillButton.keyPosition <= 0 and not skillButton.isAdjutant and not skillButton.isBuffSkill then return end skillButton.inPress = false local skillId if skillButton.isAdjutant then skillId = curEntity.components.adjutant.AdjutantEntity.components.skillBase:GetSkillDataByKeyPosition(LuaConst.ESkillKeyPosition.AdjutantSkillMain).ID else skillId = BattleDataGetter.GetMainPlayerSkillIDByKeyPos(skillButton.keyPosition) end local succeed, skillData = DataSheetManager.SkillData:TryGetDataByID(skillId) if not skillData and not skillButton.isBuffSkill then --因为现在有了多种风格的技能盘切换,在技能盘切换期间如果点击了按钮可能出现数据丢失的情况,所以这里要判空 --logging.error(LTAG.ERROR, "HYW : 技能数据丢失,如果是在变身瞬间出现,则是正常情况,否则请上报战斗程序 skillId : ", skillId) return end local skillJoyStickData if skillButton.isAdjutant then local adjutantSkillJoystickData = BattleDataGetter.GetMainAdjutantSkillJoystickData() if adjutantSkillJoystickData == nil or adjutantSkillJoystickData.UEType == LuaConst.ESkillJoystickUEType.JOYSTICK_DIR then skillJoyStickData = LuaConst.AdjutantJoystickDataDir else skillJoyStickData = LuaConst.AdjutantJoystickDataRange end elseif skillButton.isBuffSkill then skillJoyStickData = BattleDataGetter.GetMainBuffSkillJoystickData(skillButton.buffSkillId) else skillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillData.BelongTo] or skillData.BelongTo) --pointerUp需要使用 belongTo的双摇杆数据, 跟UISkillJoystick:OnPointerUp相匹配 end if skillButton.isAdjutant then if not skillButton.inDrag then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_EndDrag, comp, eventData, skillJoyStickData) end elseif skillButton.IsRoulette then if not self.isRouletteInCancelArea then if LuaInputManager.GetSpecialCommand() == 0 then LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.SubSkillIndex1 + (self.curSkillRouletteIndex or 1)- 1) self:TakeEffectOnce(skillButton, true) end else self:SetIsRouletteInCancelArea(false) end else local ueType = skillJoyStickData and skillJoyStickData.UEType or ESkillJoystickUEType.DEFAULT if ueType == ESkillJoystickUEType.SIMPLE_BTN or ueType == ESkillJoystickUEType.DEFAULT then skillButton.inPress = false skillButton.releaseAttackKeyFrame = nil LuaInputManager.ReleaseAttackKey() elseif ueType == ESkillJoystickUEType.JOYSTICK_RANGE or ueType == ESkillJoystickUEType.JOYSTICK_DIR then if not skillButton.inDrag then EventSystem.Dispatch(EventID.UIBattle_SkillBtn_EndDrag, comp, eventData, skillJoyStickData) end local curSkillJoyStickData = BattleDataGetter.GetMainEntitySkillJoystickData(self.skillJoystickOverrideDic[skillId] or skillId) --当前技能的双摇杆数据 if skillJoyStickData.UseSkillOnPress or not curSkillJoyStickData then LuaInputManager.ReleaseAttackKey() end elseif ueType == ESkillJoystickUEType.JOYSTICK_RANGE_STATIC_RANGE then LuaInputManager.ReleaseAttackKey() if skillJoyStickData.UseSkillOnPress then EventSystem.Dispatch(EventID.UIBattle_StaticSkillJoy_BtnUp,skillButton.keyPosition) end end end EventSystem.Dispatch(EventID.UIBattle_SkillBtn_PointerUp, comp, eventData, skillJoyStickData, skillData) if skillButton.keyPosition == SkillKeyPosition.Slash then self.slashDownTimer = nil self:StopNormalAttackRange() end local lastSkillData = skillButton.lastSkillData if lastSkillData and lastSkillData.AutoNextConditionStr == "pointerUp" then local nextSkillData = curEntity:GetSkillData(lastSkillData.AutoNextID) if nextSkillData then if BattleDataGetter.CanMainPlayerUseSkill(nextSkillData) then local usingSkillData = BattleDataGetter.GetMainEntityCurSkillData() if skillButton.lastSkillData == skillButton.curSkillData or (usingSkillData and usingSkillData.BelongTo == nextSkillData.BelongTo) then LuaInputManager.SetKeyPosition(nextSkillData.KeyPosition, true) -- 这里设置的KeyPosition在LogicUpdateManager的private.HandleCommand里会被擦除 end end end end skillButton.inDrag = false else logging.error(LTAG.ERROR, "HYW : GetSkillBtnByComp Failed @UIBattleAttackPanel:OnPointerUp ! 按钮名 : ", comp.transform.parent.parent.name) end end self.pointerDownComp = nil self.curSkillRouletteIndex = nil self:ClearOverrideSkillJoystick() end --region ***************索敌相机按钮*************** function UIBattleAttackPanel:EnableTargetCameraButton() if BattleDataGetter.IsForbidSkillBtnView() then return end UIUtils.SetActive(self.event_Camera,true) end function UIBattleAttackPanel:DisableTargetCameraButton() UIUtils.SetActive(self.event_Camera,false) end function UIBattleAttackPanel:OnTargetCameraPatternChange(targeted) if targeted then UTL.Item.SetAtlasSprite(self.sprite_Camera,"UI_Battle", Battle_Camera_TargetPressed) self.event_CameraSwitchTarget.enabled = true if self.targetBtnCloseAnimID then self:StopUIAnimation(self.targetBtnCloseAnimID, false, true) end if self.targetBtnShowAnimID then self:PlayUIAnimation(self.targetBtnShowAnimID) else self.targetBtnShowAnimID = self:PlayUIAnimation("UIChangeBossBtnShow") end else UTL.Item.SetAtlasSprite(self.sprite_Camera,"UI_Battle", Battle_Camera_Target) self.event_CameraSwitchTarget.enabled = false if self.targetBtnShowAnimID then self:StopUIAnimation(self.targetBtnShowAnimID, false, true) end if self.targetBtnCloseAnimID then self:PlayUIAnimation(self.targetBtnCloseAnimID) else self.targetBtnCloseAnimID = self:PlayUIAnimation("UIChangeBossBtnClose") end end end function UIBattleAttackPanel:OnTargetCameraPrepareEntity(add) UIUtils.SetActive(self.event_CameraSwitchTarget, add) end --endregion 索敌相机按钮 function UIBattleAttackPanel:ShowDriveBtn(isShow) UIUtils.SetActive(self.event_Drive,isShow) if isShow then self.effect_toushitishi:PlayUIEffect() else self.effect_toushitishi:StopUIEffect() end end function UIBattleAttackPanel:OnClickAutoFightButton() if not self.isPass then CTL.Tips.AddTipsMsg(Const_IDS["IDS_Autofight_WrongHint"]) return end if self.canAutoFight then LuaInputManager.SetSpecialCommand(LuaConst.SpecialCommandType.AutoFight) if not BattleDataGetter.IsSyncLevel() or (BattleDataGetter.IsWorldBossLevel() or BattleDataGetter.IsWarZoneWorldBossLevel()) then --这里是反的,因为还没有调用switchAutoFight,所以必须得是反的 CTL.Level.SetAutoFight(BattleDataGetter.GetCurLevelType(), BattleDataGetter.GetAutoFightState() and -1 or 1) --↓2023年4月21日新增,主线剧情自动战斗设置也需要存在服务器 if BattleDataGetter.IsNormalLevel() then MDL.Setting.PrepareSetSettingState(LuaConst.BattleSettingEnum.AutoFightNormalLevel, not BattleDataGetter.GetAutoFightState()) --这里是反的,因为还没有调用switchAutoFight,所以必须得是反的 MDL.Setting.SendPlayerSetting() end --↑ end end end function UIBattleAttackPanel:SetPveAutoFightState(state) if self.canAutoFight then NotSyncBattleSetter.SetPveAutoFightState(state) end end function UIBattleAttackPanel:OnAutoFightStateChanged() self:RefreshAutoFightEffect() end function UIBattleAttackPanel:RefreshAutoFightEffect() local autoFightState = BattleDataGetter.GetAutoFightState() and not BattleDataGetter.AutoFightIsSystemLevel() if BattleDataGetter.IsForbidSkillBtnView() then UIUtils.SetActive(self.AutomaticWayfinding, false) else UIUtils.SetActive(self.AutomaticWayfinding, autoFightState and not GameAppInfo.IsMarketPackage()) end if autoFightState then self.effect_AutoFight:PlayUIEffect() else self.effect_AutoFight:StopUIEffect() end if BattleDataGetter.IsGoldHeroCooperate() then MDL.Setting.PrepareSetSettingState(LuaConst.BattleSettingEnum.AutoFightGoldHeroCooperate, autoFightState) MDL.Setting.SendPlayerSetting() end end function UIBattleAttackPanel:OnBanKeyPositions(keyList) if keyList then for i,key in ipairs(keyList) do local skillButton = self.attackBtns[key] if skillButton then skillButton.isBanned = true if key == SkillKeyPosition.MusouNormal then local isMusouActive, isAdjutantActive = BattleDataGetter.IsMyEntityMagicWeaponActive() UIUtils.SetActive(skillButton.btnCollection.group_disable.gameObject, isMusouActive) UIUtils.SetMusouGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, skillButton.progressPercent) else UIUtils.SetActive(skillButton.btnCollection.group_disable.gameObject, true) UIUtils.SetGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned) end if skillButton.inPress then self.skipPointerOnce = true self.skipDragOnce = true LuaInputManager.SetKeyPosition(0) -- 为了保底,防止输入一直输入。(也可以在很多事件中单独加此代码) end end end end end function UIBattleAttackPanel:OnCancelBanKeyPosition(entity) -- entity 一定是自己,这个为了不再查询下UI当前控制的entity才传的 local banDic = BattleDataGetter.GetEntityBanSkillDic(entity) if banDic then for key,skillButton in pairs(self.attackBtns) do local find = false for i,list in pairs(banDic) do for _,v in ipairs(list) do if v == key then find = true break end end if find then break end end skillButton.isBanned = find if key == SkillKeyPosition.MusouNormal then local isMusouActive, isAdjutantActive = BattleDataGetter.IsMyEntityMagicWeaponActive() UIUtils.SetActive(skillButton.btnCollection.group_disable.gameObject, not isMusouActive or skillButton.isBanned) UIUtils.SetMusouGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, skillButton.progressPercent) else UIUtils.SetActive(skillButton.btnCollection.group_disable.gameObject, skillButton.isBanned) if key ~= SkillKeyPosition.Stratagem then -- 计略的按钮不置灰 UIUtils.SetGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned) end end end else self:CloseAllDisable() end end function UIBattleAttackPanel:CloseAllDisable() for key,skillButton in pairs(self.attackBtns) do skillButton.isBanned = false if key == SkillKeyPosition.MusouNormal then local isMusouActive, isAdjutantActive = BattleDataGetter.IsMyEntityMagicWeaponActive() UIUtils.SetActive(skillButton.btnCollection.group_disable.gameObject, not isMusouActive or skillButton.isBanned) if skillButton.progressPercent then UIUtils.SetMusouGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd or skillButton.isBanned, skillButton.progressPercent) end else UIUtils.SetActive(skillButton.btnCollection.group_disable.gameObject, false) if key ~= SkillKeyPosition.Stratagem then -- 计略的按钮不置灰 UIUtils.SetGray(skillButton.btnCollection.sprite_Skill, skillButton.isInCd) end end end end function UIBattleAttackPanel:ShowNormalAttackRange() if not self.isShowNormalAttackRange then return end self.curExpEntity:PlayEffectByType(LuaConst.EffectType.SkillRange) self.curExpEntity:SetEffectPosByType(LuaConst.EffectType.SkillRange,0,0,0) local scale = self.SlashRange or 5 self.curExpEntity:SetEffectScaleByType(LuaConst.EffectType.SkillRange,scale,scale,1) self.isShowingNormalAtkRange = true end function UIBattleAttackPanel:StopNormalAttackRange() if self.isShowingNormalAtkRange then self.curExpEntity:StopEffectByType(LuaConst.EffectType.SkillRange) end end function UIBattleAttackPanel:OnFocusChanged(value) if value then self.isFocus=true else self.isFocus=false end if self.isFocus then for _, btn in pairs(self.attackBtns) do if btn.inPress then btn.inPress = false if btn.keyPosition == SkillKeyPosition.Slash then self.slashDownTimer = nil self:StopNormalAttackRange() end end end end end -- function UIBattleAttackPanel:KeyboardPressSkill(key) local skillId = SKILL_BTN_POSITION_GROUP[self.curSkillKeyStyle][key] if (self.isFocus or self.isCheatModel) and self.attackBtns[skillId] and self.attackBtns[skillId].keyPosition then local curComp = self.attackBtns[skillId].btnCollection.event_Button --Evnentdata 似乎为拖拽型技能坐标,对于点按的技能 eventdata的值无实际用途 self.KeyboardEventData.position.x, self.KeyboardEventData.position.y, self.KeyboardEventData.position.z = curComp.transform:GetLocalPosition() self:OnPointerDown(curComp,self.KeyboardEventData) end end function UIBattleAttackPanel:KeyboardReleaseSkill(key) local skillId = SKILL_BTN_POSITION_GROUP[self.curSkillKeyStyle][key] if (self.isFocus or self.isCheatModel) and self.attackBtns[skillId] and self.attackBtns[skillId].keyPosition then local curComp=self.attackBtns[skillId].btnCollection.event_Button self.KeyboardEventData.position.x, self.KeyboardEventData.position.y, self.KeyboardEventData.position.z = curComp.transform:GetLocalPosition() self:OnPointerUp(curComp,self.KeyboardEventData) self:OnButtonClicked(curComp) end end function UIBattleAttackPanel:EnterCheatModel(isEnter) self.isCheatModel = isEnter end function UIBattleAttackPanel:RefreshShowAutoFightTips(isShow) if isShow then local showAutoFight = BattleDataGetter.GetAutoFightState() and not BattleDataGetter.AutoFightIsSystemLevel() if BattleDataGetter.IsForbidSkillBtnView() then UIUtils.SetActive(self.AutomaticWayfinding, false) else UIUtils.SetActive(self.AutomaticWayfinding, showAutoFight) end else UIUtils.SetActive(self.AutomaticWayfinding, false) end end --添加特殊buff function UIBattleAttackPanel:OnMainEntityAddSpecialViewBuff(entity,buffData, leftBuffTimer) local duration = FP.tonumberV1(buffData.BuffDuration) if duration > 0 then self.curSpecialBuffID = buffData.BuffID UIUtils.SetActive(self.buffBar.gameObject,true) if leftBuffTimer then self.buffBar.sprite_Bg:EndTimer()--防止Pause造成错误 self.buffBar.sprite_Bg:SetAndContinueTimer(false, leftBuffTimer, duration / 1000) else self.buffBar.sprite_Bg:ResetAndBeginTimer(false, duration / 1000) end self.buffBar.sprite_Bg:SetLabel(UTL.String.FormatCombineTextByID(buffData.BuffDescribe)) end end --移除特殊buff function UIBattleAttackPanel:OnMainEntityRemoveSpecialViewBuff(entity,buffData) if self.curSpecialBuffID == buffData.BuffID then self.buffBar.sprite_Bg:EndTimer() end end --特殊技能需要显示的UI(蓄力技能条-糜芳) function UIBattleAttackPanel:BelongSkillProgress(belongSkill, skillData, entity) if skillData then if skillData.AutoNextConditionStr == "pointerUp" then local accumulateSkillInfo = entity.components.skillBase.SerialSkillInfo local accumulateList = accumulateSkillInfo and accumulateSkillInfo[belongSkill.ID] if accumulateList then local totalTime = 0 for i,time in ipairs(accumulateList) do totalTime = totalTime + tonumberV1(time) end UIUtils.SetActive(self.skillBar.slider_Skill ,true) self.skillBarEffectTimeList = {} self.skillBarTotalTime = totalTime / 1000 self.skillBarCurTime = 0 local splitCount = #accumulateList - 1 local splitPos = 0 for i = 1 ,splitCount do splitPos = splitPos + tonumberV1(accumulateList[i]) local splitObj = self.skillBarSplits[i] UIUtils.SetActive(splitObj,true) local width = self.skillBar.slider_Skill.gameObject.transform:GetSizeDelta() splitObj.transform:SetAnchoredPosition(width * splitPos / totalTime ,0) table.insert(self.skillBarEffectTimeList ,splitPos / totalTime) end end end else if belongSkill.AutoNextConditionStr == "pointerUp" then self:HideSkillProgressBarIfActive() end end end --特殊技能或者时机需要显示的进度UI(蓄力技能条-太史慈),一般是通过BattleEffect发动 --timeTable:存储时机 {20,40,60} 单位帧 function UIBattleAttackPanel:SkillProgress_BattleEffect(entity, isShow, timeTable) if entity ~= LogicUpdateManager._curEntity then return end if isShow then if timeTable then local totalFrame = 0 for i,time in ipairs(timeTable) do totalFrame = totalFrame + time end UIUtils.SetActive(self.skillBar.slider_Skill ,true) self.skillBarEffectTimeList = {} self.skillBarTotalTime = totalFrame / 20 self.skillBarCurTime = 0 local splitCount = #timeTable - 1 local splitPos = 0 for i = 1 ,splitCount do splitPos = splitPos + timeTable[i] local splitObj = self.skillBarSplits[i] UIUtils.SetActive(splitObj,true) local width = self.skillBar.slider_Skill.gameObject.transform:GetSizeDelta() splitObj.transform:SetAnchoredPosition(width * splitPos / totalFrame ,0) table.insert(self.skillBarEffectTimeList ,splitPos / totalFrame) end end else self:HideSkillProgressBarIfActive() end end function UIBattleAttackPanel:HideSkillProgressBarIfActive() if self.skillBar.slider_Skill.gameObject.activeInHierarchy then UIUtils.SetActive(self.skillBar.slider_Skill ,false) self.skillBar.effect_done:PlayUIEffect() self.skillBarTotalTime = nil self.skillBarCurTime = nil self.skillBarEffectTimeList = nil for i,splitObj in ipairs(self.skillBarSplits) do UIUtils.SetActive(splitObj,false) end end end function UIBattleAttackPanel:OnPlayerChangeAvatar() self:CloseAllDisable()--大变身时无脑隐藏所有蒙版 end function UIBattleAttackPanel:OnAddBuffSkill(buffSkillUpdate) self:ResetBuffSkillBtn(buffSkillUpdate.BuffSkillData.KeyPosition) if buffSkillUpdate.BuffSkillData.KeyPosition == SkillKeyPosition.BuffSkill2 then self:ResetGodBeastSkillPoints() end if GameAppInfo.IsPCOrMacPackage() and not GameAppInfo.IsMarketPackage() then self:SetOnePCKeyMapDescriptionText(buffSkillUpdate.BuffSkillData.KeyPosition) end end function UIBattleAttackPanel:OnReplaceBuffSkill(buffSkillUpdate, oldData, newData) self:ResetBuffSkillBtn(buffSkillUpdate.BuffSkillData.KeyPosition) if GameAppInfo.IsPCOrMacPackage() and not GameAppInfo.IsMarketPackage() then self:SetOnePCKeyMapDescriptionText(buffSkillUpdate.BuffSkillData.KeyPosition) end end function UIBattleAttackPanel:OnBuffSkillCDReady(buffSkillUpdate) local manipulatingEntity = BattleDataGetter.GetMainPlayerManipulatingEntity() if manipulatingEntity and manipulatingEntity.isHero then self:ResetBuffSkillBtn(buffSkillUpdate.BuffSkillData.KeyPosition) if GameAppInfo.IsPCOrMacPackage() and not GameAppInfo.IsMarketPackage() then self:SetOnePCKeyMapDescriptionText(buffSkillUpdate.BuffSkillData.KeyPosition) end end end function UIBattleAttackPanel:OnBuffSkillEnterCD(buffSkillUpdate) self:ResetBuffSkillBtn(buffSkillUpdate.BuffSkillData.KeyPosition) if GameAppInfo.IsPCOrMacPackage() and not GameAppInfo.IsMarketPackage() then self:SetOnePCKeyMapDescriptionText(buffSkillUpdate.BuffSkillData.KeyPosition) end end function UIBattleAttackPanel:OnSwitchGodBeastSkill(buffSkillUpdate, curGoldBeastData, curGodBeastSkillIndex) self:ResetBuffSkillBtn(buffSkillUpdate.BuffSkillData.KeyPosition) self:ResetGodBeastSkillPoints() if GameAppInfo.IsPCOrMacPackage() and not GameAppInfo.IsMarketPackage() then self:SetOnePCKeyMapDescriptionText(buffSkillUpdate.BuffSkillData.KeyPosition) end end function UIBattleAttackPanel:SetPCKeyMapDescriptionText() for keyPos, btnGroup in pairs(self.attackBtns) do self:SetOnePCKeyMapDescriptionText(keyPos) end end function UIBattleAttackPanel:SetOnePCKeyMapDescriptionText(keyPos) local buttonToPosTable = SKILL_BTN_POSITION_GROUP[self.curSkillKeyStyle] local btnGroup = self.attackBtns[keyPos] local pcKeyMapDic = MDL.Setting.GetPCKeyMap() local keyCode = pcKeyMapDic[k] for k, v in pairs(buttonToPosTable) do if keyPos == v then local keyCode = pcKeyMapDic[k] local btnCollection = btnGroup.btnCollection local describeStr = MDL.Setting.GetKeyStrByKeyCode(keyCode) if btnCollection.txt_SkillType ~= nil then --这两个按钮需要单独设置文本 if v == SkillKeyPosition.Adjutant then UIUtils.SetLabelText(btnCollection.txt_SkillType, Const_IDS["IDS_MinorHero"]) elseif v == SkillKeyPosition.Slash then UIUtils.SetLabelText(btnCollection.txt_SkillType, Const_IDS["IDS_SETKEYPOSITION_Describe_0"]) elseif v == SkillKeyPosition.Stratagem then UIUtils.SetLabelText(btnCollection.txt_SkillType, Const_IDS["IDS_SETKEYPOSITION_Describe_11"]) elseif v == SkillKeyPosition.BuffSkill1 then UIUtils.SetLabelText(btnCollection.txt_SkillType, Const_IDS["IDS_SETKEYPOSITION_Describe_12"]) end local originText = btnCollection.txt_SkillType.text local newText = string.format("%s\n[%s]",originText,describeStr) btnCollection.txt_SkillType.text = newText end end end end function UIBattleAttackPanel:OnSkillDecoratorResetBtn(entity, skillId, type, ...) if entity ~= BattleDataGetter.GetCurSkillUIEntity() then return end local skillData = entity:GetSkillData(skillId) if skillData.BelongTo ~= skillId then skillData = entity:GetSkillData(skillData.BelongTo) end local keyPos = skillData.KeyPosition if keyPos <= 0 then return end local skillButton = self.attackBtns[keyPos] if type == LuaConst.UISkillBtnResetType.RecordReleaseCount then --local releaseCount, maxReleaseCount = ... --local btnCollection = skillButton.btnCollection --logging.error(LTAG.ERROR, " gws: 等UE ,加上点数 : ", releaseCount, maxReleaseCount , " 按钮:", skillButton.keyPosition) elseif type == LuaConst.UISkillBtnResetType.EnterExtraCD then local cdTime, maxCDTime = ... self:UpdateSkillCD(keyPos, cdTime, maxCDTime) elseif type == LuaConst.UISkillBtnResetType.TimingUseSkill or type == LuaConst.UISkillBtnResetType.TimingUseSomeSkill then local leftTime, maxTime = ... self:UpdateSkillProgress(keyPos, leftTime) end end function UIBattleAttackPanel:OnTimelineFinish() if LogicUpdateManager._curEntity then if LogicUpdateManager._curEntity.components.drive:GetDrivedEntity() then return end end self:ResetBuffSkillBtn(SkillKeyPosition.BuffSkill2) end return UIBattleAttackPanel