local UIPlayerGuideControl = UIViewClass() local MAXCLICKCOUNT = 5 local EventSystem = require('Event/EventSystem') function UIPlayerGuideControl:OnOpened(context) self:RegistSystemEvent(EventID.UI_Guide_VirtualJoystick_PointerDown,self.OnPointerDown) self.clickCount = 0 self.guideData = context.guideData self:InitHead(self.guideData) self.sprite_Back.transform:SetPosition(UIManager.FindViewTransform(Const_UI_Lua.UIEnum.UIVirtualController, "sprite_Back", true):GetPosition()) self:InitPostion() end function UIPlayerGuideControl:OnPointerDown() self:CloseView() CTL.PlayerGuide.FinishGuide(self.guideData) EventSystem.Dispatch(EventID.BI_ViewClick, BIManager.ViewBIEvent.UIVirtualController_Direction) end function UIPlayerGuideControl: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 UIPlayerGuideControl:InitPostion() 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 UIPlayerGuideControl