2021-11-15 18:24:39 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
TailsManSouPanel = Inherit(BasePanel)
|
2021-11-22 10:38:54 +08:00
|
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
local this = TailsManSouPanel
|
|
|
|
|
local redPointList = {}
|
2023-10-30 15:27:42 +08:00
|
|
|
|
local tabsRedpoints = {}
|
|
|
|
|
local tabs={}
|
|
|
|
|
local tabsImg = {"r_hero_huo 1_zh", "r_hero_feng 1_zh", "r_hero_shui 1_zh", "r_hero_dadi 1_zh"}
|
2023-12-29 17:34:32 +08:00
|
|
|
|
local special=ConfigManager.GetConfigData(ConfigName.SpecialConfig,177)
|
|
|
|
|
local pro=tonumber(special.Value)/100
|
2021-11-15 18:24:39 +08:00
|
|
|
|
-- Tab管理器
|
|
|
|
|
local TabBox = require("Modules/Common/TabBox")
|
2023-10-30 15:27:42 +08:00
|
|
|
|
local tabData = {
|
2021-11-15 18:24:39 +08:00
|
|
|
|
[1] = { --金色
|
|
|
|
|
default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",tabName = "金色",
|
2021-11-19 11:33:34 +08:00
|
|
|
|
rpType = RedPointType.tailsmanSoul_gold,quality = 5
|
2021-11-15 18:24:39 +08:00
|
|
|
|
},
|
|
|
|
|
[2] = { --红色
|
|
|
|
|
default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",tabName = "红色",
|
2021-11-19 11:33:34 +08:00
|
|
|
|
rpType = RedPointType.tailsmanSoul_red,quality = 6
|
2021-11-15 18:24:39 +08:00
|
|
|
|
},
|
2022-01-13 16:41:23 +08:00
|
|
|
|
[3] = { --白金
|
|
|
|
|
default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",tabName = "白金",
|
|
|
|
|
rpType = RedPointType.tailsmanSoul_whiteGold,bg = "t_tianshumijuan_lingshouditu",quality = 7
|
|
|
|
|
},
|
2021-11-15 18:24:39 +08:00
|
|
|
|
}
|
|
|
|
|
local curData = {}
|
|
|
|
|
local curPage = 1
|
2023-10-30 15:27:42 +08:00
|
|
|
|
local proId = 1
|
2023-12-29 17:34:32 +08:00
|
|
|
|
local addLv=0
|
2021-11-11 16:48:15 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:InitComponent()
|
2021-11-15 18:24:39 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
|
|
|
|
self.itemPreList = {}
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.bg = Util.GetGameObject(self.gameObject,"bg"):GetComponent("Image")
|
2023-10-30 15:27:42 +08:00
|
|
|
|
--self.tabbox = Util.GetGameObject(self.gameObject,"bg/tabbox")
|
2021-11-15 18:24:39 +08:00
|
|
|
|
self.btnBack = Util.GetGameObject(self.gameObject,"bg/btnBack")
|
2023-10-30 15:27:42 +08:00
|
|
|
|
self.selectBtn = Util.GetGameObject(self.gameObject,"bg/Tabs/selectBtn")
|
2021-11-15 18:24:39 +08:00
|
|
|
|
self.fetterItem = Util.GetGameObject(self.gameObject,"fetterItem")
|
|
|
|
|
local grid = Util.GetGameObject(self.gameObject,"bg/fetterGrid")
|
|
|
|
|
local v21 = grid.transform.rect
|
|
|
|
|
self.scroll = SubUIManager.Open(SubUIConfig.ScrollCycleView,grid.transform,self.fetterItem,nil,Vector2.New(v21.width, v21.height), 1, 1, Vector2.New(0,25))
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.scroll.moveTween.MomentumAmount = 1
|
|
|
|
|
self.scroll.moveTween.Strength = 2
|
2021-11-15 18:24:39 +08:00
|
|
|
|
self.empty = Util.GetGameObject(self.gameObject,"bg/NoneImage")
|
2024-01-12 16:22:45 +08:00
|
|
|
|
Util.GetGameObject(self.gameObject,"bg/NoneImage/TextImage/Text"):GetComponent("Text").text="无符合要求的羁绊!"
|
2021-11-16 15:24:17 +08:00
|
|
|
|
self.addBtn = Util.GetGameObject(self.gameObject,"bg/add")
|
2022-01-06 14:52:02 +08:00
|
|
|
|
self.starAddBtn = Util.GetGameObject(self.gameObject,"bg/starAdd")
|
2022-11-29 14:20:22 +08:00
|
|
|
|
self.starAddBtn:SetActive(false)
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
2021-11-19 17:08:14 +08:00
|
|
|
|
self.effectJin = Util.GetGameObject(self.gameObject,"bg/effect/UI_effect_RecruitPanel_particle_jin")
|
|
|
|
|
self.effectHong = Util.GetGameObject(self.gameObject,"bg/effect/UI_effect_RecruitPanel_particle_hong")
|
2023-10-30 15:27:42 +08:00
|
|
|
|
|
|
|
|
|
for i = 1, 5 do
|
|
|
|
|
tabs[i] = Util.GetGameObject(self.transform, "bg/Tabs/grid/Btn" .. i)
|
|
|
|
|
tabsRedpoints[i] = Util.GetGameObject(tabs[i], "redpoint")
|
2023-10-30 19:16:17 +08:00
|
|
|
|
local name =Util.GetGameObject(tabs[i], "Text"):GetComponent("Text")
|
|
|
|
|
name.text = PropertyType[i]
|
2023-10-30 15:27:42 +08:00
|
|
|
|
if tabsImg[i] then
|
|
|
|
|
Util.GetGameObject(tabs[i], "Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(tabsImg[i])
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-11-11 16:48:15 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:BindEvent()
|
2023-10-30 15:27:42 +08:00
|
|
|
|
BindRedPointObject(RedPointType.tailsmanSoul_gold,tabsRedpoints[1].gameObject)
|
|
|
|
|
BindRedPointObject(RedPointType.tailsmanSoul_red,tabsRedpoints[2].gameObject)
|
|
|
|
|
BindRedPointObject(RedPointType.tailsmanSoul_whiteGold,tabsRedpoints[3].gameObject)
|
|
|
|
|
BindRedPointObject(RedPointType.tailsmanSoul_blue,tabsRedpoints[4].gameObject)
|
|
|
|
|
BindRedPointObject(RedPointType.tailsmanSoul_whiteBlue,tabsRedpoints[5].gameObject)
|
|
|
|
|
for i = 1,5 do
|
|
|
|
|
Util.AddClick(tabs[i], function()
|
|
|
|
|
if i == proId then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
proId = i
|
|
|
|
|
self:SetSelectBtn()
|
|
|
|
|
curData = TailsManSoulManager.GetTailsmanSoulDatasByPro(proId)
|
|
|
|
|
self:RefreshData()
|
|
|
|
|
end)
|
|
|
|
|
end
|
2021-11-15 18:24:39 +08:00
|
|
|
|
Util.AddClick(self.btnBack, function()
|
2021-11-19 11:33:34 +08:00
|
|
|
|
curPage = 1
|
2021-11-15 18:24:39 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
2021-11-16 15:24:17 +08:00
|
|
|
|
Util.AddClick(self.addBtn, function()
|
2021-11-23 10:31:09 +08:00
|
|
|
|
local li = TailsManSoulManager.GetTailsmanTotalPro()
|
2023-12-29 17:34:32 +08:00
|
|
|
|
local li2= TailsManSoulManager.GetTailsmanTotalProNoAdd()
|
2021-11-23 10:31:09 +08:00
|
|
|
|
if not li or #li < 1 then
|
|
|
|
|
PopupTipPanel.ShowTip("当前无属性加成")
|
|
|
|
|
return
|
|
|
|
|
end
|
2023-12-29 17:34:32 +08:00
|
|
|
|
local s = function(data,data2)
|
2021-11-22 11:44:48 +08:00
|
|
|
|
local lis1 = {}
|
|
|
|
|
for k,v in pairs(data) do
|
2023-12-29 17:34:32 +08:00
|
|
|
|
table.insert(lis1,{str = string.format("<color=#00FF00>%s+%s 法宝共鸣额外加成%s (%s%%)</color>",propertyConfig[k].Info,GetPropertyFormatStr(propertyConfig[k].Style,v),GetPropertyFormatStr(propertyConfig[k].Style,v-data2[k]),addLv*pro),sort = propertyConfig[k].SortId})
|
2021-11-22 10:38:54 +08:00
|
|
|
|
end
|
2021-11-23 14:00:36 +08:00
|
|
|
|
table.sort(lis1,function(a,b)
|
|
|
|
|
return a.sort < b.sort
|
|
|
|
|
end)
|
|
|
|
|
local list2 = {}
|
|
|
|
|
for i = 1,#lis1 do
|
|
|
|
|
table.insert(list2,lis1[i].str)
|
|
|
|
|
end
|
|
|
|
|
return list2
|
2021-11-22 10:38:54 +08:00
|
|
|
|
end
|
2021-11-22 11:44:48 +08:00
|
|
|
|
local data = {}
|
|
|
|
|
local singData = {}
|
2021-11-23 10:31:09 +08:00
|
|
|
|
singData.title = "加成属性"
|
2023-12-29 17:34:32 +08:00
|
|
|
|
singData.pro = s(li,li2)
|
2021-11-22 11:44:48 +08:00
|
|
|
|
singData.tip = ""
|
|
|
|
|
table.insert(data,singData)
|
|
|
|
|
-- for i = 1 ,#data do
|
|
|
|
|
-- LogGreen("data[i]:"..data[i].title.." #pro:"..#data[i].pro)
|
|
|
|
|
-- for k,v in ipairs(data[i].pro) do
|
|
|
|
|
-- LogGreen("data[i]:"..v)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
2023-12-29 17:34:32 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.IncarnationDes2,data)
|
2021-11-22 11:44:48 +08:00
|
|
|
|
|
|
|
|
|
-- local li = TailsManSoulManager.GetTailsmanTotalPro()
|
|
|
|
|
-- local li2 = {}
|
|
|
|
|
-- for k,v in pairs(li) do
|
|
|
|
|
-- if propertyConfig[k].Style == 1 then
|
|
|
|
|
-- li2[k] = v
|
|
|
|
|
-- elseif propertyConfig[k].Style == 2 then
|
|
|
|
|
-- li2[k] = v/100
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- UIManager.OpenPanel(UIName.RoleProInfoPopup,li2,nil,false,nil)
|
2021-11-16 15:24:17 +08:00
|
|
|
|
end)
|
2022-01-06 14:52:02 +08:00
|
|
|
|
Util.AddClick(self.starAddBtn, function()
|
|
|
|
|
local data = {}
|
|
|
|
|
local singData = {}
|
|
|
|
|
singData.title = "总星级加成"
|
|
|
|
|
singData.pro = {}
|
|
|
|
|
local star = TailsManSoulManager.GetTotalStar()
|
|
|
|
|
local s = function(skillList,starNum)
|
|
|
|
|
local proStr = ""
|
|
|
|
|
for k,v in ipairs(skillList) do
|
|
|
|
|
if proStr == "" then
|
2022-01-10 13:35:40 +08:00
|
|
|
|
proStr = string.format("%s+%s",string.gsub(propertyConfig[v[1]].Info,"几率", ""),GetPropertyFormatStr(propertyConfig[v[1]].Style,v[2]))
|
2022-01-06 14:52:02 +08:00
|
|
|
|
else
|
2022-01-10 13:35:40 +08:00
|
|
|
|
proStr = proStr.. string.format(",%s+%s",string.gsub(propertyConfig[v[1]].Info,"几率", ""),GetPropertyFormatStr(propertyConfig[v[1]].Style,v[2]))
|
2022-01-06 14:52:02 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local str = ""
|
|
|
|
|
local color = "B9AC97"
|
|
|
|
|
if star >= starNum then
|
|
|
|
|
color = "00FF00"
|
|
|
|
|
end
|
2022-01-08 17:47:18 +08:00
|
|
|
|
str = string.format("<size=32><color=#%s>%s/%s星:%s</color></size>",color,star,starNum,proStr)
|
2022-01-06 14:52:02 +08:00
|
|
|
|
return str
|
|
|
|
|
end
|
|
|
|
|
for k,v in ConfigPairs(ConfigManager.GetConfig(ConfigName.TrumpStar)) do
|
|
|
|
|
local str = s(v.PropListShow,v.StarNum)
|
|
|
|
|
table.insert(singData.pro,str)
|
|
|
|
|
end
|
|
|
|
|
table.insert(data,singData)
|
|
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenHunShuXing,data)
|
|
|
|
|
end)
|
2023-10-30 15:27:42 +08:00
|
|
|
|
-- self.tabBox = TabBox.New()
|
|
|
|
|
-- self.tabBox:SetTabAdapter(self.SetTabAdapter)
|
|
|
|
|
-- self.tabBox:SetTabIsLockCheck(self.TabIsLockCheck)
|
|
|
|
|
-- self.tabBox:SetChangeTabCallBack(self.SetChangeTabCallBack)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
end
|
2023-10-30 15:27:42 +08:00
|
|
|
|
|
|
|
|
|
function TailsManSouPanel:RefreshList(istop,isAnim)
|
|
|
|
|
self.datas = IncarnationManager.GetItemDataListByPro(proId)
|
|
|
|
|
self.scroll:ForeachItemGO(function(index,go)
|
|
|
|
|
go.gameObject:SetActive(false)
|
|
|
|
|
end)
|
|
|
|
|
if not self.datas or #self.datas < 1 then
|
|
|
|
|
self.empty.gameObject:SetActive(true)
|
|
|
|
|
self.scroll.gameObject:SetActive(false)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
else
|
2023-10-30 15:27:42 +08:00
|
|
|
|
self.empty.gameObject:SetActive(false)
|
|
|
|
|
self.scroll.gameObject:SetActive(true)
|
|
|
|
|
self.scroll:SetData(self.datas,function(index,go)
|
|
|
|
|
self:SetSingleData(go,self.datas[index],index)
|
|
|
|
|
end,istop,isAnim)
|
|
|
|
|
end
|
2021-11-15 18:24:39 +08:00
|
|
|
|
end
|
|
|
|
|
|
2023-10-30 15:27:42 +08:00
|
|
|
|
function TailsManSouPanel:SetSelectBtn()
|
|
|
|
|
self.selectBtn.transform:SetParent(tabs[proId].transform)
|
2024-01-12 16:22:45 +08:00
|
|
|
|
self.selectBtn.transform:SetSiblingIndex(2)
|
2023-10-30 15:27:42 +08:00
|
|
|
|
self.selectBtn:GetComponent("RectTransform").localPosition = Vector3.zero
|
2021-11-15 18:24:39 +08:00
|
|
|
|
end
|
|
|
|
|
|
2023-10-30 15:27:42 +08:00
|
|
|
|
-- function TailsManSouPanel.SetTabAdapter(newTab, index, status)
|
|
|
|
|
-- local img = Util.GetGameObject(newTab.gameObject,"img"):GetComponent("Image")
|
|
|
|
|
-- local redpot = Util.GetGameObject(newTab.gameObject,"redpot")
|
|
|
|
|
-- local tabName = Util.GetGameObject(newTab.gameObject,"Text"):GetComponent("Text")
|
|
|
|
|
-- local lock = Util.GetGameObject(newTab.gameObject,"lock")
|
|
|
|
|
-- if tabs[index].rpType > 0 then
|
|
|
|
|
-- if redPointList[tabs[index].rpType] then
|
|
|
|
|
-- ClearRedPointObject(tabs[index].rpType,redPointList[tabs[index].rpType])
|
|
|
|
|
-- end
|
|
|
|
|
-- BindRedPointObject(tabs[index].rpType,redpot)
|
|
|
|
|
-- redPointList[tabs[index].rpType] = redpot
|
|
|
|
|
-- end
|
|
|
|
|
-- img.sprite = this.spLoader:LoadSprite(tabs[index][status])
|
|
|
|
|
-- tabName.text = tabs[index].tabName
|
|
|
|
|
-- if status == "lock" then
|
|
|
|
|
-- lock.gameObject:SetActive(true)
|
|
|
|
|
-- else
|
|
|
|
|
-- lock.gameObject:SetActive(false)
|
|
|
|
|
-- end
|
|
|
|
|
-- newTab.gameObject:SetActive(true)
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- function TailsManSouPanel.TabIsLockCheck(index)
|
|
|
|
|
-- return false
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- function TailsManSouPanel.SetChangeTabCallBack(index)
|
|
|
|
|
-- if curPage == index then
|
|
|
|
|
-- return
|
|
|
|
|
-- end
|
|
|
|
|
-- curPage = index
|
|
|
|
|
-- this:OnShow(self)
|
|
|
|
|
-- end
|
2021-11-11 16:48:15 +08:00
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:OnOpen(...)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
local args = {...}
|
2023-10-30 15:27:42 +08:00
|
|
|
|
curPage = args[1] or 2
|
2021-11-11 16:48:15 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
2021-11-16 15:24:17 +08:00
|
|
|
|
function TailsManSouPanel:OnShow()
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
2023-10-30 15:27:42 +08:00
|
|
|
|
--self.tabBox:Init(self.tabbox.gameObject, tabs, curPage)
|
|
|
|
|
curData = TailsManSoulManager.GetTailsmanSoulDatasByPro(1)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
self:RefreshData()
|
2023-12-29 17:34:32 +08:00
|
|
|
|
addLv=0
|
|
|
|
|
for i=1,5 do
|
|
|
|
|
local curData = TailsManSoulManager.GetTailsmanSoulDatasByPro(i)
|
|
|
|
|
for j=1,#curData do
|
|
|
|
|
--LogError("curData.lv=========="..curData[j].lv)
|
|
|
|
|
if curData[j].lv>0 then
|
|
|
|
|
addLv=addLv+curData[j].lv
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
2023-10-30 15:27:42 +08:00
|
|
|
|
self.effectJin.gameObject:SetActive(tabData[curPage].quality == 5)
|
|
|
|
|
self.effectHong.gameObject:SetActive(tabData[curPage].quality == 6)
|
2021-11-19 17:08:14 +08:00
|
|
|
|
Util.SetParticleSortLayer(self.effectJin.gameObject,self.sortingOrder + 1)
|
|
|
|
|
Util.SetParticleSortLayer(self.effectHong.gameObject,self.sortingOrder + 1)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function TailsManSouPanel:RefreshData()
|
2023-10-30 15:27:42 +08:00
|
|
|
|
self:SetSelectBtn()
|
2021-11-15 18:24:39 +08:00
|
|
|
|
self.scroll:ForeachItemGO(function(index,go)
|
|
|
|
|
go.gameObject:SetActive(false)
|
|
|
|
|
end)
|
|
|
|
|
if not curData or #curData < 1 then
|
|
|
|
|
self.empty.gameObject:SetActive(true)
|
|
|
|
|
self.scroll.gameObject:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
self.empty.gameObject:SetActive(false)
|
|
|
|
|
self.scroll.gameObject:SetActive(true)
|
|
|
|
|
self.scroll:SetData(curData,function(index,go)
|
|
|
|
|
self:SetSingleData(go,curData[index],index)
|
|
|
|
|
end)
|
|
|
|
|
self.scroll:SetIndex(1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-10-30 15:27:42 +08:00
|
|
|
|
|
2021-11-15 18:24:39 +08:00
|
|
|
|
|
|
|
|
|
function TailsManSouPanel:SetSingleData(go,data,index)
|
|
|
|
|
if not self.itemPreList[go] then
|
|
|
|
|
self.itemPreList[go] = {}
|
|
|
|
|
self.itemPreList[go].obj = Util.GetGameObject(go,"go")
|
2023-10-30 19:16:17 +08:00
|
|
|
|
--self.itemPreList[go].effect = Util.GetGameObject(self.itemPreList[go].obj,"ui-fabao")
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.itemPreList[go].bg = Util.GetGameObject(self.itemPreList[go].obj,"bg"):GetComponent("Image") --根据品质变化的图片 f_fabaojuling_zhujiemianbaijin f_fabaojuling_zhujiemianhong f_fabaojuling_zhujiemianjin
|
2023-10-30 19:16:17 +08:00
|
|
|
|
--self.itemPreList[go].tip = Util.GetGameObject(self.itemPreList[go].bg.transform,"slider/tip"):GetComponent("Image") --根据品质变化的图片 f_fabaojuling_zhujiemianbaijin f_fabaojuling_zhujiemianhong f_fabaojuling_zhujiemianjin
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.itemPreList[go].mask1 = Util.GetGameObject(self.itemPreList[go].bg.transform,"slider/mask1"):GetComponent("Image") --根据品质变化的图片 f_fabaojuling_zhujiemianbaijin f_fabaojuling_zhujiemianhong f_fabaojuling_zhujiemianjin
|
|
|
|
|
self.itemPreList[go].mask2 = Util.GetGameObject(self.itemPreList[go].bg.transform,"slider/mask2"):GetComponent("Image") --根据品质变化的图片 f_fabaojuling_zhujiemianbaijin f_fabaojuling_zhujiemianhong f_fabaojuling_zhujiemianjin
|
|
|
|
|
self.itemPreList[go].nameText = Util.GetGameObject(self.itemPreList[go].obj,"bg/nameDi"):GetComponent("Image") --名字图片 根据表读取
|
2021-11-16 15:24:17 +08:00
|
|
|
|
self.itemPreList[go].slider = Util.GetGameObject(self.itemPreList[go].obj,"bg/slider"):GetComponent("Slider")
|
|
|
|
|
self.itemPreList[go].progress = Util.GetGameObject(self.itemPreList[go].slider.transform,"progress"):GetComponent("Text")
|
|
|
|
|
self.itemPreList[go].red = Util.GetGameObject(self.itemPreList[go].bg.transform,"red")
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.itemPreList[go].iconList = {}
|
|
|
|
|
for i = 1,4 do
|
|
|
|
|
self.itemPreList[go].iconList[i] = {}
|
|
|
|
|
self.itemPreList[go].iconList[i].go = Util.GetGameObject(self.itemPreList[go].bg.transform,"compGrid/iconDi"..i)
|
|
|
|
|
self.itemPreList[go].iconList[i].icon = Util.GetGameObject(self.itemPreList[go].iconList[i].go.transform,"icon"):GetComponent("Image")
|
2021-11-19 17:08:14 +08:00
|
|
|
|
self.itemPreList[go].iconList[i].effecthong = Util.GetGameObject(self.itemPreList[go].iconList[i].go,"UI_Effect_Kuang_HongSe")
|
|
|
|
|
self.itemPreList[go].iconList[i].effectjin = Util.GetGameObject(self.itemPreList[go].iconList[i].go,"UI_Effect_Kuang_JinSe")
|
2021-11-19 11:33:34 +08:00
|
|
|
|
end
|
2021-11-15 18:24:39 +08:00
|
|
|
|
end
|
|
|
|
|
self.itemPreList[go].data = data
|
|
|
|
|
if not data then
|
|
|
|
|
go.gameObject:SetActive(false)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
go.gameObject:SetActive(true)
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.itemPreList[go].bg.sprite = this.spLoader:LoadSprite(GetTailsmanSoulDiImage[self.itemPreList[go].data.quality].bg)
|
2023-10-30 19:16:17 +08:00
|
|
|
|
--self.itemPreList[go].tip.sprite = this.spLoader:LoadSprite(GetTailsmanSoulDiImage[self.itemPreList[go].data.quality].tip)
|
|
|
|
|
self.itemPreList[go].mask1.sprite = this.spLoader:LoadSprite("f_fabaojuling_huawenbaijin")
|
|
|
|
|
self.itemPreList[go].mask2.sprite = this.spLoader:LoadSprite("f_fabaojuling_huawenbaijin")
|
2021-11-19 11:33:34 +08:00
|
|
|
|
self.itemPreList[go].nameText.sprite = this.spLoader:LoadSprite(GetResourcePath(self.itemPreList[go].data.icon))
|
2021-11-16 15:24:17 +08:00
|
|
|
|
self.itemPreList[go].slider.value = self.itemPreList[go].data.lv/self.itemPreList[go].data.maxLv
|
|
|
|
|
self.itemPreList[go].progress.text = self.itemPreList[go].data.lv.."/"..self.itemPreList[go].data.maxLv
|
|
|
|
|
self.itemPreList[go].red.gameObject:SetActive(self:CheckRedPoint(self.itemPreList[go].data.trumpList))
|
2023-10-30 19:16:17 +08:00
|
|
|
|
--self.itemPreList[go].effect:SetActive(self.itemPreList[go].data.quality == 6)
|
2021-11-19 17:08:14 +08:00
|
|
|
|
|
2021-11-19 11:33:34 +08:00
|
|
|
|
for i = 1,math.max(#data.trumpList,#self.itemPreList[go].iconList) do
|
|
|
|
|
if not data.trumpList[i] then
|
|
|
|
|
self.itemPreList[go].iconList[i].go.gameObject:SetActive(false)
|
|
|
|
|
else
|
|
|
|
|
self.itemPreList[go].iconList[i].go.gameObject:SetActive(true)
|
|
|
|
|
self.itemPreList[go].iconList[i].icon.sprite = this.spLoader:LoadSprite(GetResourcePath(data.trumpList[i].config.Icon))
|
|
|
|
|
end
|
2021-11-19 17:08:14 +08:00
|
|
|
|
self.itemPreList[go].iconList[i].effecthong.gameObject:SetActive(data.trumpList[i].config.Quality == 6)
|
|
|
|
|
self.itemPreList[go].iconList[i].effectjin.gameObject:SetActive(data.trumpList[i].config.Quality == 5)
|
2021-11-19 11:33:34 +08:00
|
|
|
|
end
|
2021-11-19 17:08:14 +08:00
|
|
|
|
Util.SetParticleSortLayer(go,self.sortingOrder + 1)
|
2023-10-30 19:16:17 +08:00
|
|
|
|
--Util.SetParticleSortLayer(self.itemPreList[go].effect,self.sortingOrder + 1)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
Util.AddOnceClick(go,function()
|
2021-11-16 15:24:17 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.TailsmanSoulMainPanel,self.itemPreList[go].data.id)
|
2021-11-15 18:24:39 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function TailsManSouPanel:CheckRedPoint(data)
|
|
|
|
|
for k,v in pairs(data) do
|
|
|
|
|
local costId,num = TailsManSoulManager.GetTailsmanCost(v.id,v.lv)
|
|
|
|
|
if num and num > 0 then
|
|
|
|
|
if BagManager.GetItemCountById(costId) >= num then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
2021-11-11 16:48:15 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面层级发生改变(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:OnSortingOrderChange()
|
2021-11-19 14:35:42 +08:00
|
|
|
|
for k,v in pairs(self.itemPreList) do
|
2021-11-19 14:39:20 +08:00
|
|
|
|
Util.SetParticleSortLayer(k,self.sortingOrder + 1)
|
2021-11-19 14:35:42 +08:00
|
|
|
|
end
|
2021-11-19 17:08:14 +08:00
|
|
|
|
Util.SetParticleSortLayer(self.effectJin.gameObject,self.sortingOrder + 1)
|
|
|
|
|
Util.SetParticleSortLayer(self.effectHong.gameObject,self.sortingOrder + 1)
|
2021-11-11 16:48:15 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:OnClose()
|
2021-11-19 11:33:34 +08:00
|
|
|
|
|
2021-11-11 16:48:15 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function TailsManSouPanel:OnDestroy()
|
2021-11-15 18:24:39 +08:00
|
|
|
|
this.spLoader:Destroy()
|
|
|
|
|
for k,v in pairs(redPointList) do
|
|
|
|
|
ClearRedPointObject(k,v)
|
|
|
|
|
end
|
|
|
|
|
SubUIManager.Close(self.scroll)
|
|
|
|
|
self.itemPreList = {}
|
|
|
|
|
redPointList = {}
|
2021-11-19 11:33:34 +08:00
|
|
|
|
SubUIManager.Close(self.UpView)
|
|
|
|
|
curPage = 1
|
2023-10-30 15:27:42 +08:00
|
|
|
|
ClearRedPointObject(RedPointType.tailsmanSoul_gold,tabsRedpoints[1].gameObject)
|
|
|
|
|
ClearRedPointObject(RedPointType.tailsmanSoul_red,tabsRedpoints[2].gameObject)
|
|
|
|
|
ClearRedPointObject(RedPointType.tailsmanSoul_whiteGold,tabsRedpoints[3].gameObject)
|
|
|
|
|
ClearRedPointObject(RedPointType.tailsmanSoul_blue,tabsRedpoints[4].gameObject)
|
|
|
|
|
ClearRedPointObject(RedPointType.tailsmanSoul_whiteBlue,tabsRedpoints[5].gameObject)
|
2021-11-11 16:48:15 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return TailsManSouPanel
|