require("Base/BasePanel") WishGemBuyOnePanel = Inherit(BasePanel) local this=WishGemBuyOnePanel local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local gameSetting=ConfigManager.GetConfig(ConfigName.GameSetting) local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting) local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig) local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig) local activityConfig=ConfigManager.GetConfigData(ConfigName.ActivityGroups,203) local itemNum=0 --抽卡小号道具数量 local isFree=false local itemId = 0 local RecruitMaxtimesId = 0 local freeTimesId = 0 local recType = {} local orginLayer local costId=0 local activityId=0 --初始化组件(用于子类重写) function WishGemBuyOnePanel:InitComponent() this.spLoader = SpriteLoader.New() orginLayer = 10 self.bg = Util.GetGameObject(self.gameObject, "effect") -- self.dibiao = Util.GetGameObject(self.bg, "dibiao") -- self.dibiao.gameObject:SetActive(false) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft, panelType = PanelType.Gem }) screenAdapte(self.bg) this.btnBack=Util.GetGameObject(self.gameObject, "bottom/backButton") this.content=Util.GetGameObject(self.gameObject, "content") this.openOneAgainButton=Util.GetGameObject(self.gameObject, "bottom/openOneAgainButton") 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/openOneAgainButton/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.itemInfo3=Util.GetGameObject(this.content3, "info"):GetComponent("Text") this.itemInfo3.text="单次" end --绑定事件(用于子类重写) function WishGemBuyOnePanel:BindEvent() Util.AddClick(this.btnBack, function () self:ClosePanel() end) Util.AddClick(this.openOneAgainButton, function () Log(tostring(this.recruitType)) NetManager.GemNewDrawRequest(this.recruitType,1,function(msg) UIManager.OpenPanel(UIName.WishGemBuyOnePanel,msg.drop,this.recruitType,costId,activityId) --CheckRedPointStatus(self.config.RpType) end) end) end --添加事件监听(用于子类重写) function WishGemBuyOnePanel:AddListener() end --移除事件监听(用于子类重写) function WishGemBuyOnePanel:RemoveListener() end function WishGemBuyOnePanel:OnSortingOrderChange() Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer) orginLayer = self.sortingOrder -- if this.view then -- this.view:OnOpen(true,this.itemDataList[1],1.4,true,false,false,self.sortingOrder) -- end end --界面打开时调用(用于子类重写) function WishGemBuyOnePanel:OnOpen(...) self.bg.gameObject:SetActive(false) self.bg.gameObject:SetActive(true) SoundManager.PlaySound(SoundConfig.UI_Siyuanzhen) this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Gem }) local args = { ... } this.drop=args[1] this.recruitType=args[2] activityId=args[4] costId = args[3] local str= ConfigManager.GetConfigData(ConfigName.SpecialConfig,costId).Value str=StringToTable(str) local d = RecruitManager.GetExpendDataByCostItem(str,1,100) this.itemNum3.gameObject:SetActive(true) this.itemIcon3.gameObject:SetActive(true) this.itemInfo3.text="单次" itemId=0 itemId = d[1] itemNum = d[2] this.itemIcon3.sprite=this.spLoader:LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name) this.itemNum3.text= "×"..itemNum Util.ClearChild(Util.GetTransform(this.content, "itemContent1")) this.itemDataList={} this.itemDataList=BagManager.GetTableByBackDropData(this.drop) this.view = SubUIManager.Open(SubUIConfig.ItemView,Util.GetTransform(this.content, "itemContent1")) this.view:OnOpen(true,this.itemDataList[1],1.4,true,false,false,self.sortingOrder) this.openOneAgainButton:GetComponent("Button").enabled=false local time = Timer.New(function () this.openOneAgainButton:GetComponent("Button").enabled=true end, 0.5) time:Start() end function WishGemBuyOnePanel:OnShow() 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 end --界面关闭时调用(用于子类重写) function WishGemBuyOnePanel:OnClose() --LogError("单抽界面关闭------------------------------------") --Game.GlobalEvent:DispatchEvent(GameEvent.Gem.RefreshPanel) end --界面销毁时调用(用于子类重写) function WishGemBuyOnePanel:OnDestroy() this.spLoader:Destroy() SubUIManager.Close(this.UpView) if this.view then this.view = nil end if this.timer then this.timer:Stop() this.timer = nil end end return WishGemBuyOnePanel