diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoEventPanel.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoEventPanel.lua index e00b5d2ea8..bb3b842df4 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoEventPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoEventPanel.lua @@ -9,10 +9,14 @@ function this:InitComponent() this.btnBack = Util.GetGameObject(self.transform, "closeBtn") this.title=Util.GetGameObject(self.transform, "bg/title"):GetComponent("Image") this.grid=Util.GetGameObject(self.transform, "bg/grid") - this.xianyuan=Util.GetGameObject(self.transform, "bg/xianyuan") - this.eventName=Util.GetGameObject(self.transform, "bg/xianyuan/name"):GetComponent("Text") - this.eventIcon=Util.GetGameObject(self.transform, "bg/xianyuan/icon"):GetComponent("Image") - + this.grid2=Util.GetGameObject(self.transform, "bg/grid2") + -- this.eventName=Util.GetGameObject(self.transform, "bg/xianyuan/name"):GetComponent("Text") + --this.eventIcon=Util.GetGameObject(self.transform, "bg/xianyuan/icon"):GetComponent("Image") + this.preList={} + for i = 1, 3 do + local item=Util.GetGameObject(self.transform, "bg/grid2/xianyuan"..i) + table.insert(this.preList,item) + end this.rewardItemViewList = {} end @@ -28,18 +32,37 @@ function this:BindEvent() end --界面打开时调用(用于子类重写) -function this:OnOpen(_type,_data) +function this:OnOpen(_type,_data,curindex,list,num) triggertype=_type if _type>0 then this.title.sprite=this.spLoader:LoadSprite("x_xiaoyaoyou_chufaxianyuan_zh") this.grid:SetActive(false) - this.xianyuan:SetActive(true) - this.eventName.text=string.format("★%s★",GetLanguageStrById(_data.Desc)) - this.eventIcon.sprite=this.spLoader:LoadSprite(_data.EventPointBg) + for i = 1, #this.preList do + this.preList[i]:SetActive(false) + end + local index=0 + for i = curindex-num+1, curindex do + -- LogError("list[i].eventData.Style=="..list[i].eventData.Style) + if list[i].eventData and (list[i].eventData.Style==24 or list[i].eventData.Style==25 or list[i].eventData.Style==26) then + index=index+1 + if this.preList[index] then + this.preList[index]:SetActive(true) + Util.GetGameObject(this.preList[index], "name"):GetComponent("Text").text=string.format("★%s★",GetLanguageStrById(list[i].eventData.Desc)) + --LogError("_data.Desc==".._data.Desc.." _data.EventPointBg==".._data.EventPointBg) + Util.GetGameObject(this.preList[index], "icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(list[i].eventData.EventPointBg) + end + end + end + -- if _data~=nil then + -- this.eventName.text=string.format("★%s★",GetLanguageStrById(_data.Desc)) + -- LogError("_data.Desc==".._data.Desc.." _data.EventPointBg==".._data.EventPointBg) + -- this.eventIcon.sprite=this.spLoader:LoadSprite(_data.EventPointBg) + -- end + else + this.grid2:SetActive(false) this.title.sprite=this.spLoader:LoadSprite("x_xiaoyaoyou_youlichenggong_zh") this.grid:SetActive(true) - this.xianyuan:SetActive(false) local showItemdata=this.GetDropReward(_data) local starItemDataList=BagManager.GetItemListFromTempBag(_data) for i = 1, #starItemDataList do diff --git a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua index 46032be522..c5c1141ff6 100644 --- a/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/XiaoYao/XiaoYaoMapPanel.lua @@ -321,20 +321,23 @@ function this.EventTrigger(_data) targetBtn=this.shopBtn PlayerPrefs.SetInt(string.format("%s#%s#%s",PlayerManager.uid,tostring(XiaoYaoManager.curMapId),tostring(1)),1) XiaoYaoManager.CheckRedPoint2() - this.SetEventBtn(_data) elseif _data.pathType==5 then --怪物节点 targetBtn=this.bossBtn PlayerPrefs.SetInt(string.format("%s#%s#%s",PlayerManager.uid,tostring(XiaoYaoManager.curMapId),tostring(3)),1) - XiaoYaoManager.CheckRedPoint2() - this.SetEventBtn(_data) + XiaoYaoManager.CheckRedPoint2() elseif _data.pathType==6 then --转盘 targetBtn=this.rouleBtn PlayerPrefs.SetInt(string.format("%s#%s#%s",PlayerManager.uid,tostring(XiaoYaoManager.curMapId),tostring(2)),1) XiaoYaoManager.CheckRedPoint2() - this.SetEventBtn(_data) elseif _data.pathType==7 then --终极大奖 + -- UIManager.OpenPanel(UIName.XiaoYaoEventPanel,0,_data.drop) + end + if _data.pathType==7 then UIManager.OpenPanel(UIName.XiaoYaoEventPanel,0,_data.drop) - end + else + this.SetEventBtn(_data) + end + -- 除普通节点都播放提示音 if _data.pathType ~= 0 then SoundManager.PlaySound(SoundConfig.Sound_UI_TiShi) @@ -354,13 +357,39 @@ function this.EventTrigger(_data) end function this.SetEventBtn(_data) - this.RefreshEventBtn() + --this.RefreshEventBtn() if isAutoRun then this.PlayEffect() PopupTipPanel.ShowTip(string.format(Language[12011],GetLanguageStrById(allGridData[curGridIndex].eventData.Desc))) else - UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData) - end + --LogError("curGridIndex=="..curGridIndex.." #_data.pointes=="..#_data.pointes) + local pointNum=0 + for i = 1, #_data.pointes do + pointNum=pointNum+_data.pointes[i] + end + --LogError("pointnum=="..pointNum) + local isShow=false + for i = curGridIndex - pointNum+1, curGridIndex do + --(allGridData[i].eventData.Style==24 or allGridData[i].eventData.Style==25 or allGridData[i].eventData.Style==26) + if allGridData[i].eventData and (allGridData[i].eventData.Style==24 or allGridData[i].eventData.Style==25 or allGridData[i].eventData.Style==26) then + --LogError("allGridData[curGridIndex]=="..allGridData[curGridIndex].eventData.Id) + isShow=true + if allGridData[i].eventData.Style==24 then + targetBtn=this.rouleBtn + elseif allGridData[i].eventData.Style==25 then + targetBtn=this.bossBtn + elseif allGridData[i].eventData.Style==26 then + targetBtn=this.shopBtn + end + end + end + if isShow then + UIManager.OpenPanel(UIName.XiaoYaoEventPanel,_data.pathType,allGridData[curGridIndex].eventData,curGridIndex,allGridData,pointNum) + return + end + + end + end function this.PlayEffect() this.moneyEffect.transform.position =this.TT.transform.position @@ -373,6 +402,7 @@ function this.PlayEffect() this.moneyEffect:SetActive(false) end end) + this.RefreshEventBtn() SoundManager.PlaySound(SoundConfig.Sound_FightArea_Gold) end --界面打开时调用(用于子类重写)