local GemRewardInfoPanel = quick_class("GemRewardInfoPanel", BasePanel) local itemData = ConfigManager.GetConfig(ConfigName.ItemConfig) local gemConfig = ConfigManager.GetConfig(ConfigName.GemConfigNew) local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) local list={} local activityId=0 local curLv=0 local progress=0 local curType=0 local rewardConfig=nil local isCan=false local quaName={"粗糙","普通","优良","优秀","稀有","史诗","传说","神话"} local quaColor={ Color.New(211/255,193/255,158/255,1), Color.New(106/255,188/255,54/255,1), Color.New(60/255,92/255,164/255,1), Color.New(145/255,28/255,108/255,1), Color.New(176/255,170/255,49/255,1), Color.New(162/255,38/255,38/255,1), Color.New(210/255,200/255,90/255,1), Color.New(149/255,228/255,233/255,1) } function GemRewardInfoPanel:InitComponent() self.spLoader = SpriteLoader.New() self.btn_close=Util.GetGameObject(self.gameObject, "bg/close") self.info=Util.GetGameObject(self.gameObject, "bg/info"):GetComponent("Text") self.curlv=Util.GetGameObject(self.gameObject, "bg/curLv/Text"):GetComponent("Text") self.nextlv=Util.GetGameObject(self.gameObject, "bg/nextLv/Text"):GetComponent("Text") self.lvInfo=Util.GetGameObject(self.gameObject, "bg/progress"):GetComponent("Text") self.rewardInfo= Util.GetGameObject(self.gameObject, "bg/rewardInfo"):GetComponent("Text") self.btn_go=Util.GetGameObject(self.gameObject, "bg/Button") self.btn_Text=Util.GetGameObject(self.gameObject, "bg/Button/Text"):GetComponent("Text") self.rewardGrid=Util.GetGameObject(self.gameObject, "bg/rewardGrid").transform for i=1,8 do list[i]={} local line=Util.GetGameObject(self.gameObject, "bg/grid/pre ("..i..")" ) list[i].curLv=Util.GetGameObject(line, "curLv/Text" ):GetComponent("Text") list[i].curImg=Util.GetGameObject(line, "curLv"):GetComponent("Image") list[i].nextImg=Util.GetGameObject(line, "nextLv"):GetComponent("Image") list[i].nextLv=Util.GetGameObject(line, "nextLv/Text" ):GetComponent("Text") end end function GemRewardInfoPanel:BindEvent() Util.AddClick(self.btn_close, function () self:ClosePanel() end) Util.AddClick(self.btn_go,function() if isCan then LogError("actId===="..activityId.." data.missionId=="..rewardConfig.Id) ActivityGiftManager.GetActivityRewardRequest(activityId,rewardConfig.Id,function() Game.GlobalEvent:DispatchEvent(GameEvent.Gem.RefreshPanel) self:CheckReward() end) else self:ClosePanel() end end) end function GemRewardInfoPanel:AddListener() --Game.GlobalEvent:AddEvent(GameEvent.Gem.RefreshPanel, self.Refresh,self) end function GemRewardInfoPanel:RemoveListener() --Game.GlobalEvent:RemoveEvent(GameEvent.Gem.RefreshPanel, self.Refresh,self) end --待功能扩展(试图打开某个状态) function GemRewardInfoPanel:OnOpen(...) local args={...} curType=args[1] curLv=args[2] progress=args[3] activityId=args[4] end function GemRewardInfoPanel:OnSortingOrderChange() end local itemList={} function GemRewardInfoPanel:OnShow() local nextLv=curLv+1 local curConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.GemLotteryConfig,"Library",curType,"Level",curLv) local nextConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.GemLotteryConfig,"Library",curType,"Level",nextLv) if nextConfig==nil then nextConfig=curConfig end --local self.curlv.text="当前等级:"..curLv self.nextlv.text="下一等级:"..nextLv local qua=0 for i=1,8 do list[i].curLv.text=quaName[i].." "..curConfig.Show[1][i]/100 .."%" if curConfig.Show[1][i]>0 then qua=i end list[i].nextLv.text=nextConfig.Show[1][i]/100 .."%" list[i].curImg.color=quaColor[i] list[i].nextImg.color=quaColor[i] end self.lvInfo.text=progress.."/"..nextConfig.LibraryNumber self.info.text="最高可开出"..quaName[qua] .."品质命石" self:CheckReward() end --检测奖励 function GemRewardInfoPanel:CheckReward() local actconfigs=ActivityGiftManager.GetActivityInfoByType(activityId) isCan=false rewardConfig=nil if actconfigs then for i = 1,#actconfigs.mission do local config=ConfigManager.TryGetConfigData(ConfigName.GemLotteryConfig,actconfigs.mission[i].missionId)--ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.GemLotteryConfig,"Library",curType,"Level",actconfigs.mission[i].missionId) LogError("config.id==="..config.Id) if actconfigs.mission[i].state==0 and config.Reward and #config.Reward>0 and tonumber(config.Reward[1][1])~=nil then rewardConfig=config if progress>=config.LibraryNumber then isCan=true break else isCan=false break end end end end --奖励 if not itemList then itemList = {} end for k,v in ipairs(itemList) do v.gameObject:SetActive(false) end if rewardConfig then for i = 1 , #rewardConfig.Reward do if not itemList[i] then itemList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.rewardGrid) itemList[i].gameObject:SetActive(false) end itemList[i]:OnOpen(false, rewardConfig.Reward[i], 0.9,false,false,false,self.sortingOrder) itemList[i].gameObject:SetActive(true) end end if isCan then self.btn_Text.text="领取" else self.btn_Text.text="前往" end self.rewardInfo.text="宝箱"..rewardConfig.Level.."级奖励" end function GemRewardInfoPanel:OnClose() CheckRedPointStatus(RedPointType.Gem) CheckRedPointStatus(RedPointType.Gem_1) CheckRedPointStatus(RedPointType.Gem_2) end function GemRewardInfoPanel:OnDestroy() self.spLoader:Destroy() itemList={} end return GemRewardInfoPanel