2021-04-20 13:58:00 +08:00
|
|
|
---献祭坛主面板---
|
2020-05-09 13:31:21 +08:00
|
|
|
require("Base/BasePanel")
|
|
|
|
ResolvePanel = Inherit(BasePanel)
|
|
|
|
local this = ResolvePanel
|
|
|
|
local isSha=false--筛选按钮状态
|
|
|
|
--Tab
|
|
|
|
local TabBox = require("Modules/Common/TabBox")
|
2020-08-07 12:22:10 +08:00
|
|
|
local _TabData={
|
2021-04-09 12:26:35 +08:00
|
|
|
[1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = Language[11732] },
|
2021-04-01 18:41:50 +08:00
|
|
|
-- [2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "神将归元" },
|
|
|
|
-- [3] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "法宝归元" },
|
2021-04-09 12:26:35 +08:00
|
|
|
[2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = Language[11603] },
|
|
|
|
[3] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = Language[11735] },
|
2020-08-07 12:22:10 +08:00
|
|
|
}
|
2020-05-09 13:31:21 +08:00
|
|
|
local _TabFontColor = { default = Color.New(130 / 255, 128 / 255, 120 / 255, 1),
|
|
|
|
select = Color.New(243 / 255, 235 / 255, 202 / 255, 1)}
|
|
|
|
--子模块脚本
|
|
|
|
this.contents = {
|
|
|
|
--献祭
|
2020-08-07 12:22:10 +08:00
|
|
|
[1] = {view = require("Modules/Resolve/View/Resolve_Dismantle"), panelName = "Resolve_Dismantle"},
|
|
|
|
--回溯
|
2021-03-30 16:36:00 +08:00
|
|
|
-- [2] = {view = require("Modules/Resolve/View/Resolve_Recall"), panelName = "Resolve_Recall"},
|
2020-08-07 12:22:10 +08:00
|
|
|
--法宝归元
|
2021-03-30 16:36:00 +08:00
|
|
|
-- [3] = {view = require("Modules/Resolve/View/Resolve_Talisman"), panelName = "Resolve_Talisman"},
|
2020-07-06 16:27:27 +08:00
|
|
|
--宝物分解
|
2021-03-30 16:36:00 +08:00
|
|
|
[2] = {view = require("Modules/Resolve/View/Resolve_EquipTreasure"), panelName = "Resolve_EquipTreasure"},
|
2020-10-31 17:01:46 +08:00
|
|
|
--放生灵兽
|
2021-03-30 16:36:00 +08:00
|
|
|
[3] = {view = require("Modules/Resolve/View/Resolve_Pokemon"), panelName = "Resolve_Pokemon"},
|
2020-05-09 13:31:21 +08:00
|
|
|
}
|
|
|
|
--子模块预设
|
|
|
|
this.prefabs={}
|
|
|
|
--上一子模块索引
|
|
|
|
local curIndex=0
|
|
|
|
--Title资源名
|
2021-03-30 16:36:00 +08:00
|
|
|
local titleImageName={"gongsong_zh","h_xianji_fenjie_zh","lingshou_lingshoufangshengzi_zh"}--,"guiyuan_zh","h_guiyuan_zi_zh"
|
|
|
|
local bgImageName={"h_xianji_ditu","h_xianji_fenjieditu","lingshou_lingshoubeijing_03"}--,"h_huisu_ditu","h_xianji_guiyuanditu"
|
2020-05-09 13:31:21 +08:00
|
|
|
local heroEndBtns = {}
|
|
|
|
local tabSortType
|
|
|
|
|
|
|
|
function ResolvePanel:InitComponent()
|
|
|
|
this.panel = Util.GetGameObject(self.gameObject, "Panel")
|
2020-10-31 17:01:46 +08:00
|
|
|
this.bgIma=Util.GetGameObject(self.gameObject,"Bg"):GetComponent("Image")
|
2020-05-09 13:31:21 +08:00
|
|
|
this.title=Util.GetGameObject(self.gameObject,"Title"):GetComponent("Image")
|
|
|
|
this.backBtn = Util.GetGameObject(this.panel, "BackBtn")
|
|
|
|
this.content = Util.GetGameObject(this.panel, "Content")
|
|
|
|
this.itemListRoot=Util.GetGameObject(this.panel,"ItemListRoot")
|
|
|
|
this.shaiBtn = Util.GetGameObject(this.panel, "leftUp/shaiBtn")
|
2021-02-23 10:51:52 +08:00
|
|
|
this.shaiBtn:GetComponent("Image").sprite = Util.LoadSprite("r_shaixuan_zh")
|
2020-05-09 13:31:21 +08:00
|
|
|
this.btnHeroGrid = Util.GetGameObject(this.panel, "endTabs/btnHeroGrid")
|
|
|
|
this.endTabs = Util.GetGameObject(this.panel, "endTabs")
|
|
|
|
this.endTabs:SetActive(false)
|
|
|
|
--预设赋值
|
|
|
|
for i=1,#this.contents do
|
|
|
|
this.prefabs[i]=Util.GetGameObject(this.panel,this.contents[i].panelName)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
this.selectHeroBtn = Util.GetGameObject(this.panel, "endTabs/selectBtn")
|
2021-03-31 17:40:51 +08:00
|
|
|
for i = 1, 5 do
|
2020-07-07 10:57:23 +08:00
|
|
|
heroEndBtns[i]=Util.GetGameObject(this.panel, "endTabs/btnHeroGrid/btnHeroGrid/Btn"..i-1)
|
2021-03-03 15:51:04 +08:00
|
|
|
Util.GetGameObject(heroEndBtns[i],"Image"):GetComponent("Image").sprite = Util.LoadSprite(PropertyIcon[i-1])
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
for i = 1, #this.contents do
|
|
|
|
this.contents[i].view:InitComponent(this.panel)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:BindEvent()
|
|
|
|
for i = 1, #this.contents do
|
|
|
|
this.contents[i].view:BindEvent()
|
|
|
|
end
|
|
|
|
--返回按钮
|
|
|
|
Util.AddClick(this.backBtn,function()
|
|
|
|
if isSha then
|
|
|
|
isSha=not isSha
|
|
|
|
this.RewardGridGoMov(isSha,function()
|
|
|
|
self:ClosePanel()
|
|
|
|
end)
|
|
|
|
else
|
|
|
|
self:ClosePanel()
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
Util.AddClick(this.shaiBtn, function()
|
|
|
|
isSha=not isSha
|
|
|
|
this.RewardGridGoMov(isSha)
|
|
|
|
end)
|
2020-07-10 18:29:38 +08:00
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
for i = 1, 6 do
|
|
|
|
Util.AddClick( heroEndBtns[i], function()
|
2021-04-09 12:26:35 +08:00
|
|
|
print(Language[12153]..tabSortType)
|
2020-07-10 18:29:38 +08:00
|
|
|
if tabSortType == i-1 then
|
2020-05-09 13:31:21 +08:00
|
|
|
tabSortType = 0
|
|
|
|
this.contents[curIndex].view.SortTypeClick(0)--全部
|
2020-07-07 10:57:23 +08:00
|
|
|
this.EndTabBtnSelect()
|
2020-05-09 13:31:21 +08:00
|
|
|
else
|
2020-07-10 18:29:38 +08:00
|
|
|
tabSortType = i-1
|
|
|
|
this.contents[curIndex].view.SortTypeClick(i-1)
|
2020-07-07 10:57:23 +08:00
|
|
|
this.EndTabBtnSelect(heroEndBtns[i])
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
2021-01-05 14:29:33 +08:00
|
|
|
PlayerManager.now_index = tabSortType
|
2021-04-09 12:26:35 +08:00
|
|
|
print(Language[12154]..tabSortType)
|
2020-05-09 13:31:21 +08:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:AddListener()
|
|
|
|
for i = 1, #this.contents do
|
|
|
|
this.contents[i].view:AddListener()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:RemoveListener()
|
|
|
|
for i = 1, #this.contents do
|
|
|
|
this.contents[i].view:RemoveListener()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:OnSortingOrderChange()
|
|
|
|
this.sortingOrder = self.sortingOrder
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:OnOpen(...)
|
|
|
|
local args = {...}
|
|
|
|
if args[1] then
|
|
|
|
curIndex=args[1]
|
|
|
|
else
|
|
|
|
curIndex=1
|
|
|
|
end
|
|
|
|
tabSortType = 0
|
|
|
|
this.EndTabBtnSelect()
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:OnShow()
|
|
|
|
this.upView = SubUIManager.Open(SubUIConfig.UpView, self.transform, {showType = UpViewOpenType.ShowLeft})
|
|
|
|
this.tabBox = Util.GetGameObject(this.panel, "TabBox")
|
|
|
|
this.TabCtrl = TabBox.New()
|
|
|
|
this.TabCtrl:SetTabAdapter(this.TabAdapter)
|
|
|
|
this.TabCtrl:SetChangeTabCallBack(this.SwitchView)
|
|
|
|
this.TabCtrl:Init(this.tabBox, _TabData,curIndex)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:OnClose()
|
|
|
|
SubUIManager.Close(this.upView)
|
|
|
|
for i = 1, #this.contents do
|
|
|
|
this.contents[i].view:OnClose()
|
|
|
|
end
|
2021-01-05 14:29:33 +08:00
|
|
|
this.RewardGridGoMov(false)
|
|
|
|
PlayerManager.now_index = 0
|
|
|
|
this.EndTabBtnSelect()
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function ResolvePanel:OnDestroy()
|
|
|
|
for i = 1, #this.contents do
|
|
|
|
this.contents[i].view:OnDestroy()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--切换视图
|
2021-02-26 14:52:59 +08:00
|
|
|
function this.SwitchView(index,isNotTop,isNotAni)
|
2021-01-05 14:29:33 +08:00
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
--先执行上一面板关闭逻辑
|
|
|
|
local oldSelect
|
|
|
|
oldSelect, curIndex = curIndex, index
|
2021-01-05 14:29:33 +08:00
|
|
|
if oldSelect ~= curIndex then
|
|
|
|
-- body
|
|
|
|
this.RewardGridGoMov(false)
|
2021-01-07 14:39:27 +08:00
|
|
|
isSha = false
|
2021-01-05 14:29:33 +08:00
|
|
|
PlayerManager.now_index = 0
|
2021-01-07 14:39:27 +08:00
|
|
|
|
2021-01-05 14:29:33 +08:00
|
|
|
end
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
for i = 1, #this.contents do
|
|
|
|
if oldSelect~=0 then this.contents[oldSelect].view:OnClose() break end
|
|
|
|
end
|
|
|
|
--切换预设显隐
|
|
|
|
for i = 1, #this.prefabs do
|
|
|
|
this.prefabs[i].gameObject:SetActive(i == index)--切换子模块预设显隐
|
|
|
|
end
|
|
|
|
--区分显示
|
2020-10-31 17:01:46 +08:00
|
|
|
this.shaiBtn:SetActive(true)
|
2020-05-09 13:31:21 +08:00
|
|
|
if index==1 then
|
2020-08-24 13:59:08 +08:00
|
|
|
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.HeartFireStone})
|
2020-10-31 17:01:46 +08:00
|
|
|
this.bgIma.sprite=Util.LoadSprite(bgImageName[1])
|
2020-05-09 13:31:21 +08:00
|
|
|
this.title.sprite=Util.LoadSprite(titleImageName[1])
|
2021-03-30 16:36:00 +08:00
|
|
|
-- elseif index==2 then
|
|
|
|
-- this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.HeroReturn})
|
|
|
|
-- this.bgIma.sprite=Util.LoadSprite(bgImageName[2])
|
|
|
|
-- this.title.sprite=Util.LoadSprite(titleImageName[2])
|
|
|
|
-- elseif index==3 then
|
|
|
|
-- this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.HeroReturn})
|
|
|
|
-- this.bgIma.sprite=Util.LoadSprite(bgImageName[3])
|
|
|
|
-- this.title.sprite=Util.LoadSprite(titleImageName[3])
|
2020-05-09 13:31:21 +08:00
|
|
|
elseif index==2 then
|
2020-08-24 13:59:08 +08:00
|
|
|
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.HeroReturn})
|
2020-10-31 17:01:46 +08:00
|
|
|
this.bgIma.sprite=Util.LoadSprite(bgImageName[2])
|
2020-05-09 13:31:21 +08:00
|
|
|
this.title.sprite=Util.LoadSprite(titleImageName[2])
|
2020-07-06 16:27:27 +08:00
|
|
|
elseif index==3 then
|
2021-03-30 16:36:00 +08:00
|
|
|
this.shaiBtn:SetActive(false)
|
2020-08-24 13:59:08 +08:00
|
|
|
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.HeroReturn})
|
2020-10-31 17:01:46 +08:00
|
|
|
this.bgIma.sprite=Util.LoadSprite(bgImageName[3])
|
2021-03-31 21:19:56 +08:00
|
|
|
this.title.sprite=Util.LoadSprite(titleImageName[3])
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
this.title:SetNativeSize()
|
|
|
|
|
|
|
|
--执行子模块初始化
|
2021-01-05 14:29:33 +08:00
|
|
|
|
2021-02-26 14:52:59 +08:00
|
|
|
this.contents[index].view:OnShow(this.sortingOrder,this.itemListRoot,isNotTop,isNotAni)
|
2020-07-07 10:57:23 +08:00
|
|
|
--刷新选择按钮
|
|
|
|
tabSortType = 0
|
2021-01-05 14:29:33 +08:00
|
|
|
this.EndTabBtnSelect(heroEndBtns[PlayerManager.now_index + 1])
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
-- tab节点显示自定义
|
|
|
|
function this.TabAdapter(tab, index, status)
|
|
|
|
local tabLab = Util.GetGameObject(tab, "Text")
|
|
|
|
Util.GetGameObject(tab,"Image"):GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status])
|
2021-02-23 17:41:59 +08:00
|
|
|
tabLab:GetComponent("Text").text = GetCurLanguage() ~= 2 and _TabData[index].name or "<size=30>".._TabData[index].name.."</size>"
|
2020-05-09 13:31:21 +08:00
|
|
|
tabLab:GetComponent("Text").color = _TabFontColor[status]
|
2020-09-02 18:33:17 +08:00
|
|
|
this.SetBottomBarIsActive(tab, index)
|
|
|
|
end
|
|
|
|
|
|
|
|
--特殊的开启条件
|
|
|
|
function this.SetBottomBarIsActive(tab, index)
|
|
|
|
local ConfigData = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
2021-03-30 16:36:00 +08:00
|
|
|
if index == 2 then
|
2020-09-02 18:33:17 +08:00
|
|
|
local string = ConfigData[40].Value
|
|
|
|
local num = string.split(string.split(string,"|")[1],"#")[2]
|
|
|
|
tab:SetActive(PlayerManager.level >= tonumber(num))
|
2021-03-30 16:36:00 +08:00
|
|
|
elseif index == 3 then
|
2020-12-24 14:23:29 +08:00
|
|
|
tab.gameObject:SetActive(ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.POKEMON))
|
2020-09-02 18:33:17 +08:00
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function this.RewardGridGoMov(isSha,fun)
|
|
|
|
this.shaiBtn:GetComponent("Button").enabled = false
|
|
|
|
if isSha then
|
|
|
|
this.endTabs:SetActive(true)
|
|
|
|
--this.btnHeroGrid.transform:DOAnchorPosY(-670, 0.5, false)
|
|
|
|
this.endTabs.transform:DOAnchorPosY(251.62, 0.5, false):OnComplete(function()
|
|
|
|
this.shaiBtn:GetComponent("Button").enabled = true
|
|
|
|
if fun then
|
|
|
|
fun()
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
else
|
|
|
|
--this.btnHeroGrid.transform:DOAnchorPosY(-766, 0.5, false)
|
|
|
|
this.endTabs.transform:DOAnchorPosY(-38.64, 0.5, false):OnComplete(function()
|
|
|
|
this.shaiBtn:GetComponent("Button").enabled = true
|
|
|
|
this.endTabs:SetActive(false)
|
|
|
|
if fun then
|
|
|
|
fun()
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--下部页签排序
|
|
|
|
function this.EndTabBtnSelect(_btn)
|
2020-07-07 10:57:23 +08:00
|
|
|
-- this.selectHeroBtn:SetActive(tabSortType > 0)
|
2020-05-09 13:31:21 +08:00
|
|
|
if _btn then
|
|
|
|
this.selectHeroBtn.transform:SetParent(_btn.transform)
|
|
|
|
this.selectHeroBtn.transform.localScale = Vector3.one
|
|
|
|
this.selectHeroBtn.transform.localPosition=Vector3.zero
|
2020-07-07 10:57:23 +08:00
|
|
|
else
|
|
|
|
this.selectHeroBtn.transform:SetParent(heroEndBtns[1].transform)
|
|
|
|
this.selectHeroBtn.transform.localScale = Vector3.one
|
|
|
|
this.selectHeroBtn.transform.localPosition=Vector3.zero
|
2020-05-09 13:31:21 +08:00
|
|
|
end
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
return ResolvePanel
|