129 lines
5.1 KiB
Lua
129 lines
5.1 KiB
Lua
require("Base/BasePanel")
|
|
require("Base/Stack")
|
|
MissionDailyTipPanel = Inherit(BasePanel)
|
|
local this = MissionDailyTipPanel
|
|
local showType = 0
|
|
this.timer = Timer.New()
|
|
--初始化组件(用于子类重写)
|
|
function MissionDailyTipPanel:InitComponent()
|
|
this.spLoader = SpriteLoader.New()
|
|
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/Image")
|
|
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--请等待战斗结束后查看!
|
|
PopupTipPanel.ShowTip(Language[11305])
|
|
return
|
|
end
|
|
if GameObject.Find("LingLongBaoJingPanel") and GameObject.Find("LingLongBaoJingPanel").activeSelf then--掉落界面打开时,关闭掉落界面
|
|
return
|
|
end
|
|
if UIManager.IsOpen(UIName.RewardItemPopup) then--掉落界面打开时,关闭掉落界面
|
|
UIManager.ClosePanel(UIName.RewardItemPopup, false)
|
|
end
|
|
--LogGreen("showType:"..showType)
|
|
UIManager.OpenPanel(UIName.MissionDailyPanel,showType == 1 and 1 or 4)
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
local sortingOrder = 0
|
|
function MissionDailyTipPanel:OnSortingOrderChange()
|
|
sortingOrder = self.sortingOrder
|
|
end
|
|
--界面打开时调用(用于子类重写)--OnOpen
|
|
function MissionDailyTipPanel.ShowInfo(_showType,_showStr)
|
|
UIManager.OpenPanel(UIName.MissionDailyTipPanel)
|
|
this:PlayerAniAndShowData(_showType,_showStr)
|
|
end
|
|
function MissionDailyTipPanel:PlayerAniAndShowData(_showType,showStr)
|
|
showType = _showType
|
|
this.info.transform.localPosition = Vector3.New(0,1225,0)
|
|
this.titleText.text = showStr
|
|
local showReward
|
|
if showType == 1 then
|
|
this.titleTypeText.text = Language[11306]
|
|
showReward = 12002
|
|
elseif showType == 2 then
|
|
this.titleTypeText.text = Language[11307]
|
|
showReward = 12004
|
|
end
|
|
this.icon.sprite = this.spLoader: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 ()
|
|
this:RefreshShowDailyMissionTipPanel()
|
|
end):SetEase(Ease.Linear)
|
|
end,3)
|
|
this.timer:Start()
|
|
end):SetEase(Ease.Linear)
|
|
end
|
|
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)
|
|
this:PlayerAniAndShowData(1,string.format(GetLanguageStrById(curConfig.Desc),curConfig.Values[2][1]))
|
|
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)
|
|
this:PlayerAniAndShowData(2,GetLanguageStrById(curConfig.ContentsShow))
|
|
else
|
|
this:ClosePanel()
|
|
end
|
|
end
|
|
--LogGreen("remove "..data.type.." "..data.Id.." "..data.state)
|
|
TaskManager.DelAllShowTipMissionOne()
|
|
else
|
|
this:ClosePanel()
|
|
end
|
|
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()
|
|
this.spLoader:Destroy()
|
|
if this.timer then
|
|
this.timer:Stop()
|
|
this.timer = nil
|
|
end
|
|
end
|
|
|
|
return MissionDailyTipPanel |