require("Base/BasePanel") WorldArenaUpRewardPanel = Inherit(BasePanel) local this = WorldArenaUpRewardPanel local RankConfig=ConfigManager.GetConfig(ConfigName.MServerRankConfig) local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) local lastRankId=10 local currRankId=12 local lastScore=180 local currScore=212 local rankData local maxScore local minScore local layer --初始化组件(用于子类重写) function WorldArenaUpRewardPanel:InitComponent() this.spLoader = SpriteLoader.New() this.titleImg=Util.GetGameObject(self.gameObject, "Bg/bg/title"):GetComponent("Image") this.titleObj=Util.GetGameObject(self.gameObject, "Bg/bg") this.titleImg.sprite=this.spLoader:LoadSprite("y_yuxulundao_duanweichongzhi_zh") this.rankName=Util.GetGameObject(self.gameObject, "Bg/rankName"):GetComponent("Text") this.rankImg=Util.GetGameObject(self.gameObject, "Bg/RankImg") this.scoreTxt=Util.GetGameObject(self.gameObject, "Bg/hangOnTime"):GetComponent("Text") this.text1=Util.GetGameObject(self.gameObject, "Bg/upRewardObj/userNameText"):GetComponent("Text") this.text1.text="进阶奖励" this.tipImg=Util.GetGameObject(self.gameObject, "tipImage"):GetComponent("Image") this.tipImg.sprite=this.spLoader:LoadSprite("r_zhandou_rewardtap2_zh") this.rewardObj=Util.GetGameObject(self.gameObject, "Bg/upRewardObj") this.rewardObj:SetActive(false) this.grid=Util.GetGameObject(self.gameObject, "Bg/upRewardObj/scroll/grid") this.progress=Util.GetGameObject(self.gameObject, "Bg/progressbar/progress"):GetComponent("Image") this.btn_close=Util.GetGameObject(self.gameObject, "maskImage") this.starList={} for i = 1, 5 do table.insert(this.starList,Util.GetGameObject(self.gameObject, "Bg/starPar/Image"..i)) end end --绑定事件(用于子类重写) function WorldArenaUpRewardPanel:BindEvent() Util.AddClick(self.btn_close, function() self:ClosePanel() end) end local titleLive local currRank function WorldArenaUpRewardPanel:OnOpen(...) --赛季重制显示重置图标 if true then this.titleObj.gameObject:SetActive(true) else this.titleObj.gameObject:SetActive(false) end rankData=RankConfig[lastRankId] minScore=rankData.ScoreLow maxScore=rankData.ScoreUp currRank= rankData.RankGrade+1 titleLive = poolManager:LoadAsset("fx_duanwei_0"..currRank, PoolManager.AssetType.GameObject) titleLive.transform:SetParent(this.rankImg.transform) titleLive.transform.localPosition=Vector3.New(0,-600,0) titleLive.transform.localScale =Vector3.New(1,1,1) AddParticleSortLayer(titleLive,self.sortingOrder) if not rankData then return end this.rankName.text=rankData.RankName this.scoreTxt.text=lastScore.."/"..rankData.ScoreUp this.progress.fillAmount=(lastScore-minScore)/(maxScore-minScore) currRank=rankData.RankGrade this.SetStarShow(rankData.RankLevel,rankData.RankGrade,self.sortingOrder) this.StartProgressChange(function() local callList2 = Stack.New() local itemRandomDataList={} local aaa={} aaa.itemlist={} for i = 1, 10 do local item={} item.itemId=16 item.itemNum=100 table.insert(aaa.itemlist,item) end itemRandomDataList=BagManager.GetTableByBackDropData(aaa) local baseContentList2={} this.SetItemShow(aaa,itemRandomDataList,this.grid.transform,callList2,baseContentList2) end) end --星级和段位图标显示 function this.SetStarShow(star,grade,layer) -- 设置星级 WorldArenaManager.SetStarShow(this.starList, rankData.RankLevel) if currRank~=grade then if titleLive then destroy(titleLive) LogError("grade=="..grade) currRank=grade titleLive = poolManager:LoadAsset("fx_duanwei_0"..grade, PoolManager.AssetType.GameObject) titleLive.transform:SetParent(this.rankImg.transform) titleLive.transform.localPosition=Vector3.New(0,-600,0) titleLive.transform.localScale =Vector3.New(1,1,1) AddParticleSortLayer(titleLive,layer) end this.rankName.text=rankData.RankName end end -- 根据物品列表数据显示物品 function this.SetItemShow(drop,dataList,transform,callList,baseContentList) this.rewardObj:SetActive(true) BagManager.OnShowTipDropNumZero(drop) if drop==nil then return end for i = 1, #dataList do dataList[i].itemConfig = itemConfig[dataList[i].sId] end --self:ItemDataListSort(dataList) for i = 1, math.max(#dataList, #baseContentList) do local go = baseContentList[i] if not go then go = SubUIManager.Open(SubUIConfig.ItemView, transform) go.gameObject.name = "frame"..i baseContentList[i] = go end go.gameObject:SetActive(false) end callList:Clear() for i = #dataList, 1, -1 do local view = baseContentList[i] local curItemData=dataList[i] view:OnOpen(true,curItemData,1.15,true,true,false,layer) --view.gameObject:SetActive(false) callList:Push(function () local func = function() view.gameObject:SetActive(true) local btn = Util.GetGameObject(view.gameObject, "item/frame"):GetComponent("Button") btn.enabled = false PlayUIAnim(view.gameObject, function() btn.enabled = true end) Timer.New(function () isPopGetSSR = false if callList:Count()~=0 then callList:Pop()() end end, 0.1):Start() end func() end) end callList:Pop()() end function WorldArenaUpRewardPanel:OnSortingOrderChange() layer=self.sortingOrder end --滚动条数 local num=0 --走的条数 local walkNum=0 --开始进度条滚动 function this.StartProgressChange(func) if this.TimeCounter then this.TimeCounter=nil end if lastRankId>currRankId then num=lastRankId-currRankId end local function _TimeUpdate() --降低 if lastScore