----- 灵兽战力加成 ----- local this = {} --传入父脚本模块 local sortingOrder local parent local allProPre = {} local allProData = {} function this:InitComponent(gameObject) this.spLoader = SpriteLoader.New() Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text").text = Language[11577] Util.GetGameObject(gameObject,"Body/Text"):GetComponent("Text").text = Language[11578] for i = 1, 4 do allProPre[i] = Util.GetGameObject(gameObject,"Root/singlePro ("..i..")") end end function this:BindEvent() end function this:AddListener() end function this:RemoveListener() end function this:OnShow(_parent,...) parent=_parent sortingOrder = _parent.sortingOrder --不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参 -- local _args = {...} -- allProData=_args[1] this.RefreshPanel() end function this:OnClose() end function this:OnDestroy() this.spLoader:Destroy() end --刷新面板 function this.RefreshPanel() allProData = PokemonManager.GetPokemonFormationAddPro() local index = 0 for key, value in pairs(allProData) do index = index + 1 local go= allProPre[index] if go then Util.GetGameObject(go, "Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(PropertyTypeIconDef[index]) Util.GetGameObject(go,"proName"):GetComponent("Text").text=GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig,key).Info) Util.GetGameObject(go,"proValue"):GetComponent("Text").text= value end end -- for i = 1, #allProPre do -- local go= allProPre[i] -- if PropertyTypeIconDef[i] then -- Util.GetGameObject(go, "Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(PropertyTypeIconDef[i]) -- end -- Util.GetGameObject(go,"proName"):GetComponent("Text").text=ConfigManager.GetConfigData(ConfigName.PropertyConfig,i).Info -- Util.GetGameObject(go,"proValue"):GetComponent("Text").text= allProData[i] -- end end return this