local UISuperGoldHonorOrderPurchase = UIViewClass() local EventSystem = require('Event/EventSystem') function UISuperGoldHonorOrderPurchase:OnOpened(context) self.activityType = MDL.OperationActivity.ActivityType.SuperGold self.activityId = context.activityId self.heroType = context.heroType self:RegistSystemEvent(EventID.UI_SuperGoldHonorOrder_IsSenior, self.CloseUI) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) local curHonorOrderInfo = MDL.SuperGoldHonorOrder.GetServerInfoByActivityID(self.activityId) self.honorOrderCfg = MDL.SuperGoldHonorOrder.GetCurHonorOrderConstData(curHonorOrderInfo.HonorOrderId) self.isSenior = curHonorOrderInfo.IsSenior if not self.isSenior then UIUtils.SetLabel(self.txt_Buy, string.FormatByIdsId(Const_IDS.IDS_HonorOrder_JieSuoJiaGe, MDL.Currency.GetFullyIAPPrice(self.honorOrderCfg.IAPid))) -- 购买价格 end local amount = MDL.Currency.GetAmountByIAPIndex(self.honorOrderCfg.IAPid) UIUtils.SetActive(self.txt_Score, amount and true or false) if amount then UIUtils.SetLabel(self.txt_Score, string.FormatByIdsId(Const_IDS.IDS_TotalTopUp_Score_Tips_Giftbag, amount)) end self:ShowSuperGoldHonorOrderRewardList() end function UISuperGoldHonorOrderPurchase:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldHonorOrderPurchase:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseUI() elseif comp == self.btn_Buy then if not MDL.SuperGoldHonorOrder.GetCurHonorOrderIsOpen(self.activityId) then CTL.Tips.AddTipsMsg(Const_IDS.IDS_ERRORCODE_174_WarnCode_Activity_EndWrongHint) -- 活动已结束 return end --购买战令 if self.isSenior then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Fund_Button_Paid) -- 已购买 else MDL.Currency.GetOrderIDReq(self.honorOrderCfg.IAPid, MDL.Currency.PayType.SubHonorOrder, self.honorOrderCfg.ID, self.activityId, self.activityType) end else for i = 1, 5 do if comp == self.group_RewardContent1[i].item.event_Click then UTL.ItemTips.ShowCommonTipsById(self.rewardList[i].ItemID) return end end for i = 6, #self.rewardList do if comp == self.group_RewardContent2[i - 5].item.event_Click then UTL.ItemTips.ShowCommonTipsById(self.rewardList[i].ItemID) return end end end end function UISuperGoldHonorOrderPurchase:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISuperGoldHonorOrderPurchase:ShowSuperGoldHonorOrderRewardList() local cfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(self.honorOrderCfg.RewardClientShowID) self.rewardList = DataSheetUtil.GetRewardClientShowItemTable(cfg) if self.group_RewardContent1 then for i = 1, 5 do local contentItem = self.group_RewardContent1[i] if not contentItem then contentItem = self:InstantiateCollection(self.group_RewardContent1, self.cell_Reward.gameObject) end UTL.Item.SetItemCell(contentItem.item, self.rewardList[i].ItemID, self.rewardList[i].ItemNum) UIUtils.SetActive(contentItem.gameObject, true) end for i = 6, #self.rewardList do local contentItem = self.group_RewardContent2[i - 5] if not contentItem then contentItem = self:InstantiateCollection(self.group_RewardContent2, self.cell_Reward.gameObject) end UTL.Item.SetItemCell(contentItem.item, self.rewardList[i].ItemID, self.rewardList[i].ItemNum) UIUtils.SetActive(contentItem.gameObject, true) end else self.loop_Item:ReloadAll(self.rewardList) self.loop_Item:MoveIndex(0) end end function UISuperGoldHonorOrderPurchase:CloseUI() if MDL.SuperGoldHonorOrder.GetServerInfoByActivityID(self.activityId).IsSenior then EventSystem.Dispatch(EventID.UI_SuperGoldHonorOrder_IsSeniorPlayUIEffect) end self:CloseView() end function UISuperGoldHonorOrderPurchase:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.SetItemCell(cellTable.item, data.ItemID, data.ItemNum) end function UISuperGoldHonorOrderPurchase:OnCellClicked(scrollRect, index, cellTable, target, data) UTL.ItemTips.ShowCommonTipsById(data.ItemID) end return UISuperGoldHonorOrderPurchase