local UIPlayerGuideHandMove = UIViewClass() local MAXCLICKCOUNT = 5 function UIPlayerGuideHandMove:OnOpened(context) self.clickCount = 0 self.guideData = context.guideData self.backdrop.ClickCallBack = function ( ) self:OnClickBgCb() end self.backdrop.ClickObjCallBack = function ( ) self:OnClickObjCb() end self:InitHead(self.guideData) self.dragItem = UIManager.FindViewTransform('Array/UIArray', "cell_ArrayHero", false).gameObject self:InitMask(self.square1.transform, self.guideData, UIManager.FindViewTransform('Array/UIArray', "group_Hero/Hero03", false)) self:InitMask(self.square2.transform, self.guideData, UIManager.FindViewTransform('Array/UIArray', "group_Hero/Hero01", false)) self:RegistTriggerEvent(self.backdrop, UIEventTriggerType.Drag) end function UIPlayerGuideHandMove:OnButtonClicked(comp) if comp == self.skip_btn then self:OnClickObjCb() end end function UIPlayerGuideHandMove:OnDrag(comp, eventData) if self.dragItem then UIUtils.ScreenPointToWorldPointInRectangle(self.dragItem, eventData) end end function UIPlayerGuideHandMove:InitMask(mask,guideData,obj) mask:SetParent(obj, false) mask:SetParent(self.gameObject.transform, true) mask:SetAsFirstSibling() local values = string.split(guideData.ScreenEffectRange,",") mask:SetSizeDelta(tonumber(values[1]),tonumber(values[2])) self:InitPostion(mask) end function UIPlayerGuideHandMove:InitHead(guideData) if guideData.HeadPic and string.len(guideData.HeadPic) > 0 then local path = ConstAssetPathConfig.path1..guideData.HeadPic..".png" UIUtils.SetImageByAssetBundle(self.img_HeroHead, path) UIUtils.SetLabelText(self.txt_PlayerGuideDialogue,Const_IDS[guideData.Explain]) CTL.Sound.CheckAndPlay(guideData.Explain) self.group_PlayerGuideDialogue.gameObject:SetActive(true) else self.group_PlayerGuideDialogue.gameObject:SetActive(false) end end function UIPlayerGuideHandMove:OnClickObjCb() if self.dragItem then UIManager.CallViewFunction('Array/UIArray', "OnEndDrag") end CTL.PlayerGuide.FinishGuide(self.guideData) CTL.Sound.PlayGameSound("UI_sound_Qiejiang") CTL.Array.LineUpHeroIdsRequest(3, MDL.Player.GetHeroLinUpIds()[1]) --第一个和第三个武将互换 self:CloseView() end function UIPlayerGuideHandMove:OnClickBgCb() if self.dragItem then UIManager.CallViewFunction('Array/UIArray', "OnEndDrag") end self.clickCount = self.clickCount + 1 if self.clickCount >= MAXCLICKCOUNT then self.skip_btn.gameObject:SetActive(true) end end function UIPlayerGuideHandMove:InitPostion(mask) local x, y = self.group_PlayerGuideDialogue:GetAnchoredPosition() if self.guideData.ExplainPosition and string.len(self.guideData.ExplainPosition) > 0 then local values = string.split( self.guideData.ExplainPosition,",") x = x + tonumber(values[1]) y = y + tonumber(values[2]) end self.group_PlayerGuideDialogue:SetAnchoredPosition(x, y) end return UIPlayerGuideHandMove