miduo_client/Assets/ManagedResources/~Lua/Modules/Mission/ProgressPanel.lua

74 lines
2.4 KiB
Lua
Raw Normal View History

2025-03-14 11:58:20 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
ProgressPanel = Inherit(BasePanel)
2024-09-06 10:38:56 +08:00
local this = ProgressPanel
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function ProgressPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
this.nameText = Util.GetGameObject(self.transform, "title/nameText")
this.nameInfoText = Util.GetGameObject(self.transform, "title/nameInfoText")
this.expText = Util.GetGameObject(self.transform, "middle/exp/expText")
this.expSlider = Util.GetGameObject(self.transform, "middle/exp")
this.infoText = Util.GetGameObject(self.transform, "middle/infoText")
this.heroGrid = Util.GetGameObject(self.transform, "heroRect/heroGrid")
this.closeBtn = Util.GetGameObject(self.transform, "bg")
this.mask = Util.GetGameObject(self.transform, "mask")
2020-05-09 13:31:21 +08:00
this.mask:SetActive(false)
end
--绑定事件(用于子类重写)
function ProgressPanel:BindEvent()
2024-09-06 10:38:56 +08:00
Util.AddClick(this.closeBtn, function()
2020-05-09 13:31:21 +08:00
self:ClosePanel()
2024-09-06 10:38:56 +08:00
UIManager.OpenPanel(UIName.MapAwardPanel, 2)
2020-05-09 13:31:21 +08:00
end)
end
--添加事件监听(用于子类重写)
function ProgressPanel:AddListener()
end
--移除事件监听(用于子类重写)
function ProgressPanel:RemoveListener()
end
--界面打开时调用(用于子类重写)
function ProgressPanel:OnOpen(...)
Util.ClearChild(this.heroGrid.transform)
2024-09-06 10:38:56 +08:00
local data = { ... }
2020-05-09 13:31:21 +08:00
local showInfo = data[1]
local second = data[3]
2024-09-06 10:38:56 +08:00
this.nameText:GetComponent("Text").text = MapManager.GetCurAreaName()
2020-05-09 13:31:21 +08:00
this.nameInfoText:SetActive(false)
2024-09-06 10:38:56 +08:00
this.nameInfoText:GetComponent("Text").text = ""
2020-05-09 13:31:21 +08:00
this.mask:SetActive(true)
2024-09-06 10:38:56 +08:00
DoTween.To(DG.Tweening.Core.DOGetter_float(function() return 0 end),
DG.Tweening.Core.DOSetter_float(function(t)
this.expSlider:GetComponent("Slider").value = t
this.expText:GetComponent("Text").text = math.floor(t * 100) .. "%"
end), 1, second):SetEase(Ease.Linear):OnComplete(function()
2020-05-09 13:31:21 +08:00
this.mask:SetActive(false)
self:ClosePanel()
if data[2] then
data[2]()
end
--UIManager.OpenPanel(UIName.MapAwardPanel,data)
2024-09-06 10:38:56 +08:00
end)
this.infoText:GetComponent("Text").text = showInfo[1]
2020-05-09 13:31:21 +08:00
end
--界面关闭时调用(用于子类重写)
function ProgressPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function ProgressPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
end
2024-09-06 10:38:56 +08:00
return ProgressPanel