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

121 lines
4.7 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
require("Base/BasePanel")
2020-06-03 19:09:01 +08:00
require("Base/Stack")
MissionDailyTipPanel = Inherit(BasePanel)
local this = MissionDailyTipPanel
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")
2020-06-28 17:52:29 +08:00
this.qianwangButton = Util.GetGameObject(self.transform, "info/qianwangButton/Image")
2020-06-03 19:09:01 +08:00
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()
if UIManager.IsOpen(UIName.BattlePanel) then--请等待战斗结束后查看!
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11305])
2020-06-03 19:09:01 +08:00
return
end
2020-08-26 15:57:06 +08:00
LogGreen("showType:"..showType)
UIManager.OpenPanel(UIName.MissionDailyPanel,showType == 1 and 1 or 4)
2020-06-03 19:09:01 +08:00
self:ClosePanel()
end)
end
local sortingOrder = 0
function MissionDailyTipPanel:OnSortingOrderChange()
sortingOrder = self.sortingOrder
end
--界面打开时调用(用于子类重写)--OnOpen
function MissionDailyTipPanel.ShowInfo(_showType,_showStr)
UIManager.OpenPanel(UIName.MissionDailyTipPanel)
2020-06-13 11:47:13 +08:00
this:PlayerAniAndShowData(_showType,_showStr)
end
function MissionDailyTipPanel:PlayerAniAndShowData(_showType,showStr)
showType = _showType
2020-06-03 19:09:01 +08:00
this.info.transform.localPosition = Vector3.New(0,1225,0)
2020-06-13 11:47:13 +08:00
this.titleText.text = showStr
2020-06-03 19:09:01 +08:00
local showReward
if showType == 1 then
2021-04-09 12:26:35 +08:00
this.titleTypeText.text = Language[11306]
2020-06-03 19:09:01 +08:00
showReward = 12002
elseif showType == 2 then
2021-04-09 12:26:35 +08:00
this.titleTypeText.text = Language[11307]
2020-06-03 19:09:01 +08:00
showReward = 12004
end
this.icon.sprite = Util.LoadSprite(GetResourcePath(showReward))
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 ()
2020-06-13 11:47:13 +08:00
this:RefreshShowDailyMissionTipPanel()
2020-06-03 19:09:01 +08:00
end):SetEase(Ease.Linear)
2020-06-13 11:47:13 +08:00
end,3)
this.timer:Start()
2020-06-03 19:09:01 +08:00
end):SetEase(Ease.Linear)
end
2020-06-13 11:47:13 +08:00
function MissionDailyTipPanel:RefreshShowDailyMissionTipPanel()
local AllShowTipMission = TaskManager.GetAllShowTipMission()
--LogGreen("#AllShowTipMission "..#AllShowTipMission)
if #AllShowTipMission > 0 then
local data = AllShowTipMission[1]
if data.type == TaskTypeDef.DayTask then
local curConfig = ConfigManager.TryGetConfigData(ConfigName.DailyTasksConfig,data.Id)
if curConfig then
--LogGreen("日常 Close "..data.type.." "..data.Id.." "..data.state)
2021-01-26 17:08:39 +08:00
this:PlayerAniAndShowData(1,string.format(GetLanguageStrById(curConfig.Desc),curConfig.Values[2][1]))
2020-06-13 11:47:13 +08:00
else
this:ClosePanel()
end
elseif data.type == TaskTypeDef.Achievement then
local curConfig = ConfigManager.TryGetConfigData(ConfigName.AchievementConfig,data.Id)
if curConfig then
--LogGreen("成就 Close "..data.type.." "..data.Id.." "..data.state)
2021-01-26 17:08:39 +08:00
this:PlayerAniAndShowData(2,GetLanguageStrById(curConfig.ContentsShow))
2020-06-13 11:47:13 +08:00
else
this:ClosePanel()
end
end
--LogGreen("remove "..data.type.." "..data.Id.." "..data.state)
TaskManager.DelAllShowTipMissionOne()
else
this:ClosePanel()
end
end
2020-06-03 19:09:01 +08:00
--界面关闭时调用(用于子类重写)
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()
2020-06-28 17:52:29 +08:00
if this.timer then
this.timer:Stop()
this.timer = nil
end
2020-06-03 19:09:01 +08:00
end
2020-06-23 18:36:24 +08:00
return MissionDailyTipPanel