miduo_client/Assets/ManagedResources/~Lua/Modules/Message/MissionDailyTipPanel.lua

105 lines
3.6 KiB
Lua

require("Base/BasePanel")
require("Base/Stack")
MissionDailyTipPanel = Inherit(BasePanel)
local this = MissionDailyTipPanel
--item容器
local itemList = {}
local showType = 0
this.timer = Timer.New()
--初始化组件(用于子类重写)
function MissionDailyTipPanel:InitComponent()
this.info = Util.GetGameObject(self.transform, "info")
this.titleTypeText = Util.GetGameObject(self.transform, "info/titleTypeText"):GetComponent("Text")
this.titleText = Util.GetGameObject(self.transform, "info/titleText"):GetComponent("Text")
this.icon = Util.GetGameObject(self.transform, "info/Image/icon"):GetComponent("Image")
this.content = Util.GetGameObject(self.transform, "info/content")
this.qianwangButton = Util.GetGameObject(self.transform, "info/qianwangButton")
this.goAni =self.gameObject--:GetComponent("PlayFlyAnim")
this.info = Util.GetGameObject(self.transform, "info")
end
--添加事件监听(用于子类重写)
function MissionDailyTipPanel:AddListener()
end
--移除事件监听(用于子类重写)
function MissionDailyTipPanel:RemoveListener()
end
function MissionDailyTipPanel:BindEvent()
Util.AddClick(this.qianwangButton, function()
--SingleRecruitPanel
if UIManager.IsOpen(UIName.BattlePanel) then--请等待战斗结束后查看!
PopupTipPanel.ShowTip("请等待战斗结束后查看!")
return
end
if showType == 1 then
UIManager.OpenPanel(UIName.MissionDailyPanel,1)
else
UIManager.OpenPanel(UIName.MissionDailyPanel,2)
end
self:ClosePanel()
end)
end
local sortingOrder = 0
function MissionDailyTipPanel:OnSortingOrderChange()
sortingOrder = self.sortingOrder
end
--界面打开时调用(用于子类重写)--OnOpen
function MissionDailyTipPanel.ShowInfo(_showType,_showStr)
showType = _showType
UIManager.OpenPanel(UIName.MissionDailyTipPanel)
this.info.transform.localPosition = Vector3.New(0,1225,0)
this.titleText.text = _showStr
local showReward
if showType == 1 then
this.titleTypeText.text = "任务达成"
showReward = 12002
elseif showType == 2 then
this.titleTypeText.text = "成就达成"
showReward = 12004
end
this.icon.sprite = Util.LoadSprite(GetResourcePath(showReward))
--ResetItemView(this.content,this.content.transform,itemList,4,1,sortingOrder,false,showReward)
--PlayUIAnim(this.goAni, function ()
-- if this.timer then
-- this.timer:Stop()
-- this.timer = nil
-- end
-- this.timer = Timer.New(function()
-- PlayUIAnimBack(this.goAni, function ()
-- this:ClosePanel()
-- end)
-- end,3):Start()
--end)
this.info.transform:DOLocalMove(Vector3.New(0,786.3,0), 0.3, false):OnStart(function ()
end):OnComplete(function ()
if this.timer then
this.timer:Stop()
this.timer = nil
end
this.timer = Timer.New(function()
this.info.transform:DOLocalMove(Vector3.New(0,1225,0), 0.3, false):OnStart(function ()
end):OnComplete(function ()
this:ClosePanel()
end):SetEase(Ease.Linear)
end,3):Start()
end):SetEase(Ease.Linear)
end
--界面关闭时调用(用于子类重写)
function MissionDailyTipPanel:OnClose()
this.info.transform.localPosition = Vector3.New(0,1225,0)
if this.timer then
this.timer:Stop()
this.timer = nil
end
end
--界面销毁时调用(用于子类重写)
function MissionDailyTipPanel:OnDestroy()
end
return MissionDailyTipPanel