local UICommonFakeScore = UIViewClass() local FakeScoreStarNum = 5 local JumpScoreStar = 4 ---------------------------- function UICommonFakeScore:OnOpened(context) self:RegistSystemEvent(EventID.FunctionUnlockUpdate, self.OnFunctionUnlockUpdate) self.scoreNum = 0 self:InitFakeScoreStar() end function UICommonFakeScore:OnClosed() PersistentData.PlayerData:Set("OpenFakeScore", true, true) end function UICommonFakeScore:OnBackButtonPressed() self:OnButtonClicked(self.btn_Canel) end function UICommonFakeScore:OnButtonClicked(comp) if comp == self.btn_Canel or comp == self.Bottom then self:CloseFakeScore() elseif comp == self.btn_Confirm then if self.scoreNum >= JumpScoreStar then self:CloseFakeScore() SDKUtil.ShowStoreScoreView() else CTL.Tips.AddTipsMsg(Const_IDS.IDS_FakeScore_Thank) self:CloseFakeScore() end else for i = 1, #self.group_Star do local item = self.group_Star[i] if item.btn_Star == comp then self.scoreNum = i self:ClickStar(i) end end end end ---------------------------- function UICommonFakeScore:InitFakeScoreStar() for i = 1, FakeScoreStarNum do local item = self.group_Star[i] if not item then item = self:InstantiateCollection(self.group_Star, self.template_Star.gameObject) end item.uistate:SetState(0) UIUtils.SetActive(item.gameObject, true) end end function UICommonFakeScore:ClickStar(index) for i = 1, #self.group_Star do if i <= index then self.group_Star[i].uistate:SetState(1) else self.group_Star[i].uistate:SetState(0) end end end function UICommonFakeScore:CloseFakeScore() CTL.PushInterface.HidePushInterface(self.__viewClassPath) self:CloseView() end function UICommonFakeScore:OnFunctionUnlockUpdate(funcId, isUnlock) if funcId == MDL.Unlock.FunctionType.FakeScore and not isUnlock then self:CloseFakeScore() end end return UICommonFakeScore