require("Base/BasePanel") require("Base/Stack") WishGemBuyTenPanel = Inherit(BasePanel) local this=WishGemBuyTenPanel local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local gameSetting=ConfigManager.GetConfig(ConfigName.GameSetting) local artResourcesConfig=ConfigManager.GetConfig(ConfigName.ArtResourcesConfig) local YaojingCallPrivilegeId = 2006 local itemId=0 local itemNum=0 --抽卡小号道具数量 local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting) local callList = Stack.New() local costId=0 local activityId=0 local isShowLv=0 this.contentList={} this.contentListParent={} this.isElementDrawPanel=false local orginLayer --初始化组件(用于子类重写) function WishGemBuyTenPanel:InitComponent() this.spLoader = SpriteLoader.New() orginLayer = 0 self.bg = Util.GetGameObject(self.gameObject, "effect") screenAdapte(self.bg) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft, panelType = PanelType.Gem}) this.btnBack=Util.GetGameObject(self.gameObject, "bottom/backButton") this.openTenAgainButton=Util.GetGameObject(self.gameObject, "bottom/openTenAgainButton") this.costImage=Util.GetGameObject(self.gameObject, "bottom/openTenAgainButton/Image") this.detailImage=Util.GetGameObject(self.gameObject, "Tip") this.detailText = Util.GetGameObject(this.detailImage, "Text"):GetComponent("Text") this.detailImage:SetActive(true) this.detailText.text="仅保留高品质命石属性" this.content3=Util.GetGameObject(self.gameObject,"bottom/openTenAgainButton/Content3") this.content3:SetActive(true) this.itemIcon3=Util.GetGameObject(this.content3, "icon"):GetComponent("Image") this.itemTip3=Util.GetGameObject(this.content3, "icon/Tip") this.itemTip3:SetActive(false) this.itemNum3=Util.GetGameObject(this.content3, "num"):GetComponent("Text") this.itemNum3.text="X10" this.itemInfo3=Util.GetGameObject(this.content3, "info"):GetComponent("Text") --this.tipText=Util.GetGameObject(this.openOneAgainButton, "Text"):GetComponent("Text") for i = 1, 10 do this.contentList[i]=Util.GetGameObject(self.gameObject, "content/itemAnimEffect"..i.."/image/Kuang/itemName/itemContent") this.contentListParent[i]=Util.GetGameObject(self.gameObject, "content/itemAnimEffect"..i) end end --绑定事件(用于子类重写) function WishGemBuyTenPanel:BindEvent() Util.AddClick(this.btnBack, function () PlaySoundWithoutClick(SoundConfig.Sound_UICancel) self:ClosePanel() end) Util.AddClick(this.openTenAgainButton, function () if BagManager.GetItemCountById(itemId) < itemNum then PopupTipPanel.ShowTip(GetLanguageStrById(ItemConfig[itemId].Name)..Language[10486]) return end NetManager.GemNewDrawRequest(this.recruitType,10,function(msg) UIManager.OpenPanel(UIName.WishGemBuyTenPanel,msg.drop,this.recruitType,costId,activityId) --CheckRedPointStatus(self.config.RpType) end) end) end --添加事件监听(用于子类重写) function WishGemBuyTenPanel:AddListener() end --移除事件监听(用于子类重写) function WishGemBuyTenPanel:RemoveListener() end function WishGemBuyTenPanel:OnSortingOrderChange() Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer) for i = 1, 10 do Util.AddParticleSortLayer(this.contentListParent[i], self.sortingOrder - orginLayer) end orginLayer = self.sortingOrder if this.views and this.itemDataList then for index, view in pairs(this.views) do view:OnOpen(true,this.itemDataList[index],1.4,true,false,false,self.sortingOrder) end end end --界面打开时调用(用于子类重写) function WishGemBuyTenPanel:OnOpen(...) SoundManager.PlaySound(SoundConfig.UI_Siyuanzhen) this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Gem}) -- this.itemIcon1.sprite=this.spLoader:LoadSprite(GetResourcePath(ItemConfig[SecretBoxManager.MainCost[2][1][1]].ResourceID)) local args = { ... } this.drop=args[1] this.recruitType=args[2] costId=args[3] activityId=args[4] local lv=0 --宝箱等级 local showLv = PlayerPrefs.GetInt(PlayerManager.uid.."newGem"..activityId) local actconfigs=ActivityGiftManager.GetActivityInfoByType(activityId) local progresss=0 if actconfigs then for i = 1,#actconfigs.mission do progresss=actconfigs.mission[i].progress local config=ConfigManager.TryGetConfigData(ConfigName.GemLotteryConfig,actconfigs.mission[i].missionId)--ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.GemLotteryConfig,"Library",this.recruitType ,"Level",actconfigs.mission[i].missionId) if actconfigs.mission[i].state==0 and progresss>=config.LibraryNumber then lv=config.Level end end end if lv>0 and lv>showLv then CheckRedPointStatus(RedPointType.Gem_1) CheckRedPointStatus(RedPointType.Gem_2) PlayerPrefs.SetInt(PlayerManager.uid.."newGem"..activityId,lv) UIManager.OpenPanel(UIName.GemBoxLvUpPopup,lv) end LogError("costid============"..costId) local str= ConfigManager.GetConfigData(ConfigName.SpecialConfig,costId).Value str=StringToTable(str) local d = RecruitManager.GetExpendDataByCostItem(str,2,100) itemId = d[1] itemNum = d[2] this.itemIcon3.sprite=this.spLoader:LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name) this.itemNum3.text="X"..itemNum local itemDataList={} itemDataList=BagManager.GetTableByBackDropData(this.drop) this.openTenAgainButton:GetComponent("Button").enabled=false this.btnBack:GetComponent("Button").enabled=false callList:Clear() callList:Push(function () Log("结束了!!!") this.openTenAgainButton:GetComponent("Button").enabled=true this.btnBack:GetComponent("Button").enabled=true end) this.views = {} this.itemDataList = itemDataList local dataNum = #itemDataList > 10 and 10 or #itemDataList for i = dataNum, 1, -1 do Util.ClearChild(this.contentList[i].transform) this.views[i] = SubUIManager.Open(SubUIConfig.ItemView,this.contentList[i].transform) local curItemData=itemDataList[i] local contentGO = this.contentListParent[i] this.views[i]:OnOpen(true,curItemData,1.4,true,false,false,self.sortingOrder) contentGO:SetActive(false) callList:Push(function () if curItemData.configData and curItemData.configData.ItemType==4 and curItemData.configData.Quantity>=gameSetting[1].IfVersion then UIManager.OpenPanel(UIName.SecretBoxShowPokemonPanel,curItemData.configData.Id, function () Timer.New(function () contentGO:SetActive(true) callList:Pop()() end, 0.2):Start() end) else Timer.New(function () contentGO:SetActive(true) callList:Pop()() end, 0.2):Start() end end) end callList:Pop()() end --界面关闭时调用(用于子类重写) function WishGemBuyTenPanel:OnClose() --Game.GlobalEvent:DispatchEvent(GameEvent.Gem.RefreshPanel) end --界面销毁时调用(用于子类重写) function WishGemBuyTenPanel:OnDestroy() this.spLoader:Destroy() SubUIManager.Close(this.UpView) this.views = nil if this.timer then this.timer:Stop() this.timer = nil end end return WishGemBuyTenPanel