----- 远征试炼节点弹窗 ----- local this = {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 local fun --item容器 local itemList = {} this.Demons = nil local monsterData = {} local rewardData = {} local type = 1 --1 前往 2 放弃 function this:InitComponent(gameObject) this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") this.power = Util.GetGameObject(gameObject, "power"):GetComponent("Text") this.sureBtn=Util.GetGameObject(gameObject,"sureBtn") this.sureBtnText=Util.GetGameObject(gameObject,"sureBtn/Text"):GetComponent("Text") this.Demons = Util.GetGameObject(gameObject, "demons/item"..1) this.backBtn=Util.GetGameObject(gameObject,"BackBtn") end function this:BindEvent() Util.AddClick(this.sureBtn, function() this:BtnClickEvent() end) Util.AddClick(this.backBtn, function() parent:ClosePanel() end) end function this:BtnClickEvent() if type == 1 then parent:ClosePanel() elseif type == 2 then parent:ClosePanel() UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.EXPEDITION, monsterData) end end function this:AddListener() end function this:RemoveListener() end function this:OnShow(_parent,...) parent=_parent sortingOrder = _parent.sortingOrder --不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参 local args = {...} monsterData = args[1] type = args[2] fun = args[3] --LogError("monsterData "..monsterData.type.." "..monsterData.sortId) this:FormationAdapter() end -- 编队数据匹配 function this:FormationAdapter() if type == 1 then this.sureBtnText.text = "确 定" elseif type == 2 then this.sureBtnText.text = "前 往" end this.titleText.text="瑶池魔妖" if monsterData == nil then LogError("远征数据为nil") return end --LogError("monsterData.bossTeaminfo.teamInfo "..monsterData.bossTeaminfo.teamInfo) this.power.text = monsterData.bossTeaminfo.totalForce local monsterCongig = {} if monsterData.bossTeaminfo.teamInfo and monsterData.bossTeaminfo.teamInfo > 0 then local monsterGroup = ConfigManager.TryGetConfigData(ConfigName.MonsterGroup,monsterData.bossTeaminfo.teamInfo) if monsterGroup and monsterGroup.Contents and #monsterGroup.Contents > 0 then if monsterGroup.Contents[1] and monsterGroup.Contents[1][1] then monsterCongig = ConfigManager.TryGetConfigData(ConfigName.MonsterConfig,monsterGroup.Contents[1][1]) end end if not monsterCongig then return end local demon = this.Demons local demonId = monsterCongig.MonsterId local starGrid=Util.GetGameObject(demon, "starGrid") local proImage=Util.GetGameObject(demon, "heroShow/proIcon"):GetComponent("Image") local posImage=Util.GetGameObject(demon, "heroShow/posIcon"):GetComponent("Image") local heroStage = Util.GetGameObject(demon, "heroShow/heroStage"):GetComponent("Image") local roleLevel=Util.GetGameObject(demon, "lvbg/levelText"):GetComponent("Text") local frameBtn=Util.GetGameObject(demon, "frame") local hpSlider = Util.GetGameObject(demon, "Slider") --hpSlider:SetActive(false) if demonId then demon:SetActive(true) local demonData = ConfigManager.GetConfigData(ConfigName.HeroConfig, demonId) Util.GetGameObject(demon, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(demonData.Icon)) Util.GetGameObject(demon, "frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(ConfigManager.GetConfigData(ConfigName.HeroConfig,demonId).Star)) SetHeroStars(starGrid, monsterCongig.Quality) proImage.sprite = Util.LoadSprite(GetProStrImageByProNum(demonData.PropertyName)) posImage.sprite = Util.LoadSprite(GetJobSpriteStrByJobNum(demonData.Profession)) heroStage.sprite = Util.LoadSprite(HeroStageSprite[demonData.HeroStage]) roleLevel.text=monsterCongig.Level hpSlider:GetComponent("Slider").value = 1 --if monsterData.bossTeaminfo.hero[i].remainHp <= 0 then -- Util.SetGray(demon,true) --else -- Util.SetGray(demon,false) --end end end end function this:OnClose() if fun then fun() fun = nil end end function this:OnDestroy() end return this