169 lines
6.0 KiB
Lua
169 lines
6.0 KiB
Lua
require("Base/BasePanel")
|
|
XuanYuanMirrorPanel = Inherit(BasePanel)
|
|
local this = XuanYuanMirrorPanel
|
|
local hasFresh = false
|
|
local orginLayer = 0
|
|
--初始化组件(用于子类重写)
|
|
function this:InitComponent()
|
|
--this.btnBack:SetActive(false)
|
|
this.btnYaoling = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/yaolingbaojing") -- 妖灵
|
|
this.btnRenjie = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/renjiebaojing") -- 人杰
|
|
this.btnFochan = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/fuochanbaojing") -- 佛禅
|
|
this.btnDaoxuan = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/daoxuanbaojing") -- 道玄
|
|
|
|
this.btnHelp = Util.GetGameObject(self.gameObject, "btnRoot/btnhelp")
|
|
this.helpPosition = this.btnHelp:GetComponent("RectTransform").localPosition
|
|
this.btnRank = Util.GetGameObject(self.gameObject, "btnRoot/btnRank")
|
|
this.btnReward = Util.GetGameObject(self.gameObject, "btnRoot/btnReward")
|
|
this.btnClose = Util.GetGameObject(self.gameObject, "btnRoot/btnBack")
|
|
|
|
this.remainTimes = Util.GetGameObject(self.gameObject, "remainTimes") :GetComponent("Text")
|
|
|
|
this.effect = Util.GetGameObject(self.gameObject, "CarbonTypePanel_effect")
|
|
this.wind = Util.GetGameObject(self.gameObject, "CarbonTypePanel_effect/juneng_chenggong/GameObject")
|
|
|
|
orginLayer = 0
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
this.AnimRoot = Util.GetGameObject(self.gameObject, "btnRoot/circle/root")
|
|
|
|
BindRedPointObject(RedPointType.Magic_Mirror, Util.GetGameObject(this.btnYaoling, "redPoint"))
|
|
BindRedPointObject(RedPointType.People_Mirror, Util.GetGameObject(this.btnRenjie, "redPoint"))
|
|
BindRedPointObject(RedPointType.Buddhist_Mirror, Util.GetGameObject(this.btnFochan, "redPoint"))
|
|
BindRedPointObject(RedPointType.Taoist_Mirror, Util.GetGameObject(this.btnDaoxuan, "redPoint"))
|
|
end
|
|
|
|
local index = 1
|
|
--绑定事件(用于子类重写)
|
|
function this:BindEvent()
|
|
Util.AddClick(this.btnYaoling, function()
|
|
this:BtnAction(FUNCTION_OPEN_TYPE.MAGIC_MIRROR)
|
|
end)
|
|
|
|
Util.AddClick(this.btnRenjie, function()
|
|
this:BtnAction(FUNCTION_OPEN_TYPE.PEOPLE_MIRROR)
|
|
end)
|
|
|
|
Util.AddClick(this.btnFochan, function()
|
|
this:BtnAction(FUNCTION_OPEN_TYPE.BUDDHIST_MIRROR)
|
|
end)
|
|
|
|
Util.AddClick(this.btnDaoxuan, function()
|
|
this:BtnAction(FUNCTION_OPEN_TYPE.TAOIST_MIRROR)
|
|
end)
|
|
Util.AddClick(this.btnHelp, function()
|
|
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.XuanYuanMirror,this.helpPosition.x,this.helpPosition.y)
|
|
end)
|
|
Util.AddClick(this.btnRank, function()
|
|
|
|
end)
|
|
Util.AddClick(this.btnReward, function()
|
|
|
|
end)
|
|
Util.AddClick(this.btnClose, function()
|
|
this:OnClose()
|
|
end)
|
|
end
|
|
function this:BtnAction(_type)
|
|
if ActTimeCtrlManager.SingleFuncState(_type) then
|
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,_type,XuanYuanMirrorManager.GetMirrorData(_type))
|
|
else
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(_type))
|
|
end
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function this:AddListener()
|
|
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.FreshIconShow)
|
|
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.FreshIconShow)
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function this:RemoveListener()
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.FreshIconShow)
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.FreshIconShow)
|
|
end
|
|
|
|
function this:OnOpen()
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Main })
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function this:OnShow(...)
|
|
Util.SetGray(this.btnYaoling, not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.MAGIC_MIRROR))
|
|
Util.SetGray(this.btnRenjie, not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.PEOPLE_MIRROR))
|
|
Util.SetGray(this.btnFochan, not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.BUDDHIST_MIRROR))
|
|
Util.SetGray(this.btnDaoxuan, not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TAOIST_MIRROR))
|
|
|
|
this.remainTimes = Language[12249]..5
|
|
-- 音效
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
|
|
-- 播放动画
|
|
|
|
this:PlayAni()
|
|
this.PlayScaleAnim()
|
|
end
|
|
|
|
function this:OnSortingOrderChange()
|
|
Util.AddParticleSortLayer(this.effect, self.sortingOrder - orginLayer)
|
|
Util.AddParticleSortLayer(this.wind, self.sortingOrder - orginLayer)
|
|
|
|
orginLayer = self.sortingOrder
|
|
end
|
|
|
|
|
|
function this:PlayAni()
|
|
-- 启动定时器
|
|
this.StartCountTime()
|
|
-- 开门音效
|
|
if not this.isPlayDoorAudio then
|
|
this.isPlayDoorAudio = true
|
|
Timer.New(function ()
|
|
if this.isPlayDoorAudio then
|
|
SoundManager.PlaySound(SoundConfig.Sound_Door)
|
|
end
|
|
end, 1.3):Start()
|
|
end
|
|
end
|
|
|
|
function this.PlayScaleAnim()
|
|
local isOpen = FunctionOpenMananger.GetRootState(PanelTypeView.Carbon)
|
|
if isOpen then
|
|
PlayUIAnim(this.AnimRoot)
|
|
else
|
|
PlayUIAnimBack(this.AnimRoot)
|
|
end
|
|
end
|
|
|
|
function this.StartCountTime()
|
|
|
|
end
|
|
|
|
function this.FreshIconShow(id)
|
|
if not hasFresh then
|
|
hasFresh = true
|
|
|
|
this.refreshTimer = nil
|
|
this.refreshTimer = Timer.New(function ()
|
|
Util.SetGray(this.btnDaoxuan, not ActTimeCtrlManager.SingleFuncState(46))
|
|
this.StartCountTime()
|
|
end, 1)
|
|
this.refreshTimer:Start()
|
|
end
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function this:OnClose()
|
|
this.isPlayDoorAudio = false
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function this:OnDestroy()
|
|
ClearRedPointObject(RedPointType.Magic_Mirror)
|
|
ClearRedPointObject(RedPointType.People_Mirror)
|
|
ClearRedPointObject(RedPointType.Buddhist_Mirror)
|
|
ClearRedPointObject(RedPointType.Taoist_Mirror)
|
|
SubUIManager.Close(this.UpView)
|
|
end
|
|
|
|
return XuanYuanMirrorPanel |