2022-04-22 18:23:01 +08:00
|
|
|
|
---- 魂印图鉴 ----
|
|
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
|
GodPrintHandBook = Inherit(BasePanel)
|
|
|
|
|
|
local this = GodPrintHandBook
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
local ConfigData = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local orginLayer = 0 --层级
|
|
|
|
|
|
local allSoulPrintData = {} --所有魂印数据
|
|
|
|
|
|
local curIndex = 0 --当前选择索引
|
2022-04-22 18:23:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local chooseNum = 0
|
|
|
|
|
|
local tabs = {}
|
|
|
|
|
|
local itemData = {}
|
|
|
|
|
|
local currentDataList = {}
|
|
|
|
|
|
local chooseIdList = {}
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local list = {}
|
2022-04-22 18:23:01 +08:00
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:InitComponent()
|
|
|
|
|
|
this.spLoader = SpriteLoader.New()
|
|
|
|
|
|
this.backBtn = Util.GetGameObject(this.gameObject, "BackBtn")
|
2022-04-24 16:36:27 +08:00
|
|
|
|
this.Title = Util.GetGameObject(this.gameObject, "Title"):GetComponent("Text")
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.Title.text = Language[11163]
|
2022-04-22 18:23:01 +08:00
|
|
|
|
this.mask = Util.GetGameObject(this.gameObject, "mask")
|
|
|
|
|
|
for i = 1, 5 do
|
|
|
|
|
|
tabs[i] = Util.GetGameObject(this.gameObject, "Tabs/Btn" .. i)
|
|
|
|
|
|
end
|
|
|
|
|
|
this.selectBtn = Util.GetGameObject(this.gameObject, "Tabs/selectBtn")
|
|
|
|
|
|
this.selectBtnText = Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text")
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.scrollRoot = Util.GetGameObject(this.gameObject, "ScrollRoot")
|
|
|
|
|
|
this.pre = Util.GetGameObject(this.scrollRoot, "Pre")
|
|
|
|
|
|
this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollRoot.transform, this.pre, nil, --
|
|
|
|
|
|
Vector2.New(this.scrollRoot.transform.rect.width, this.scrollRoot.transform.rect.height), 1, 4,
|
2024-10-10 19:56:39 +08:00
|
|
|
|
Vector2.New(50, 100))
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 0)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
|
|
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
|
|
|
|
|
|
this.scrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
|
|
|
|
|
|
this.scrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
|
this.scrollView.moveTween.Strength = 2
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:BindEvent()
|
|
|
|
|
|
--tab按钮点击
|
|
|
|
|
|
for i = 1, 5 do
|
|
|
|
|
|
Util.AddClick(tabs[i], function()
|
|
|
|
|
|
if (curIndex == i) then
|
|
|
|
|
|
-- this.selectBtn:SetActive(false)
|
|
|
|
|
|
-- curIndex = 0
|
|
|
|
|
|
return
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
|
|
|
|
|
|
curIndex = i
|
|
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
this.OnRefresh(curIndex)
|
|
|
|
|
|
this:SetSelect()
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--关闭页面
|
|
|
|
|
|
Util.AddClick(this.backBtn, function()
|
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
|
end)
|
|
|
|
|
|
--关闭页面
|
|
|
|
|
|
Util.AddClick(this.mask, function()
|
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:AddListener()
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
function GodPrintHandBook:RemoveListener()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:OnSortingOrderChange()
|
|
|
|
|
|
--特效层级重设
|
|
|
|
|
|
for _, v in pairs(list) do
|
2024-09-06 10:38:56 +08:00
|
|
|
|
Util.SetParticleSortLayer(v, this.sortingOrder + 1)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
orginLayer = self.sortingOrder
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:OnOpen()
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:OnShow()
|
|
|
|
|
|
this.GetAllData()
|
2024-09-06 10:38:56 +08:00
|
|
|
|
curIndex = 5
|
2022-04-22 18:23:01 +08:00
|
|
|
|
this.OnRefresh(curIndex)
|
|
|
|
|
|
this.SetBottomBarIsActive()
|
|
|
|
|
|
this:SetSelect()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:SetSelect()
|
|
|
|
|
|
this.selectBtn:SetActive(true)
|
|
|
|
|
|
this.selectBtn.transform.localPosition = tabs[curIndex].transform.localPosition
|
|
|
|
|
|
this.selectBtnText.text = Util.GetGameObject(tabs[curIndex].transform, "Text"):GetComponent("Text").text
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
function this.GetAllData()
|
|
|
|
|
|
allSoulPrintData = {}
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local allCurSoulPrintData = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipConfig, "Position", 6)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
for i = 1, #allCurSoulPrintData do
|
|
|
|
|
|
local curSpiritAnimalBook
|
|
|
|
|
|
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.SpiritAnimalBook)) do
|
|
|
|
|
|
if configInfo.FetterType == 2 and configInfo.Teamers and configInfo.Teamers[1] and configInfo.Teamers[1][1] == allCurSoulPrintData[i].Id then
|
|
|
|
|
|
curSpiritAnimalBook = configInfo
|
|
|
|
|
|
break
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
if curSpiritAnimalBook then --表里只有高品质 所以低品质直接添加
|
|
|
|
|
|
if PlayerManager.level >= curSpiritAnimalBook.OpenLevel then
|
|
|
|
|
|
table.insert(allSoulPrintData, allCurSoulPrintData[i])
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
else
|
2024-09-06 10:38:56 +08:00
|
|
|
|
table.insert(allSoulPrintData, allCurSoulPrintData[i])
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
--特殊的开启条件
|
|
|
|
|
|
function this.SetBottomBarIsActive()
|
|
|
|
|
|
for i = 1, #tabs do
|
|
|
|
|
|
--为白金魂印定开启规则
|
|
|
|
|
|
-- if i == 4 then
|
|
|
|
|
|
-- local num = ConfigData[89].Value
|
|
|
|
|
|
-- tabs[i]:SetActive(PlayerManager.level >= tonumber(num))
|
|
|
|
|
|
-- end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:OnClose()
|
|
|
|
|
|
this.selectBtn:SetActive(false)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function GodPrintHandBook:OnDestroy()
|
|
|
|
|
|
this.spLoader:Destroy()
|
|
|
|
|
|
list = {}
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.scrollView = nil
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local orginLayer2 = 0
|
2022-04-22 18:23:01 +08:00
|
|
|
|
--打开页面时,页面数据刷新
|
|
|
|
|
|
function this.OnRefresh(index)
|
2024-09-06 10:38:56 +08:00
|
|
|
|
local tempData = {}
|
2022-04-22 18:23:01 +08:00
|
|
|
|
-- local num = ConfigData[89].Value
|
|
|
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
|
if index == 0 then
|
2022-04-22 18:23:01 +08:00
|
|
|
|
-- if PlayerManager.level >= tonumber(num) then--达到80级才显示白色魂印
|
2024-09-06 10:38:56 +08:00
|
|
|
|
tempData = allSoulPrintData
|
2022-04-22 18:23:01 +08:00
|
|
|
|
-- else
|
|
|
|
|
|
-- for i,v in ipairs(allSoulPrintData) do
|
|
|
|
|
|
-- if v.Quality ~= 7 then
|
|
|
|
|
|
-- table.insert(tempData, v)
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
-- end
|
|
|
|
|
|
else
|
2024-09-06 10:38:56 +08:00
|
|
|
|
for i, v in ipairs(allSoulPrintData) do
|
|
|
|
|
|
if v.Quality == (index + 2) and v.Star == 0 then
|
|
|
|
|
|
table.insert(tempData, v)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--预设容器
|
2024-09-06 10:38:56 +08:00
|
|
|
|
this.scrollView:SetData(tempData, function(index, root)
|
|
|
|
|
|
this.SetScrollPre(root, tempData[index])
|
2022-04-22 18:23:01 +08:00
|
|
|
|
list[root] = root
|
|
|
|
|
|
end)
|
|
|
|
|
|
this.scrollView:SetIndex(1)
|
|
|
|
|
|
|
|
|
|
|
|
orginLayer2 = this.sortingOrder
|
|
|
|
|
|
orginLayer = this.sortingOrder
|
|
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
|
2022-04-22 18:23:01 +08:00
|
|
|
|
--设置预设
|
2024-09-06 10:38:56 +08:00
|
|
|
|
function this.SetScrollPre(root, data)
|
|
|
|
|
|
Util.SetParticleSortLayer(root, this.sortingOrder + 1)
|
|
|
|
|
|
SetSoulEffect(itemConfig[data.Id].Quantity1, root)
|
|
|
|
|
|
local frame = Util.GetGameObject(root, "Frame"):GetComponent("Image")
|
|
|
|
|
|
local icon = Util.GetGameObject(root, "circleFrameBg/Icon"):GetComponent("Image")
|
|
|
|
|
|
local name = Util.GetGameObject(root, "Name"):GetComponent("Text")
|
|
|
|
|
|
Util.AddOnceClick(root, function()
|
|
|
|
|
|
UIManager.OpenPanel(UIName.GodPrintPopUp, 0, nil, data.Id, nil)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end)
|
|
|
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
|
frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(data.Quality))
|
|
|
|
|
|
icon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.Id].ResourceID))
|
|
|
|
|
|
Util.GetGameObject(root, "circleFrameBg"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
|
|
|
|
|
|
SoulPrintSpriteByQuantity[itemConfig[data.Id].Quantity].circleBg2)
|
|
|
|
|
|
Util.GetGameObject(root, "circleFrameBg/circleFrame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
|
|
|
|
|
|
SoulPrintSpriteByQuantity[itemConfig[data.Id].Quantity].circle)
|
2024-09-20 11:45:46 +08:00
|
|
|
|
local str = GetLanguageStrById(data.Name)
|
2025-01-17 16:26:21 +08:00
|
|
|
|
if GetCurLanguage() == -1 and LengthString(data.Name) >= 5 then
|
2024-09-06 10:38:56 +08:00
|
|
|
|
str = SubString(data.Name, 4) .. "..."
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
2024-09-06 10:38:56 +08:00
|
|
|
|
name.text = str --SubString2(GetLanguageStrById(data.Name),10)
|
2022-04-22 18:23:01 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2024-09-06 10:38:56 +08:00
|
|
|
|
return GodPrintHandBook
|