2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-07-16 20:24:28 +08:00
|
|
|
|
XuanYuanMirrorPanel = Inherit(BasePanel)
|
2020-08-05 15:00:56 +08:00
|
|
|
|
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
local this = XuanYuanMirrorPanel
|
2020-07-15 16:27:58 +08:00
|
|
|
|
local hasFresh = false
|
|
|
|
|
local orginLayer = 0
|
2020-08-05 15:00:56 +08:00
|
|
|
|
|
2020-09-28 15:08:35 +08:00
|
|
|
|
local activityType = {
|
2020-08-05 15:00:56 +08:00
|
|
|
|
[1] = {
|
|
|
|
|
bg = "ui_fb_btn_jy",
|
2021-03-02 16:53:12 +08:00
|
|
|
|
name = Language[10331],
|
2020-09-02 15:31:02 +08:00
|
|
|
|
gameObject = "renjiebaojing" ,
|
2020-08-05 15:00:56 +08:00
|
|
|
|
},
|
|
|
|
|
[2] = {
|
|
|
|
|
bg = "ui_fb_btn_gh",
|
2021-03-02 16:53:12 +08:00
|
|
|
|
name = Language[10332],
|
2020-09-02 15:31:02 +08:00
|
|
|
|
gameObject = "fuochanbaojing" ,
|
2020-08-05 15:00:56 +08:00
|
|
|
|
},
|
|
|
|
|
[3] = {
|
|
|
|
|
bg = "ui_fb_btn_sl",
|
2021-03-02 16:53:12 +08:00
|
|
|
|
name = Language[10333],
|
2020-09-02 15:31:02 +08:00
|
|
|
|
gameObject = "yaolingbaojing" ,
|
2020-08-05 15:00:56 +08:00
|
|
|
|
},
|
|
|
|
|
[4] = {
|
|
|
|
|
bg = "ui_fb_btn_jq",
|
2021-03-02 16:53:12 +08:00
|
|
|
|
name = Language[10334],
|
2020-09-02 15:31:02 +08:00
|
|
|
|
gameObject = "daoxuanbaojing" ,
|
2020-08-05 15:00:56 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
2021-03-02 16:53:12 +08:00
|
|
|
|
local NumConvertWeek = {[1]=Language[10001],[2]=Language[10002],[3]=Language[10003],[4]=Language[10004],[5]=Language[10005],[6]=Language[10006],[7]=Language[10335]}
|
2020-07-15 16:27:58 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-07-16 20:24:28 +08:00
|
|
|
|
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")
|
2020-07-15 16:27:58 +08:00
|
|
|
|
|
|
|
|
|
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")
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- NumConvertWeek = {[1]="一",[2]="二",[3]="三",[4]="四",[5]="五",[6]="六",[7]="日"}
|
2020-09-28 15:08:35 +08:00
|
|
|
|
-- activityType = {
|
|
|
|
|
-- [1] = {
|
|
|
|
|
-- bg = "ui_fb_btn_jy",
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- name = "人杰宝境",
|
2020-09-28 15:08:35 +08:00
|
|
|
|
-- gameObject = "renjiebaojing" ,
|
|
|
|
|
-- },
|
|
|
|
|
-- [2] = {
|
|
|
|
|
-- bg = "ui_fb_btn_gh",
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- name = "佛禅宝境",
|
2020-09-28 15:08:35 +08:00
|
|
|
|
-- gameObject = "fuochanbaojing" ,
|
|
|
|
|
-- },
|
|
|
|
|
-- [3] = {
|
|
|
|
|
-- bg = "ui_fb_btn_sl",
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- name = "妖灵宝境",
|
2020-09-28 15:08:35 +08:00
|
|
|
|
-- gameObject = "yaolingbaojing" ,
|
|
|
|
|
-- },
|
|
|
|
|
-- [4] = {
|
|
|
|
|
-- bg = "ui_fb_btn_jq",
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- name = "道玄宝境",
|
2020-09-28 15:08:35 +08:00
|
|
|
|
-- gameObject = "daoxuanbaojing" ,
|
|
|
|
|
-- },
|
|
|
|
|
-- }
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local index = 1
|
|
|
|
|
--绑定事件(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:BindEvent()
|
|
|
|
|
Util.AddClick(this.btnHelp, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.XuanYuanMirror,this.helpPosition.x,this.helpPosition.y)
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
Util.AddClick(this.btnRank, function()
|
2020-08-11 15:11:33 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.XuanYuanMirrorRankPopup)
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
Util.AddClick(this.btnReward, function()
|
2020-08-11 15:11:33 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.XuanYuanMirrorRewardSortPopup)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.btnClose, function()
|
2020-08-26 10:58:41 +08:00
|
|
|
|
this:ClosePanel()
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:AddListener()
|
2020-08-14 20:41:07 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnXuanYuanFunctionChange, this.UpdateCarbonContent,1)
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:RemoveListener()
|
2020-08-14 20:41:07 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnXuanYuanFunctionChange, this.UpdateCarbonContent,1)
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:OnOpen()
|
2020-10-15 21:48:41 +08:00
|
|
|
|
if not this.UpView then
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
|
|
|
end
|
2020-08-12 21:07:13 +08:00
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:OnShow(...)
|
2020-08-14 20:41:07 +08:00
|
|
|
|
this.UpdateCarbonContent(0)
|
2020-07-15 16:27:58 +08:00
|
|
|
|
-- 音效
|
|
|
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
|
|
|
|
|
-- 播放动画
|
|
|
|
|
|
2020-07-16 20:24:28 +08:00
|
|
|
|
this:PlayAni()
|
2020-07-15 16:27:58 +08:00
|
|
|
|
this.PlayScaleAnim()
|
|
|
|
|
end
|
|
|
|
|
|
2020-08-05 15:00:56 +08:00
|
|
|
|
function this:GetOpenTime(id)
|
2020-08-05 21:01:20 +08:00
|
|
|
|
local str = nil
|
2020-08-11 09:48:21 +08:00
|
|
|
|
local isFunction = false
|
2020-08-11 15:11:33 +08:00
|
|
|
|
local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig,70)
|
2020-08-11 09:48:21 +08:00
|
|
|
|
if config then
|
|
|
|
|
for k,v in ipairs(string.split(config.Value,"|")) do
|
|
|
|
|
isFunction = false
|
|
|
|
|
for n,m in ipairs(string.split(v,"#")) do
|
|
|
|
|
if tonumber(n) == 1 and tonumber(m) == id then
|
|
|
|
|
isFunction = true
|
|
|
|
|
else
|
|
|
|
|
if isFunction then
|
|
|
|
|
if str then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
str =str.. Language[10336]..NumConvertWeek[tonumber(m)]
|
2020-08-11 09:48:21 +08:00
|
|
|
|
else
|
2021-03-02 16:53:12 +08:00
|
|
|
|
str = Language[10337]..NumConvertWeek[tonumber(m)]
|
2020-08-11 09:48:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-09-28 15:08:35 +08:00
|
|
|
|
LogBlue(str.." 宝镜开启时间")
|
2020-08-05 21:01:20 +08:00
|
|
|
|
return str
|
2020-08-05 15:00:56 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-04-27 16:00:24 +08:00
|
|
|
|
this.refreshShow = function()
|
|
|
|
|
local openFunctions = {}
|
2021-11-26 10:53:49 +08:00
|
|
|
|
for k,v in pairs(activityType) do
|
|
|
|
|
local go = Util.GetGameObject(this.AnimRoot, v.gameObject)
|
|
|
|
|
if go then
|
|
|
|
|
go:GetComponent("Image").sprite = this.spLoader:LoadSprite(v.bg)
|
|
|
|
|
local textParnet = Util.GetGameObject(go, "titileBg")
|
|
|
|
|
local textName = Util.GetGameObject(textParnet, "Text"):GetComponent("Text")
|
|
|
|
|
textName.text =v.name
|
|
|
|
|
SetTextVerTial(Util.GetGameObject(textParnet, "Text"),Vector3.New(295.93,-10.17,0),"MiddleRight")
|
|
|
|
|
if GetCurLanguage() == 2 then
|
|
|
|
|
textName.fontSize = 36
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local state = XuanYuanMirrorManager.GetMirrorState(k) == 1
|
|
|
|
|
--LogGreen(k.." 宝镜state:"..XuanYuanMirrorManager.GetMirrorState(k))
|
|
|
|
|
if not state or state == 0 then
|
|
|
|
|
local timeStr = this:GetOpenTime(k)
|
|
|
|
|
Util.GetGameObject(go, "timeBg/Text"):GetComponent("Text").text = timeStr..Language[10310]
|
|
|
|
|
Util.GetGameObject(go, "redPoint").gameObject:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
openFunctions[k] = {}
|
|
|
|
|
openFunctions[k].timeComp = Util.GetGameObject(go, "timeBg/Text"):GetComponent("Text")
|
|
|
|
|
if XuanYuanMirrorManager.CarbonRedCheck() then
|
|
|
|
|
Util.GetGameObject(go, "redPoint").gameObject:SetActive(true)
|
2020-08-14 20:41:07 +08:00
|
|
|
|
else
|
2021-11-26 10:53:49 +08:00
|
|
|
|
Util.GetGameObject(go, "redPoint").gameObject:SetActive(false)
|
2020-08-14 20:41:07 +08:00
|
|
|
|
end
|
2020-08-11 09:48:21 +08:00
|
|
|
|
end
|
2021-11-26 10:53:49 +08:00
|
|
|
|
Util.SetGray(go,not state)
|
|
|
|
|
Util.AddOnceClick(go ,function()
|
|
|
|
|
if state then
|
|
|
|
|
LogBlue("宝镜状态:"..activityType[k].name..XuanYuanMirrorManager.GetMirrorState(k))
|
|
|
|
|
UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,k)
|
|
|
|
|
else
|
|
|
|
|
LogBlue("宝镜未开启提示:"..activityType[k].name.."未开启!")
|
|
|
|
|
PopupTipPanel.ShowTip(activityType[k].name..Language[10338])
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this:TimeCountDown(openFunctions)
|
|
|
|
|
this.remainTimes.text = XuanYuanMirrorManager.GetTimeTip()
|
2021-04-27 16:00:24 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
this.UpdateCarbonContent = function(...)
|
|
|
|
|
LogBlue("type长度: "..LengthOfTable(activityType))
|
|
|
|
|
if not activityType then
|
|
|
|
|
activityType = {
|
|
|
|
|
[1] = {
|
|
|
|
|
bg = "ui_fb_btn_jy",
|
|
|
|
|
name = Language[10331],
|
|
|
|
|
gameObject = "renjiebaojing" ,
|
|
|
|
|
},
|
|
|
|
|
[2] = {
|
|
|
|
|
bg = "ui_fb_btn_gh",
|
|
|
|
|
name = Language[10332],
|
|
|
|
|
gameObject = "fuochanbaojing" ,
|
|
|
|
|
},
|
|
|
|
|
[3] = {
|
|
|
|
|
bg = "ui_fb_btn_sl",
|
|
|
|
|
name = Language[10333],
|
|
|
|
|
gameObject = "yaolingbaojing" ,
|
|
|
|
|
},
|
|
|
|
|
[4] = {
|
|
|
|
|
bg = "ui_fb_btn_jq",
|
|
|
|
|
name = Language[10334],
|
|
|
|
|
gameObject = "daoxuanbaojing" ,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
local temp = {...}
|
|
|
|
|
local temp = temp[1]
|
|
|
|
|
if index and index >= 0 then
|
|
|
|
|
this.refreshShow()
|
|
|
|
|
Timer.New(this.refreshShow, index):Start()
|
2020-08-05 15:00:56 +08:00
|
|
|
|
end
|
2020-08-14 20:41:07 +08:00
|
|
|
|
|
2020-08-05 15:00:56 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-07-15 16:27:58 +08:00
|
|
|
|
function this:OnSortingOrderChange()
|
|
|
|
|
Util.AddParticleSortLayer(this.effect, self.sortingOrder - orginLayer)
|
|
|
|
|
Util.AddParticleSortLayer(this.wind, self.sortingOrder - orginLayer)
|
|
|
|
|
|
|
|
|
|
orginLayer = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:PlayAni()
|
2020-07-15 16:27:58 +08:00
|
|
|
|
-- 开门音效
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:OnClose()
|
2020-10-15 17:27:50 +08:00
|
|
|
|
if self.timer then
|
|
|
|
|
self.timer:Stop()
|
|
|
|
|
self.timer = nil
|
|
|
|
|
end
|
2020-07-15 16:27:58 +08:00
|
|
|
|
this.isPlayDoorAudio = false
|
2020-08-11 09:48:21 +08:00
|
|
|
|
self.gameObject:SetActive(false)
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
2020-07-16 20:24:28 +08:00
|
|
|
|
function this:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-08-11 09:48:21 +08:00
|
|
|
|
if self.timer then
|
|
|
|
|
self.timer:Stop()
|
|
|
|
|
self.timer = nil
|
|
|
|
|
end
|
2020-10-19 21:21:54 +08:00
|
|
|
|
if this.UpView then
|
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
this.UpView = nil
|
|
|
|
|
end
|
2020-08-11 09:48:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--刷新时间
|
|
|
|
|
function this:TimeCountDown(_openFunctions)
|
|
|
|
|
if self.timer then
|
|
|
|
|
self.timer:Stop()
|
|
|
|
|
self.timer = nil
|
|
|
|
|
end
|
|
|
|
|
for k,v in pairs(_openFunctions) do
|
|
|
|
|
v.remainTime = XuanYuanMirrorManager.GetMirrorEndTime(k) - PlayerManager.serverTime
|
2021-03-02 16:53:12 +08:00
|
|
|
|
v.timeComp.text = TimeToHMS(v.remainTime)..Language[10339]
|
2020-08-11 09:48:21 +08:00
|
|
|
|
end
|
|
|
|
|
self.timer = Timer.New(function()
|
|
|
|
|
for k,v in pairs(_openFunctions) do
|
|
|
|
|
v.remainTime = v.remainTime - 1
|
|
|
|
|
if v.remainTime > 0 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
v.timeComp.text = TimeToHMS(v.remainTime)..Language[10339]
|
2020-08-11 09:48:21 +08:00
|
|
|
|
else
|
2020-08-14 20:41:07 +08:00
|
|
|
|
this:UpdateCarbonContent(1)
|
2020-08-11 09:48:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end, 1, -1, true)
|
|
|
|
|
self.timer:Start()
|
2020-07-15 16:27:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-07-16 20:24:28 +08:00
|
|
|
|
return XuanYuanMirrorPanel
|