miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ExpeditionRepl...

79 lines
2.8 KiB
Lua

----- 大闹天宫 回复 和 复活节点弹窗 -----
local this = {}
--传入父脚本模块
local parent
local sortingOrder
local nodeType
local nodeState
local fun
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.content=Util.GetGameObject(gameObject,"content"):GetComponent("Text")
this.iconImage=Util.GetGameObject(gameObject,"iconImage"):GetComponent("Image")
this.goBtn=Util.GetGameObject(gameObject,"GoBtn")
this.goBtnText=Util.GetGameObject(gameObject,"GoBtn/Text"):GetComponent("Text")
end
function this:BindEvent()
Util.AddOnceClick(this.goBtn,function()
if fun then
fun()
fun = nil
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 = {...}
nodeType = _args[1]
nodeState = _args[2]
fun = _args[3]
this.RefreshPanel(nodeType,nodeState)
end
function this:OnClose()
end
function this:OnDestroy()
this.spLoader:Destroy()
end
--刷新面板
function this.RefreshPanel()
this.iconImage.sprite = this.spLoader:LoadSprite(ConfigManager.GetConfigData(ConfigName.ExpeditionNodeConfig,nodeType).Icon)
if nodeType == ExpeditionNodeType.Reply then--回复节点
this.titleText.text=Language[11545]
local num = ConfigManager.GetConfigData(ConfigName.ExpeditionSetting,1).RegeneratePercent/100
if nodeState == ExpeditionNodeState.No then
this.content.text = Language[11546]..num..Language[11547]
this.goBtnText.text = Language[10732]
elseif nodeState == ExpeditionNodeState.NoPass then
this.content.text = Language[11546]..num..Language[11548]
this.goBtnText.text = Language[10019]
end
elseif nodeType == ExpeditionNodeType.Resurgence then--复活节点
this.titleText.text=Language[11549]
if nodeState == ExpeditionNodeState.No then
this.content.text = "炼丹炉中炼制着一颗百转大还丹,可随机复活一名阵亡的神将。如果没有阵亡的神将,则使一名随机神将恢复至满生命值。"
this.goBtnText.text = Language[10732]
elseif nodeState == ExpeditionNodeState.NoPass then
this.content.text = "炼丹炉中炼制着一颗百转大还丹,可随机复活一名阵亡的神将。如果没有阵亡的神将,则使一名随机神将恢复至满生命值。"
this.goBtnText.text = Language[10019]
end
end
end
return this