DESKTOP-MMO982B\User 2026-04-12 17:25:07 +08:00
parent eb2172cf6c
commit 8b2a116230
1 changed files with 291 additions and 258 deletions

View File

@ -1,72 +1,76 @@
----- 魂印主面板 ----- ----- 魂印主面板 -----
require("Base/BasePanel") require("Base/BasePanel")
GodPrintPanel = Inherit(BasePanel) GodPrintPanel = Inherit(BasePanel)
local this = GodPrintPanel local this = GodPrintPanel
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local equipConfig=ConfigManager.GetConfig(ConfigName.EquipConfig) local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local equipSignSetting = ConfigManager.GetConfig(ConfigName.EquipSignSetting) local equipSignSetting = ConfigManager.GetConfig(ConfigName.EquipSignSetting)
--循环布局容器 -- 循环布局容器
local loopList={} local loopList = {}
--最大槽位数量 -- 最大槽位数量
local loopCount=0 local loopCount = 0
--可装备槽位数量 -- 可装备槽位数量
local didLen=0 local didLen = 0
--动态最大等级 -- 动态最大等级
local didLv=0 local didLv = 0
--配置最大等级 -- 配置最大等级
local maxLv=0 local maxLv = 0
--间隔角度 -- 间隔角度
local angle=270 local angle = 0
--半径 -- 半径
local radius=250 local radius = 285
local curHeroData--当前英雄信息 local curHeroData -- 当前英雄信息
local heroDatas--全部英雄数据 local heroDatas -- 全部英雄数据
local index=0--当前索引 local index = 0 -- 当前索引
local isShow=true--默认显示装备中的魂印 local isShow = true -- 默认显示装备中的魂印
local _specialData={} local _specialData = {}
local isUpZhen = false local isUpZhen = false
local list={} local list = {}
local teamHero = {} local teamHero = {}
local isPlayAnim = true local isPlayAnim = true
local isFristOpenTime local isFristOpenTime
function GodPrintPanel:InitComponent() function GodPrintPanel:InitComponent()
this.spLoader = SpriteLoader.New() this.spLoader = SpriteLoader.New()
this.upView = SubUIManager.Open(SubUIConfig.UpView, this.gameObject.transform, { showType = UpViewOpenType.ShowLeft}) this.upView = SubUIManager.Open(SubUIConfig.UpView, this.gameObject.transform, {
this.helpBtn= Util.GetGameObject(this.gameObject, "HelpBtn") showType = UpViewOpenType.ShowLeft
this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition })
this.helpBtn = Util.GetGameObject(this.gameObject, "HelpBtn")
this.helpPosition = this.helpBtn:GetComponent("RectTransform").localPosition
this.leftBtn = Util.GetGameObject(this.gameObject, "LeftBtn") this.leftBtn = Util.GetGameObject(this.gameObject, "LeftBtn")
this.rightBtn = Util.GetGameObject(this.gameObject, "RightBtn") this.rightBtn = Util.GetGameObject(this.gameObject, "RightBtn")
this.handBookBtn=Util.GetGameObject(this.gameObject,"HandBookBtn")--图鉴按钮 this.handBookBtn = Util.GetGameObject(this.gameObject, "HandBookBtn") -- 图鉴按钮
this.detailsBtn=Util.GetGameObject(this.gameObject,"DetailsBtn")--细节按钮 this.detailsBtn = Util.GetGameObject(this.gameObject, "DetailsBtn") -- 细节按钮
this.showBtn=Util.GetGameObject(this.gameObject,"ShowBtn")--显示装备中的魂印按钮 this.showBtn = Util.GetGameObject(this.gameObject, "ShowBtn") -- 显示装备中的魂印按钮
this.showBtnOn=Util.GetGameObject(this.showBtn,"Bg/On"):GetComponent("Image") this.showBtnOn = Util.GetGameObject(this.showBtn, "Bg/On"):GetComponent("Image")
this.showBtn:SetActive(false) this.showBtn:SetActive(false)
this.backBtn = Util.GetGameObject(this.gameObject, "BackBtn/btnBack") this.backBtn = Util.GetGameObject(this.gameObject, "BackBtn/btnBack")
this.empty=Util.GetGameObject(this.gameObject,"Empty") this.empty = Util.GetGameObject(this.gameObject, "Empty")
this.emptyTxt=Util.GetGameObject(this.gameObject,"Empty/talkImage/Text"):GetComponent("Text") this.emptyTxt = Util.GetGameObject(this.gameObject, "Empty/talkImage/Text"):GetComponent("Text")
this.emptyTxt.text=Language[12325] this.emptyTxt.text = Language[12325]
--循环布局根节点 -- 循环布局根节点
this.loopRoot=Util.GetGameObject(this.gameObject,"LoopRoot") this.loopRoot = Util.GetGameObject(this.gameObject, "LoopRoot")
this.loopPre=Util.GetGameObject(this.loopRoot,"Pre") this.loopPre = Util.GetGameObject(this.loopRoot, "Pre")
--英雄头像 -- 英雄头像
this.heroFrame=Util.GetGameObject(this.gameObject,"Hero/Frame"):GetComponent("Image") this.heroFrame = Util.GetGameObject(this.gameObject, "Hero/Frame"):GetComponent("Image")
this.heroIcon=Util.GetGameObject(this.gameObject,"Hero/Icon"):GetComponent("Image") this.heroIcon = Util.GetGameObject(this.gameObject, "Hero/Icon"):GetComponent("Image")
--战力 -- 战力
this.power=Util.GetGameObject(this.gameObject,"Power/Value"):GetComponent("Text") this.power = Util.GetGameObject(this.gameObject, "Power/Value"):GetComponent("Text")
this.scrollBar=Util.GetGameObject(this.gameObject, "Scrollbar"):GetComponent("Scrollbar") this.scrollBar = Util.GetGameObject(this.gameObject, "Scrollbar"):GetComponent("Scrollbar")
--魂印列表 -- 魂印列表
this.scrollRoot=Util.GetGameObject(this.gameObject,"ScrollRoot") this.scrollRoot = Util.GetGameObject(this.gameObject, "ScrollRoot")
this.scrollPre=Util.GetGameObject(this.gameObject,"ScrollRoot/Pre") this.scrollPre = Util.GetGameObject(this.gameObject, "ScrollRoot/Pre")
this.scrollView=SubUIManager.Open(SubUIConfig.ScrollCycleView,this.scrollRoot.transform,this.scrollPre, this.scrollBar,-- this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollRoot.transform, this.scrollPre,
Vector2.New(this.scrollRoot.transform.rect.width,this.scrollRoot.transform.rect.height),1,5,Vector2.New(45,40)) this.scrollBar, --
this.scrollView.gameObject:GetComponent("RectTransform").anchoredPosition= Vector2.New(0,0) Vector2.New(this.scrollRoot.transform.rect.width, this.scrollRoot.transform.rect.height), 1, 5,
Vector2.New(45, 40))
this.scrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 0)
this.scrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5) 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").anchorMax = Vector2.New(0.5, 0.5)
this.scrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5) this.scrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
@ -75,40 +79,41 @@ function GodPrintPanel:InitComponent()
this.SetIsShow() this.SetIsShow()
-- this.BgMask = Util.GetGameObject(this.gameObject,"bgMask") -- this.BgMask = Util.GetGameObject(this.gameObject,"bgMask")
end end
-- function GodPrintPanel:SetSortingOrder() -- function GodPrintPanel:SetSortingOrder()
-- end -- end
function GodPrintPanel:BindEvent() function GodPrintPanel:BindEvent()
--帮助按钮 -- 帮助按钮
Util.AddClick(this.helpBtn, function() Util.AddClick(this.helpBtn, function()
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.GodPrint,this.helpPosition.x,this.helpPosition.y) UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.GodPrint, this.helpPosition.x, this.helpPosition.y)
end) end)
--向左切换英雄数据 -- 向左切换英雄数据
Util.AddClick(this.leftBtn, function() Util.AddClick(this.leftBtn, function()
isPlayAnim = true isPlayAnim = true
this.OnLeftBtnClick() this.OnLeftBtnClick()
end) end)
--向右切换英雄数据 -- 向右切换英雄数据
Util.AddClick(this.rightBtn, function() Util.AddClick(this.rightBtn, function()
isPlayAnim = true isPlayAnim = true
this.OnRightBtnClick() this.OnRightBtnClick()
end) end)
--点击图鉴按钮 -- 点击图鉴按钮
Util.AddClick(this.handBookBtn, function() Util.AddClick(this.handBookBtn, function()
UIManager.OpenPanel(UIName.GodPrintHandBook) UIManager.OpenPanel(UIName.GodPrintHandBook)
end) end)
--点击细节按钮 -- 点击细节按钮
Util.AddClick(this.detailsBtn, function() Util.AddClick(this.detailsBtn, function()
--UIManager.OpenPanel(UIName.GodPrintPopUpV2,1,curHeroData) -- UIManager.OpenPanel(UIName.GodPrintPopUpV2,1,curHeroData)
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.GodPrint,this.helpPosition.x,this.helpPosition.y) UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.GodPrint, this.helpPosition.x, this.helpPosition.y)
end) end)
--点击显示装备中魂印按钮 -- 点击显示装备中魂印按钮
Util.AddClick(this.showBtn, function() Util.AddClick(this.showBtn, function()
isShow=(not isShow and true or false) isShow = (not isShow and true or false)
this.showBtnOn.enabled= isShow this.showBtnOn.enabled = isShow
this.SetScrollData() this.SetScrollData()
end) end)
--关闭页面 -- 关闭页面
Util.AddClick(this.backBtn, function() Util.AddClick(this.backBtn, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel) PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel() self:ClosePanel()
@ -122,27 +127,28 @@ end
function GodPrintPanel:RemoveListener() function GodPrintPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.GetNewItemIncarnation, this.SetScrollData) Game.GlobalEvent:RemoveEvent(GameEvent.Bag.GetNewItemIncarnation, this.SetScrollData)
end end
function GodPrintPanel:OnSortingOrderChange() function GodPrintPanel:OnSortingOrderChange()
--特效层级重设 -- 特效层级重设
for _, v in pairs(list) do for _, v in pairs(list) do
Util.SetParticleSortLayer(v, self.sortingOrder) Util.SetParticleSortLayer(v, self.sortingOrder)
end end
end end
function GodPrintPanel:OnOpen(_curHeroData,_heroDatas) function GodPrintPanel:OnOpen(_curHeroData, _heroDatas)
curHeroData=_curHeroData curHeroData = _curHeroData
heroDatas = {} heroDatas = {}
if _heroDatas then if _heroDatas then
for i = 1, #_heroDatas do for i = 1, #_heroDatas do
if GodPrintManager.GetSoulPrintIsOpen(_heroDatas[i]) then if GodPrintManager.GetSoulPrintIsOpen(_heroDatas[i]) then
table.insert(heroDatas,_heroDatas[i]) table.insert(heroDatas, _heroDatas[i])
end end
end end
else else
local curheroListData=HeroManager.GetAllHeroDatas() local curheroListData = HeroManager.GetAllHeroDatas()
for i = 1, #curheroListData do for i = 1, #curheroListData do
if GodPrintManager.GetSoulPrintIsOpen(curheroListData[i]) then if GodPrintManager.GetSoulPrintIsOpen(curheroListData[i]) then
table.insert(heroDatas,curheroListData[i]) table.insert(heroDatas, curheroListData[i])
end end
end end
end end
@ -153,24 +159,25 @@ function GodPrintPanel:OnOpen(_curHeroData,_heroDatas)
break break
end end
end end
end end
function GodPrintPanel:OnShow() function GodPrintPanel:OnShow()
isPlayAnim = true isPlayAnim = true
this.upView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main }) this.upView:OnOpen({
--已激活魂印的Hero为1时 隐藏左右按钮 showType = UpViewOpenType.ShowLeft,
this.leftBtn.gameObject:SetActive(#heroDatas>1) panelType = PanelType.Main
this.rightBtn.gameObject:SetActive(#heroDatas>1) })
-- 已激活魂印的Hero为1时 隐藏左右按钮
this.leftBtn.gameObject:SetActive(#heroDatas > 1)
this.rightBtn.gameObject:SetActive(#heroDatas > 1)
this.RefreshShow() this.RefreshShow()
end end
function GodPrintPanel:OnClose() function GodPrintPanel:OnClose()
angle=270 angle = 0
loopCount=0 loopCount = 0
local var=isShow and 1 or 0 local var = isShow and 1 or 0
PlayerPrefs.SetInt(PlayerManager.uid .. "_GodPrint_IsShow",var) PlayerPrefs.SetInt(PlayerManager.uid .. "_GodPrint_IsShow", var)
if isFristOpenTime then if isFristOpenTime then
isFristOpenTime:Stop() isFristOpenTime:Stop()
isFristOpenTime = nil isFristOpenTime = nil
@ -180,36 +187,36 @@ end
function GodPrintPanel:OnDestroy() function GodPrintPanel:OnDestroy()
this.spLoader:Destroy() this.spLoader:Destroy()
SubUIManager.Close(this.upView) SubUIManager.Close(this.upView)
this.scrollView=nil this.scrollView = nil
loopList={} loopList = {}
list={} list = {}
end end
--点击左 -- 点击左
function this.OnLeftBtnClick() function this.OnLeftBtnClick()
index = (index - 1 > 0 and index - 1 or #heroDatas) index = (index - 1 > 0 and index - 1 or #heroDatas)
curHeroData = heroDatas[index] curHeroData = heroDatas[index]
this.RefreshShow() this.RefreshShow()
end end
--点击右
-- 点击右
function this.OnRightBtnClick() function this.OnRightBtnClick()
index = (index + 1 <= #heroDatas and index + 1 or 1) index = (index + 1 <= #heroDatas and index + 1 or 1)
curHeroData = heroDatas[index] curHeroData = heroDatas[index]
this.RefreshShow() this.RefreshShow()
end end
-- 刷新显示
--刷新显示
function this.RefreshShow() function this.RefreshShow()
--LogGreen("刷新魂印面板") -- LogGreen("刷新魂印面板")
teamHero = FormationManager.GetAllMainFormationHeroId() teamHero = FormationManager.GetAllMainFormationHeroId()
isUpZhen = teamHero[curHeroData.dynamicId] and true or false isUpZhen = teamHero[curHeroData.dynamicId] and true or false
this.SetLoopUI() this.SetLoopUI()
this.SetHero() this.SetHero()
this.SetScrollData() this.SetScrollData()
--对比战力并更新战力值 播放战力变更动画 -- 对比战力并更新战力值 播放战力变更动画
local allAddProVal local allAddProVal
--计算面板属性 -- 计算面板属性
local WarPower local WarPower
if isUpZhen then if isUpZhen then
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL) allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
@ -221,82 +228,96 @@ function this.RefreshShow()
this.power.text = WarPower this.power.text = WarPower
end end
--设置环形布局 -- 设置环形布局
function this.SetLoopUI() function this.SetLoopUI()
local didLv=0 local didLv = 0
--最终最大等级 -- 最终最大等级
local maxLv = 0 local maxLv = 0
loopCount,didLen,didLv,maxLv= HeroManager.GetGodPrintLoopUIMaxData(curHeroData.star) loopCount, didLen, didLv, maxLv = HeroManager.GetGodPrintLoopUIMaxData(curHeroData.lv)
-- LogBlue("最大槽位数量"..loopCount.." 可装备槽位数量"..didLen.." 最大动态等级"..didLv.." 配置最大等级"..maxLv) -- LogBlue("最大槽位数量"..loopCount.." 可装备槽位数量"..didLen.." 最大动态等级"..didLv.." 配置最大等级"..maxLv)
local d = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 149).Value, "#") local d = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 149).Value, "#")
loopCount=#d loopCount = #d
--初始化 -- 初始化
for i=1,#d do for i = 1, #d do
if not loopList[i] then if not loopList[i] then
loopList[i]=newObjToParent(this.loopPre,this.loopRoot) loopList[i] = newObjToParent(this.loopPre, this.loopRoot)
end end
loopList[i].name="Pre"..i loopList[i].name = "Pre" .. i
end end
--设置不包含最后一位 为默认 -- 设置不包含最后一位 为默认
for j=1,#d do for j = 1, #d do
loopList[j]:GetComponent("RectTransform").anchoredPosition = this.GetCurPosByIndex(j) loopList[j]:GetComponent("RectTransform").anchoredPosition = this.GetCurPosByIndex(j)
if curHeroData.star>=tonumber(d[j]) then -- 由星级限制修改为鸿蒙等级限制
this.SetLoopPre(loopList[j],1,nil,nil,j) local harmony = HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv)
if (harmony and harmony.value >= tonumber(d[j])) or 1 >= tonumber(d[j]) then
-- if curHeroData.star >= tonumber(d[j]) then
this.SetLoopPre(loopList[j], 1, nil, nil, j)
else else
this.SetLoopPre(loopList[j],2,nil,tonumber(d[j]),j) this.SetLoopPre(loopList[j], 2, nil, tonumber(d[j]), j)
end end
end end
--数据赋值 -- 数据赋值
--LogError("#curHeroData.godPrintList=="..#curHeroData.godPrintList) -- LogError("#curHeroData.godPrintList=="..#curHeroData.godPrintList)
for k=1,#curHeroData.godPrintList do for k = 1, #curHeroData.godPrintList do
local index=curHeroData.godPrintList[k].position local index = curHeroData.godPrintList[k].position
this.SetLoopPre(loopList[index],3,index,curHeroData.godPrintList[k]) this.SetLoopPre(loopList[index], 3, index, curHeroData.godPrintList[k])
end end
end end
--获取当前子布局坐标
-- 获取当前子布局坐标
function this.GetCurPosByIndex(index) function this.GetCurPosByIndex(index)
local hudu=(angle/180)*Mathf.PI local hudu = (angle / 180) * Mathf.PI
angle=angle+(360/loopCount) angle = angle + (360 / loopCount)
return Vector2.New(radius*Mathf.Cos(hudu),radius*Mathf.Sin(hudu)) return Vector2.New(radius * Mathf.Cos(hudu), radius * Mathf.Sin(hudu))
end end
--设置环形布局预设 root:预设根节点 type:开启类型 index 位置 data:数据
function this.SetLoopPre(root,type,index,data,curIndex) -- 设置环形布局预设 root:预设根节点 type:开启类型 index 位置 data:数据
local normal= Util.GetGameObject(root,"Normal") function this.SetLoopPre(root, type, index, data, curIndex)
local lock= Util.GetGameObject(root,"Lock") local normal = Util.GetGameObject(root, "Normal")
local unlock= Util.GetGameObject(root,"UnLock") local lock = Util.GetGameObject(root, "Lock")
local bg=Util.GetGameObject(root,"Bg") local unlock = Util.GetGameObject(root, "UnLock")
local lvTxt= Util.GetGameObject(root,"lv"):GetComponent("Text") local bg = Util.GetGameObject(root, "Bg")
local lvTxt = Util.GetGameObject(root, "lv"):GetComponent("Text")
lvTxt.gameObject:SetActive(false) lvTxt.gameObject:SetActive(false)
Util.GetGameObject(bg,"Frame"):GetComponent("Image").enabled=false Util.GetGameObject(bg, "Frame"):GetComponent("Image").enabled = false
if curIndex then if curIndex then
bg.transform:DORotate(Vector3.New(0,0,(360/loopCount)*(curIndex-1) + root.transform.localRotation.z-90),0) bg.transform:DORotate(Vector3.New(0, 0, (360 / loopCount) * (curIndex - 1) + root.transform.localRotation.z), 0)
end end
normal:SetActive(type==1) --解锁 未装备 normal:SetActive(type == 1) -- 解锁 未装备
lock:SetActive(type==2) --锁定 lock:SetActive(type == 2) -- 锁定
unlock:SetActive(type==3) --解锁装备魂印 unlock:SetActive(type == 3) -- 解锁装备魂印
root:GetComponent("Button").interactable=type==3--只有被赋值的按钮才能点击 root:GetComponent("Button").interactable = type == 3 -- 只有被赋值的按钮才能点击
if type==1 then if type == 1 then
-- Util.GetGameObject(bg,"bg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[0].circleBg1) Util.GetGameObject(bg, "bg"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
elseif type==2 then SoulPrintSpriteByQuantity[0].circleBg1)
Util.GetGameObject(bg,"bg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[0].circleBg1) elseif type == 2 then
Util.GetGameObject(lock,"Text"):GetComponent("Text").text=string.format("%s星解锁",data) Util.GetGameObject(bg, "bg"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
elseif type==3 then SoulPrintSpriteByQuantity[0].circleBg1)
--Util.GetGameObject(bg,"Frame"):GetComponent("Image").enabled=true -- Util.GetGameObject(lock, "Text"):GetComponent("Text").text = string.format(Language[11165], data)
-- Util.GetGameObject(bg,"bg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[equipConfig[data.equipId].Quality].circleBg1) -- Util.GetGameObject(lock, "Text"):GetComponent("Text").text = string.format(Language[11165], data)
--Util.GetGameObject(bg,"Frame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetQuantityImageByqualityPoint(equipConfig[data.equipId].Quality)) Util.GetGameObject(lock, "Text"):GetComponent("Text").text =
Util.GetGameObject(unlock,"circleFrame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[equipConfig[data.equipId].Quality].circleBg2) string.format(GetLanguageStrById("伙伴共鸣%s级解锁"), data)
Util.GetGameObject(unlock,"Icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.equipId].ResourceID)) elseif type == 3 then
Util.GetGameObject(unlock,"circle"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[equipConfig[data.equipId].Quality].circle) -- Util.GetGameObject(bg,"Frame"):GetComponent("Image").enabled=true
Util.GetGameObject(unlock,"Name"):GetComponent("Text").text=GetLanguageStrById(itemConfig[data.equipId].Name) Util.GetGameObject(bg, "bg"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
lvTxt.gameObject:SetActive(equipConfig[data.equipId].Star>0) SoulPrintSpriteByQuantity[equipConfig[data.equipId].Quality].circleBg1)
lvTxt.text="+"..equipConfig[data.equipId].Star -- Util.GetGameObject(bg,"Frame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetQuantityImageByqualityPoint(equipConfig[data.equipId].Quality))
Util.AddOnceClick(root,function() Util.GetGameObject(unlock, "circleFrame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
local pos=index SoulPrintSpriteByQuantity[equipConfig[data.equipId].Quality].circleBg2)
LogBlue("卸下时 "..data.equipId) Util.GetGameObject(unlock, "Icon"):GetComponent("Image").sprite =
UIManager.OpenPanel(UIName.GodPrintPopUp,2,curHeroData.dynamicId,data.equipId,pos,function() this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.equipId].ResourceID))
Util.GetGameObject(unlock, "circle"):GetComponent("Image").sprite = this.spLoader:LoadSprite(
SoulPrintSpriteByQuantity[equipConfig[data.equipId].Quality].circle)
Util.GetGameObject(unlock, "Name"):GetComponent("Text").text = GetLanguageStrById(itemConfig[data.equipId].Name)
lvTxt.gameObject:SetActive(equipConfig[data.equipId].Star > 0)
lvTxt.text = "+" .. equipConfig[data.equipId].Star
Util.AddOnceClick(root, function()
local pos = index
LogBlue("卸下时 " .. data.equipId)
UIManager.OpenPanel(UIName.GodPrintPopUp, 2, curHeroData.dynamicId, data.equipId, pos, function()
this.RefreshShow() this.RefreshShow()
--对比战力并更新战力值 播放战力变更动画 -- 对比战力并更新战力值 播放战力变更动画
HeroManager.CompareWarPower(curHeroData.dynamicId) HeroManager.CompareWarPower(curHeroData.dynamicId)
LogError("刷新完界面数据") LogError("刷新完界面数据")
end) end)
@ -304,13 +325,14 @@ function this.SetLoopPre(root,type,index,data,curIndex)
end end
end end
--设置英雄 -- 设置英雄
function this.SetHero() function this.SetHero()
this.heroIcon.sprite=this.spLoader:LoadSprite(curHeroData.icon) this.heroIcon.sprite = this.spLoader:LoadSprite(curHeroData.icon)
this.heroFrame.sprite=this.spLoader:LoadSprite(GetHeroQuantityImageByquality(curHeroData.heroConfig.Quality,curHeroData.star)) this.heroFrame.sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(curHeroData.heroConfig.Quality,
curHeroData.star))
-- local allPro = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false) -- local allPro = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false)
local WarPower local WarPower
--计算面板属性 -- 计算面板属性
if isUpZhen then if isUpZhen then
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL) WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else else
@ -319,27 +341,26 @@ function this.SetHero()
this.power.text = WarPower this.power.text = WarPower
end end
-- 设置装备中的魂印
--设置装备中的魂印
function this.SetIsShow() function this.SetIsShow()
if PlayerPrefs.GetInt(PlayerManager.uid .. "_GodPrint_IsShow") then if PlayerPrefs.GetInt(PlayerManager.uid .. "_GodPrint_IsShow") then
isShow=PlayerPrefs.GetInt(PlayerManager.uid .. "_GodPrint_IsShow")==1 isShow = PlayerPrefs.GetInt(PlayerManager.uid .. "_GodPrint_IsShow") == 1
else else
isShow=true isShow = true
end end
this.showBtnOn.enabled=isShow this.showBtnOn.enabled = isShow
end end
--设置魂印列表滚动条 -- 设置魂印列表滚动条
function this.SetScrollData() function this.SetScrollData()
local data =GodPrintManager.GetAllSoulPrint(isShow,curHeroData.id,curHeroData.dynamicId,curHeroData) local data = GodPrintManager.GetAllSoulPrint(isShow, curHeroData.id, curHeroData.dynamicId, curHeroData)
this.empty:SetActive(#data==0) this.empty:SetActive(#data == 0)
this.ShowRedPotDataAndSort(data) this.ShowRedPotDataAndSort(data)
this.scrollView:SetData(data,function(index,root) this.scrollView:SetData(data, function(index, root)
this.SetScrollPre(root,data[index]) this.SetScrollPre(root, data[index])
list[root] = root list[root] = root
end,true,true) end, true, true)
if isPlayAnim then if isPlayAnim then
if isFristOpenTime then if isFristOpenTime then
isFristOpenTime:Stop() isFristOpenTime:Stop()
@ -354,102 +375,113 @@ function this.SetScrollData()
end end
this.scrollView:SetIndex(1) this.scrollView:SetIndex(1)
end end
--设置魂印列表预设
function this.SetScrollPre(root,data)
-- 设置魂印列表预设
function this.SetScrollPre(root, data)
Util.SetParticleSortLayer(root, this.sortingOrder + 1) Util.SetParticleSortLayer(root, this.sortingOrder + 1)
SetSoulEffect(itemConfig[data.id].Quantity1, root) SetSoulEffect(itemConfig[data.id].Quantity1, root)
local frame=Util.GetGameObject(root,"Frame"):GetComponent("Image") local frame = Util.GetGameObject(root, "Frame"):GetComponent("Image")
local icon=Util.GetGameObject(root,"Icon"):GetComponent("Image") local icon = Util.GetGameObject(root, "Icon"):GetComponent("Image")
local name=Util.GetGameObject(root,"Name"):GetComponent("Text") local name = Util.GetGameObject(root, "Name"):GetComponent("Text")
local hero=Util.GetGameObject(root,"Hero") local hero = Util.GetGameObject(root, "Hero")
local heroIcon=Util.GetGameObject(hero,"Icon"):GetComponent("Image") local heroIcon = Util.GetGameObject(hero, "Icon"):GetComponent("Image")
local circle=Util.GetGameObject(root,"circle"):GetComponent("Image") local circle = Util.GetGameObject(root, "circle"):GetComponent("Image")
local equipped=Util.GetGameObject(root,"Equipped") --是否已装备 local equipped = Util.GetGameObject(root, "Equipped") -- 是否已装备
local lvTxt=Util.GetGameObject(root,"lv"):GetComponent("Text") local lvTxt = Util.GetGameObject(root, "lv"):GetComponent("Text")
Util.GetGameObject(root,"limit"):SetActive(equipConfig[data.id].limit == 1 and not GodPrintManager.GetCurGodPrintIsCanUp(data.id) and data.upHero=="") Util.GetGameObject(root, "limit"):SetActive(equipConfig[data.id].limit == 1 and
frame.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(equipConfig[data.id].Quality)) not GodPrintManager.GetCurGodPrintIsCanUp(data.id) and data.upHero ==
circle.sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[equipConfig[data.id].Quality].circle) "")
icon.sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID)) frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(equipConfig[data.id].Quality))
name.text=SubString2(GetLanguageStrById(equipConfig[data.id].Name),8) circle.sprite = this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[equipConfig[data.id].Quality].circle)
hero.gameObject:SetActive(data.upHero~="") icon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID))
lvTxt.gameObject:SetActive(equipConfig[data.id].Star>0) name.text = SubString2(GetLanguageStrById(equipConfig[data.id].Name), 8)
lvTxt.text="+"..equipConfig[data.id].Star hero.gameObject:SetActive(data.upHero ~= "")
Util.GetGameObject(root,"redPoint"):SetActive(data.isShowRedPot == 1) lvTxt.gameObject:SetActive(equipConfig[data.id].Star > 0)
lvTxt.text = "+" .. equipConfig[data.id].Star
Util.GetGameObject(root, "redPoint"):SetActive(data.isShowRedPot == 1)
equipped.gameObject:SetActive(this.GetCurHeroSoulPrintState(data.id)) equipped.gameObject:SetActive(this.GetCurHeroSoulPrintState(data.id))
if data.upHero~="" then if data.upHero ~= "" then
local heroData = HeroManager.GetSingleHeroData(data.upHero) local heroData = HeroManager.GetSingleHeroData(data.upHero)
local heroId= heroData.id local heroId = heroData.id
--LogGreen(heroId) -- LogGreen(heroId)
heroIcon.sprite=this.spLoader:LoadSprite(heroData.icon) heroIcon.sprite = this.spLoader:LoadSprite(heroData.icon)
end end
--点击事件(穿戴或替换魂印) -- 点击事件(穿戴或替换魂印)
Util.AddOnceClick(root,function() Util.AddOnceClick(root, function()
if not GodPrintManager.GetCurGodPrintIsCanUp(data.id) and data.upHero=="" then if not GodPrintManager.GetCurGodPrintIsCanUp(data.id) and data.upHero == "" then
PopupTipPanel.ShowTip("该神印只能装备一个") PopupTipPanel.ShowTip(Language[11166])
return return
end end
if this.GetCurHeroSoulPrintState(data.id) then if this.GetCurHeroSoulPrintState(data.id) then
PopupTipPanel.ShowTip("该神印只能装备一个") PopupTipPanel.ShowTip(Language[11166])
return return
end end
local pos=this.GetPos()--位置 local pos = this.GetPos() -- 位置
local oldPower = HeroManager.GetSingleHeroData(curHeroData.dynamicId).warPower local oldPower = HeroManager.GetSingleHeroData(curHeroData.dynamicId).warPower
UIManager.OpenPanel(UIName.GodPrintPopUp,1,curHeroData.dynamicId,data.id,pos,function() UIManager.OpenPanel(UIName.GodPrintPopUp, 1, curHeroData.dynamicId, data.id, pos, function()
-- if curHeroData.dynamicId then -- if curHeroData.dynamicId then
-- PopupTipPanel.ShowTip(Language[11526]) -- PopupTipPanel.ShowTip("装备成功!")
-- end -- end
this.RefreshShow() this.RefreshShow()
--对比战力并更新战力值 播放战力变更动画 -- 对比战力并更新战力值 播放战力变更动画
HeroManager.CompareWarPower1(curHeroData.dynamicId,oldPower) HeroManager.CompareWarPower1(curHeroData.dynamicId, oldPower)
end,data) end, data)
-- end -- end
end) end)
end end
--自动获取魂印的位置 如果有位置返回位置 如果没位置返回0 -- 自动获取魂印的位置 如果有位置返回位置 如果没位置返回0
function this.GetPos() function this.GetPos()
local _data={} local _data = {}
for k=1,loopCount do for k = 1, loopCount do
if Util.GetGameObject(loopList[k].gameObject,"UnLock").activeSelf then if Util.GetGameObject(loopList[k].gameObject, "UnLock").activeSelf then
table.insert(_data,k,k) table.insert(_data, k, k)
end end
end end
for i = 1, loopCount do
if _data[i]==nil then
return i
end
if didLen == LengthOfTable(_data) then if didLen == LengthOfTable(_data) then
-- LogError("ssssssssssssssssss"..tostring(loopCount).."/"..tostring(didLen).."/"..tostring( LengthOfTable(_data)))
return 0 return 0
end end
for i = 1, loopCount do
if _data[i] == nil then
-- LogError("ssssssssssssssssss"..tostring(loopCount).."/"..tostring(didLen).."/"..tostring( LengthOfTable(_data)))
return i
end
end end
end end
function this.ShowRedPotDataAndSort(allData) function this.ShowRedPotDataAndSort(allData)
if curHeroData.godPrintList and #curHeroData.godPrintList >= 3 then if curHeroData.godPrintList and #curHeroData.godPrintList >= 3 then
table.sort(allData, function(a,b) table.sort(allData, function(a, b)
if this.GetCurHeroSoulPrintState(a.id) == this.GetCurHeroSoulPrintState(b.id) then
if equipConfig[a.id].Quality == equipConfig[b.id].Quality then if equipConfig[a.id].Quality == equipConfig[b.id].Quality then
return a.id > b.id return a.id > b.id
else else
return equipConfig[a.id].Quality > equipConfig[b.id].Quality return equipConfig[a.id].Quality > equipConfig[b.id].Quality
end end
elseif this.GetCurHeroSoulPrintState(a.id) == false and this.GetCurHeroSoulPrintState(b.id) then
return true
else
return false
end
end) end)
return return
end end
local allUpSoulPrint = {}--所有已上魂印 local allUpSoulPrint = {} -- 所有已上魂印
if curHeroData.godPrintList then if curHeroData.godPrintList then
for i = 1, #curHeroData.godPrintList do for i = 1, #curHeroData.godPrintList do
local equip=equipConfig[curHeroData.godPrintList[i].equipId] local equip = equipConfig[curHeroData.godPrintList[i].equipId]
-- allUpSoulPrint[curHeroData.godPrintList[i].equipId] = equip --curHeroData.godPrintList[i] -- allUpSoulPrint[curHeroData.godPrintList[i].equipId] = equip --curHeroData.godPrintList[i]
--LogError("equip.SuiteID=="..equip.SuiteID) -- LogError("equip.SuiteID=="..equip.SuiteID)
table.insert(allUpSoulPrint, equip.SuiteID) table.insert(allUpSoulPrint, equip.SuiteID)
end end
end end
--LogError("allUpSoulPrint "..LengthOfTable(allUpSoulPrint).." "..#allData) -- LogError("allUpSoulPrint "..LengthOfTable(allUpSoulPrint).." "..#allData)
local haveRedPointSid = {}--所有已标记红点魂印 local haveRedPointSid = {} -- 所有已标记红点魂印
local temp=GodPrintManager.GetAllSoulPrint(true,curHeroData.id,curHeroData.dynamicId,curHeroData) local temp = GodPrintManager.GetAllSoulPrint(true, curHeroData.id, curHeroData.dynamicId, curHeroData)
local limitSoulPrint = {} local limitSoulPrint = {}
for i = 1, #temp do for i = 1, #temp do
if not limitSoulPrint[temp[i].id] and equipConfig[temp[i].id].limit == 1 and temp[i].upHero ~= "" then if not limitSoulPrint[temp[i].id] and equipConfig[temp[i].id].limit == 1 and temp[i].upHero ~= "" then
@ -458,29 +490,30 @@ function this.ShowRedPotDataAndSort(allData)
end end
for i = 1, #allData do for i = 1, #allData do
--这个英雄没有装备这个魂印,并且可以装备,并且不在haveRedPointSid列表里 -- 这个英雄没有装备这个魂印,并且可以装备,并且不在haveRedPointSid列表里
allData[i].isShowRedPot = 0 allData[i].isShowRedPot = 0
local suitId=equipConfig[allData[i].id].SuiteID local suitId = equipConfig[allData[i].id].SuiteID
local isHave=false local isHave = false
for k=1, #allUpSoulPrint do for k = 1, #allUpSoulPrint do
if allUpSoulPrint[k]== suitId then if allUpSoulPrint[k] == suitId then
isHave=true isHave = true
end end
end end
local isHaveCurHeroid = HeroManager.CheckHeroIsCanAddGodPrint(equipConfig[allData[i].id].ProfessionLimit,curHeroData) local isHaveCurHeroid = HeroManager.CheckHeroIsCanAddGodPrint(equipConfig[allData[i].id].ProfessionLimit,
local allNum,open=HeroManager.GetGodPrintLoopUIMaxData(curHeroData.star) curHeroData)
--LogError("#curHeroData.godPrintList=="..#curHeroData.godPrintList.." open=="..open.." curHeroData.star=="..curHeroData.star) local allNum, open = HeroManager.GetGodPrintLoopUIMaxData(curHeroData.lv)
if not isHave and isHaveCurHeroid and allData[i].upHero == "" and not haveRedPointSid[suitId] and #curHeroData.godPrintList<open then -- LogError("#curHeroData.godPrintList=="..#curHeroData.godPrintList.." open=="..open.." curHeroData.star=="..curHeroData.star)
allData[i].isShowRedPot = 1--有空位可以穿戴 if not isHave and isHaveCurHeroid and allData[i].upHero == "" and not haveRedPointSid[suitId] and
#curHeroData.godPrintList < open then
allData[i].isShowRedPot = 1 -- 有空位可以穿戴
haveRedPointSid[suitId] = suitId haveRedPointSid[suitId] = suitId
end end
if limitSoulPrint[allData[i].id] then if limitSoulPrint[allData[i].id] then
allData[i].isShowRedPot = 0 allData[i].isShowRedPot = 0
end end
end end
table.sort(allData, function(a,b) table.sort(allData, function(a, b)
if a.isShowRedPot > b.isShowRedPot then if a.isShowRedPot > b.isShowRedPot then
return true return true
elseif a.isShowRedPot == b.isShowRedPot then elseif a.isShowRedPot == b.isShowRedPot then
@ -495,12 +528,12 @@ function this.ShowRedPotDataAndSort(allData)
end) end)
end end
--获取当前英雄是否已装备该魂印 -- 获取当前英雄是否已装备该魂印
function this.GetCurHeroSoulPrintState(id) function this.GetCurHeroSoulPrintState(id)
for k=1,#curHeroData.godPrintList do for k = 1, #curHeroData.godPrintList do
local _id=curHeroData.godPrintList[k].equipId local _id = curHeroData.godPrintList[k].equipId
if equipConfig[_id].SuiteID==equipConfig[id].SuiteID then if equipConfig[_id].SuiteID == equipConfig[id].SuiteID then
return true return true
end end
-- if equipConfig[_id].Id==equipConfig[id].Id then -- if equipConfig[_id].Id==equipConfig[id].Id then