2021-04-21 13:12:04 +08:00
|
|
|
|
----- 试练增益弹窗 -----
|
2020-06-08 20:18:49 +08:00
|
|
|
|
local this = {}
|
|
|
|
|
--传入父脚本模块
|
|
|
|
|
local parent
|
|
|
|
|
--传入特效层级
|
|
|
|
|
local sortingOrder=0
|
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
local propertyConfig=ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
2020-06-08 20:18:49 +08:00
|
|
|
|
|
|
|
|
|
--增益弹窗类型
|
|
|
|
|
local gainType={
|
|
|
|
|
Normal=0, --普通查看
|
|
|
|
|
Specil=1 --重置时查看
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
--预设容器
|
|
|
|
|
local preList={}
|
|
|
|
|
|
|
|
|
|
function this:InitComponent(gameObject)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-06-08 20:18:49 +08:00
|
|
|
|
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
|
|
|
|
this.upTip=Util.GetGameObject(gameObject,"UpTip"):GetComponent("Text")
|
|
|
|
|
this.bottomTip=Util.GetGameObject(gameObject,"BottomTip"):GetComponent("Text")
|
2020-08-28 00:24:06 +08:00
|
|
|
|
this.root=Util.GetGameObject(gameObject,"ScrollView/Viewport/Content")
|
2020-06-08 20:18:49 +08:00
|
|
|
|
this.pre=Util.GetGameObject(this.root,"Pre")
|
|
|
|
|
this.goBtn=Util.GetGameObject(gameObject,"GoBtn")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
--取消按钮
|
|
|
|
|
Util.AddClick(this.cancelBtn,function()
|
|
|
|
|
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.RefreshPanel(_args[1])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnClose()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-06-08 20:18:49 +08:00
|
|
|
|
preList={}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--刷新面板
|
|
|
|
|
function this.RefreshPanel(type)
|
2021-03-02 16:53:12 +08:00
|
|
|
|
this.titleText.text=Language[11620]
|
2020-06-08 20:18:49 +08:00
|
|
|
|
|
|
|
|
|
this.upTip.gameObject:SetActive(type==gainType.Specil)
|
|
|
|
|
this.bottomTip.gameObject:SetActive(type==gainType.Normal)
|
|
|
|
|
this.goBtn.gameObject:SetActive(type==gainType.Specil)
|
|
|
|
|
|
2020-06-13 11:47:13 +08:00
|
|
|
|
local props = FoodBuffManager.GetBuffPropList()
|
|
|
|
|
if not props then return end
|
|
|
|
|
|
|
|
|
|
for i, v in ipairs(props) do
|
2020-06-08 20:18:49 +08:00
|
|
|
|
local o=preList[i]
|
|
|
|
|
if not o then
|
|
|
|
|
o=newObjToParent(this.pre,this.root)
|
|
|
|
|
o.name="Pre"..i
|
|
|
|
|
preList[i]=o
|
|
|
|
|
end
|
|
|
|
|
local icon=Util.GetGameObject(o,"Icon"):GetComponent("Image")
|
|
|
|
|
local tip=Util.GetGameObject(o,"Tip"):GetComponent("Text")
|
|
|
|
|
|
2020-06-13 11:47:13 +08:00
|
|
|
|
local val = v.value
|
|
|
|
|
local express1 = val >= 0 and "+" or ""
|
|
|
|
|
local express2 = ""
|
|
|
|
|
if propertyConfig[v.id].Style == 2 then
|
2020-07-20 10:02:12 +08:00
|
|
|
|
val = val / 100
|
2020-06-13 11:47:13 +08:00
|
|
|
|
express2 = "%"
|
|
|
|
|
end
|
2021-02-24 17:37:56 +08:00
|
|
|
|
tip.text=string.format("%s:%s",GetLanguageStrById(propertyConfig[v.id].Info) ,(express1..val..express2))
|
2020-06-13 11:47:13 +08:00
|
|
|
|
|
|
|
|
|
if propertyConfig[v.id].BuffShow then
|
|
|
|
|
local lastStr = ""
|
|
|
|
|
if propertyConfig[v.id].IfBuffShow == 1 then
|
|
|
|
|
lastStr = v.value >= 0 and "_Up" or "_Down"
|
|
|
|
|
end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
icon.sprite = this.spLoader:LoadSprite(propertyConfig[v.id].BuffShow .. lastStr)
|
2020-06-13 11:47:13 +08:00
|
|
|
|
else
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("属性id == "..v.id.." 不存在显示图标")
|
2020-06-13 11:47:13 +08:00
|
|
|
|
end
|
2020-06-08 20:18:49 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return this
|