----- 献祭弹窗 ----- local this = {} --传入父脚本模块 local parent --传入特效层级 local sortingOrder=0 local _args={} local fun local coin=0 local id=0 --item容器 local itemList = {} --传入选择英雄 local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) function this:InitComponent(gameObject) this.spLoader = SpriteLoader.New() this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") this.infoTxt=Util.GetGameObject(gameObject,"Body/Text"):GetComponent("Text") --this.num=Util.GetGameObject(gameObject,"Body/Num"):GetComponent("Text") this.numImage=Util.GetGameObject(gameObject,"Body/Image"):GetComponent("Image") this.numImage.gameObject:SetActive(false) this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn") this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn") this.confirmBtnText=Util.GetGameObject(gameObject,"ConfirmBtn/Text"):GetComponent("Text") --滚动条根节点 this.root = Util.GetGameObject(gameObject, "Root") end function this:BindEvent() Util.AddClick(this.cancelBtn,function() parent:ClosePanel() end) Util.AddClick(this.confirmBtn,function() if coin>BagManager.GetItemCountById(id) then PopupTipPanel.ShowTip(Language[10497]) return end LogError("请求涅槃") if fun then fun() end parent:ClosePanel() 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 = {...} --this.num.text = args[1] local lingshouConfig=args[1] --消耗妖晶的数量 if lingshouConfig.ReturnCost then id=lingshouConfig.ReturnCost[1] coin=lingshouConfig.ReturnCost[2] end local type=args[3]---1灵兽涅槃 2神兵回炉 if type==1 then this.titleText.text=Language[11569] this.confirmBtnText.text=Language[11570] else this.titleText.text="神兵回炉" this.confirmBtnText.text="回炉" end this.numImage.sprite = SetIcon(this.spLoader, id) fun = args[4] --判断妖晶是否充足 if coin>BagManager.GetItemCountById(id) then if type==1 then this.infoTxt.text=string.format(Language[12213],coin,GetLanguageStrById(itemConfig[id].Name),GetLanguageStrById(lingshouConfig.Name),"%") else local str="确认花费%s%s将%s回炉为初始状态,并100%s返还养成消耗" this.infoTxt.text=string.format(str,coin,GetLanguageStrById(itemConfig[id].Name),GetLanguageStrById(lingshouConfig.Name),"%") end else if type==1 then this.infoTxt.text=string.format(Language[12214],coin,GetLanguageStrById(itemConfig[id].Name),GetLanguageStrById(lingshouConfig.Name),"%") else local str="确认花费%s%s将%s回炉为初始状态,并100%s返还养成消耗" this.infoTxt.text=string.format(str,coin,GetLanguageStrById(itemConfig[id].Name),GetLanguageStrById(lingshouConfig.Name),"%") end end ResetItemView(this.root,this.root.transform,itemList,10,1,sortingOrder,false,args[2]) end function this:OnClose() end function this:OnDestroy() this.spLoader:Destroy() end return this