local UIVIPInvitation = UIViewClass() local LINEAppNumber = DataSheetManager.ConstData:GetDataByID("VIPInvitationLineNum").StringValue local WhatsAppNumber = DataSheetManager.ConstData:GetDataByID("VIPInvitationWhatsAppNum").StringValue local DisplayItemList = DataSheetManager.ConstData:GetDataByID("VIPInvitationDisplayItem").IntListValue local StringFormat = string.format function UIVIPInvitation:OnOpened(context) self.appType = MDL.VIP.GetAppType() --根据大区会用到不同的app来切不同的state if self.appType == MDL.VIP.AppType.Line then self.txt_Number.text = LINEAppNumber self.state_App:SetState(0) elseif self.appType == MDL.VIP.AppType.WhatsApp then self.txt_Number.text = WhatsAppNumber self.state_App:SetState(1) elseif self.appType == MDL.VIP.AppType.ZALOApp then local ZALOAppNumber = DataSheetManager.ConstData:GetDataByID("VIPInvitationZALONum").StringValue self.txt_Number.text = ZALOAppNumber self.state_App:SetState(2) end --显示剩余时间 local timeText = UIUtils.GetLocalizedTxt(Const_IDS.IDS_VIPInvitation_TimeHint) self.txt_Time:SetDHMSStr(StringFormat(timeText, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime1)), StringFormat(timeText, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime2)), StringFormat(timeText, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime3)), StringFormat(timeText, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime4))) self.txt_Time:ResetAndBeginCustomTimer(false, CTL.VIP.GetVIPInvitationLeftTime(), 0, nil) -- CN UTL.Item.SetLocalizationImage(self.loc_Title, self.img_Title, "jzyqh_msz_01.png") if GameAppInfo.IsChinesePackage() then if SDKUtil.ChannelID == LuaConst.SDKChannelId.Hero_Android or SDKUtil.ChannelID == LuaConst.SDKChannelId.Hero_iOS then UIUtils.SetLabelText(self.lab_InfoCN01, Const_IDS.IDS_VIPInvitation_NewHint_1) UIUtils.SetLabelText(self.lab_InfoCN02, Const_IDS.IDS_VIPInvitation_NewHint_2) self.state_CN:SetState(1) self.CNItemData = DataSheetManager.ConstData:GetDataByID("VIPInvitationDisplayItem").IntListValue UTL.Item.SetItemCell(self.item_CN, self.CNItemData[1], self.CNItemData[2]) else --已经在外层做了拦截,理论上不会走到这个判断里 logging.error(LTAG.ERROR, "国服渠道包也显示了极尊邀请函相关内容,请检查!!!") self:CloseView() end else self.state_CN:SetState(0) for i, v in ipairs(self.group_Reward) do local itemId = DisplayItemList[i * 2 - 1] if itemId and itemId > 0 then UIUtils.SetActive(v.gameObject.transform.parent, true) UTL.Item.SetItemCell(v, itemId, DisplayItemList[i * 2]) else UIUtils.SetActive(v.gameObject.transform.parent, false) end end end self:StartRepeatFunc(self.AutoCloseView, MDL.VIP.GetVIPInvitationEndTime() - UTL.Time.GetServerTimestamp(), 1) end function UIVIPInvitation:AutoCloseView(deltaTime, timeSinceUpdate) self:CloseView() end function UIVIPInvitation:OnButtonClicked(comp) if comp == self.btn_Go then CTL.VIP.ExecuteVIPInvitationLink(self.appType) elseif comp == self.btn_Copy then UIUtils.GetSystemCopyText(self.txt_Number.text) CTL.Tips.AddTipsMsg(Const_IDS.IDS_VIPInvitation_CopyHint) elseif comp == self.btn_More then UIManager.OpenView(Const_UI_Lua.UIEnum.UIVIPInvitationTip) elseif comp == self.btn_Close then self:CloseView() elseif comp == self.item_CN.event_Click then UTL.ItemTips.ShowCommonTipsById(self.CNItemData[1]) else for i, v in ipairs(self.group_Reward) do if comp == v.event_Click then UTL.ItemTips.ShowCommonTipsById(DisplayItemList[i * 2 - 1]) end end end end function UIVIPInvitation:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end return UIVIPInvitation