325 lines
15 KiB
Lua
325 lines
15 KiB
Lua
require("Base/BasePanel")
|
|
RewardTalismanSingleShowPopup = Inherit(BasePanel)
|
|
local jewelConfig = ConfigManager.GetConfig(ConfigName.JewelConfig)
|
|
local type
|
|
local dId
|
|
local sId
|
|
local lv
|
|
local refineLv
|
|
local func
|
|
local itemConfig = {}
|
|
--初始化组件(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:InitComponent()
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
self.btnBack = Util.GetGameObject(self.transform, "btnBack")
|
|
self.topBar = Util.GetGameObject(self.transform, "Content/bg/armorInfo")
|
|
self.topBarBg = Util.GetGameObject(self.transform, "Content/bg/armorInfo/bg2")
|
|
self.topBarBgColor = Util.GetGameObject(self.transform, "Content/bg/armorInfo/bg1"):GetComponent("Image")
|
|
self.curEquipName = Util.GetGameObject(self.transform, "Content/bg/armorInfo/EquipName"):GetComponent("Text")
|
|
self.curEquipDesc1 = Util.GetGameObject(self.transform, "Content/bg/armorInfo/infoText"):GetComponent("Text")
|
|
self.curEquipFrame = Util.GetGameObject(self.transform, "Content/bg/armorInfo/frame"):GetComponent("Image")
|
|
self.curEquipIcon = Util.GetGameObject(self.transform, "Content/bg/armorInfo/icon"):GetComponent("Image")
|
|
self.proIcon = Util.GetGameObject(self.transform, "Content/bg/armorInfo/proIcon"):GetComponent("Image")
|
|
self.qualityText = Util.GetGameObject(self.transform, "Content/bg/armorInfo/equipQuaText"):GetComponent("Text")
|
|
self.powerNum1 = Util.GetGameObject(self.transform, "Content/bg/armorInfo/powerNum"):GetComponent("Text")
|
|
self.lv = Util.GetGameObject(self.transform, "Content/bg/armorInfo/lv"):GetComponent("Text")
|
|
self.refineLv = Util.GetGameObject(self.transform, "Content/bg/armorInfo/refineLv"):GetComponent("Text")
|
|
|
|
self.curMainProscroll = Util.GetGameObject(self.transform, "Content/mainProScroll")
|
|
self.curMainProText = Util.GetGameObject(self.transform, "Content/mainProScroll/Text"):GetComponent("Text")
|
|
self.curMainProGrid = Util.GetGameObject(self.transform, "Content/mainProScroll/proGrid")
|
|
self.curotherProscroll = Util.GetGameObject(self.transform, "Content/otherProScroll")
|
|
self.otherProPre = Util.GetGameObject(self.transform, "Content/proPre")
|
|
self.otherProGrid = Util.GetGameObject(self.transform, "Content/otherProScroll/proGrid")
|
|
self.otherProText = Util.GetGameObject(self.transform, "Content/otherProScroll/Text"):GetComponent("Text")
|
|
self.curCastInfo = Util.GetGameObject(self.transform, "Content/skillObject/skillInfo"):GetComponent("Text")
|
|
self.castInfoObject = Util.GetGameObject(self.transform, "Content/skillObject")
|
|
self.castInfoObject:SetActive(false)
|
|
self.btnSure = Util.GetGameObject(self.transform, "Content/bg/btnGrid/btnSure")
|
|
self.btnJump = Util.GetGameObject(self.transform, "Content/bg/btnGrid/btnJump")
|
|
|
|
--装备获取途径
|
|
--this.getTuPre=Util.GetGameObject(self.transform, "Content/bg/getTuPre")
|
|
self.getTuGrid = Util.GetGameObject(self.transform, "Content/bg/scroll/grid")
|
|
self.equipProGridCom = self.getTuGrid:GetComponent("VerticalLayoutGroup")
|
|
|
|
self.equipType = Util.GetGameObject(self.transform, "Content/bg/armorInfo/equipType"):GetComponent("Text")
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:BindEvent()
|
|
Util.AddClick(self.btnBack, function()
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
self:ClosePanel()
|
|
end)
|
|
Util.AddClick(self.btnJump, function()
|
|
-- if itemConfig then
|
|
-- JumpManager.GoJump(itemConfig.UseJump)
|
|
-- end
|
|
JumpManager.GoJump(22001)
|
|
end)
|
|
Util.AddClick(self.btnSure, function()
|
|
-- local curResolveAllItemList={}
|
|
-- table.insert(curResolveAllItemList,dId)
|
|
-- local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. "isTalismanShowSure")
|
|
-- local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
|
-- local haveHighQuality=false
|
|
-- local data = TalismanManager.GetSingleTalismanData(dId)
|
|
-- local itemConfig = data.itemConfig
|
|
-- if(itemConfig.Quantity>=4) then
|
|
-- haveHighQuality=true
|
|
-- end
|
|
-- if (isPopUp ~= currentTime and haveHighQuality) then
|
|
-- MsgPanel.ShowTwo("分解中,包含了史诗及以上的法宝。分解操作不可逆转,确定要进行分解吗?", nil, function(isShow)
|
|
-- if (isShow) then
|
|
-- local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
|
-- RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. "isTalismanShowSure", currentTime)
|
|
-- end
|
|
-- NetManager.UseAndPriceItemRequest(4,curResolveAllItemList,function (drop)
|
|
-- self:SendBackResolveReCallBack(drop)
|
|
-- end)
|
|
-- end, nil, nil, nil, true)
|
|
-- else
|
|
-- NetManager.UseAndPriceItemRequest(4,curResolveAllItemList,function (drop)
|
|
-- self:SendBackResolveReCallBack(drop)
|
|
-- end)
|
|
-- end
|
|
self:ClosePanel()
|
|
JumpManager.GoJump(24005)
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:RemoveListener()
|
|
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:OnOpen(_type, _did, _sId, _lv, _refineLv, _func)
|
|
type = _type
|
|
dId = _did
|
|
sId = _sId
|
|
lv = _lv
|
|
refineLv = _refineLv
|
|
func = _func
|
|
end
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:OnShow()
|
|
if BagManager.isBagPanel then
|
|
self.btnSure:SetActive(true)
|
|
self.btnJump:SetActive(true)
|
|
else
|
|
self.btnSure:SetActive(false)
|
|
self.btnJump:SetActive(false)
|
|
end
|
|
self:OnShowPanelData()
|
|
ForceRebuildLayout(self.curMainProscroll.transform)
|
|
ForceRebuildLayout(self.curotherProscroll.transform)
|
|
end
|
|
|
|
function RewardTalismanSingleShowPopup:OnShowPanelData()
|
|
local curEquipTreasureFigData = {}
|
|
local curEquipTreasureStrongFigData = {}
|
|
local curEquipTreasureSefineFigData = {}
|
|
if type == 1 then
|
|
self.powerNum1.text = EquipTreasureManager.CalculateWarForce(dId)
|
|
local data = EquipTreasureManager.GetSingleTreasureByIdDyn(dId)
|
|
itemConfig = data.itemConfig
|
|
curEquipTreasureFigData = ConfigManager.GetConfigData(ConfigName.JewelConfig, data.id)
|
|
curEquipTreasureStrongFigData, curEquipTreasureSefineFigData = self:GetStrongAndRefineConFig(
|
|
curEquipTreasureFigData, data.lv, data.refineLv)
|
|
else
|
|
self.powerNum1.text = EquipTreasureManager.CalculateWarForceBySid(sId, lv, refineLv)
|
|
itemConfig = ConfigManager.GetConfigData(ConfigName.ItemConfig, sId)
|
|
LogBlue("sId:" .. sId)
|
|
curEquipTreasureFigData = ConfigManager.GetConfigData(ConfigName.JewelConfig, sId)
|
|
curEquipTreasureStrongFigData, curEquipTreasureSefineFigData = self:GetStrongAndRefineConFig(
|
|
curEquipTreasureFigData, lv, refineLv)
|
|
end
|
|
self.curEquipDesc1.text = GetLanguageStrById(itemConfig.ItemDescribe)
|
|
self.equipType.text = string.format(Language[12219],
|
|
curEquipTreasureFigData.Location == 1 and Language[10665] or Language[10666])
|
|
self.qualityText.text = GetStringByEquipQua(itemConfig.Quantity, GetQuaStringByEquipQua(itemConfig.Quantity))
|
|
self.curEquipName.text = GetStringByEquipQua(itemConfig.Quantity, GetLanguageStrById(itemConfig.Name))
|
|
self.topBarBg:GetComponent("Image").sprite = self.spLoader:LoadSprite("t_tongyong_di_" .. itemConfig.Quantity)
|
|
if itemConfig.Quantity == 1 then
|
|
self.topBarBgColor.color = Color.New(0.81, 0.81, 0.81, 1)
|
|
elseif itemConfig.Quantity == 2 then
|
|
self.topBarBgColor.color = Color.New(0.24, 0.34, 0.21, 1)
|
|
elseif itemConfig.Quantity == 3 then
|
|
self.topBarBgColor.color = Color.New(0.22, 0.42, 0.63, 1)
|
|
elseif itemConfig.Quantity == 4 then
|
|
self.topBarBgColor.color = Color.New(0.29, 0.14, 0.26, 1)
|
|
elseif itemConfig.Quantity == 5 then
|
|
self.topBarBgColor.color = Color.New(0.26, 0.14, 0.06, 1)
|
|
elseif itemConfig.Quantity == 6 then
|
|
self.topBarBgColor.color = Color.New(0.25, 0.02, 0.02, 1)
|
|
elseif itemConfig.Quantity == 7 then
|
|
self.topBarBgColor.color = Color.New(0.32, 0.32, 0.32, 1)
|
|
elseif itemConfig.Quantity == 8 then
|
|
self.topBarBgColor.color = Color.New(0.32, 0.32, 0.32, 1)
|
|
end
|
|
if lv > 0 then
|
|
self.lv.gameObject:SetActive(true)
|
|
self.lv.text = curEquipTreasureStrongFigData.Level
|
|
else
|
|
self.lv.gameObject:SetActive(false)
|
|
end
|
|
if refineLv > 0 then
|
|
self.refineLv.gameObject:SetActive(true)
|
|
self.refineLv.text = "+" .. curEquipTreasureSefineFigData.Level
|
|
else
|
|
self.refineLv.gameObject:SetActive(false)
|
|
end
|
|
self.curEquipFrame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig.Quantity))
|
|
self.curEquipIcon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID))
|
|
self.proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(itemConfig.PropertyName))
|
|
--强化属性
|
|
Util.ClearChild(self.curMainProGrid.transform)
|
|
if #curEquipTreasureStrongFigData.Property > 0 then --
|
|
self.curMainProscroll:SetActive(true)
|
|
for i = 1, #curEquipTreasureStrongFigData.Property do
|
|
local go = newObject(self.otherProPre)
|
|
go.transform:SetParent(self.curMainProGrid.transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition = Vector3.zero
|
|
go:SetActive(true)
|
|
local proConFig = ConfigManager.GetConfigData(ConfigName.PropertyConfig,
|
|
curEquipTreasureStrongFigData.Property[i][1])
|
|
if proConFig then
|
|
Util.GetGameObject(go.transform, "proName"):GetComponent("Text").text = GetLanguageStrById(proConFig
|
|
.Info)
|
|
Util.GetGameObject(go.transform, "proVale"):GetComponent("Text").text = "+" ..
|
|
GetEquipPropertyFormatStr(proConFig.Style, curEquipTreasureStrongFigData.Property[i][2])
|
|
end
|
|
end
|
|
else
|
|
self.curMainProscroll:SetActive(false)
|
|
end
|
|
--精炼属性
|
|
Util.ClearChild(self.otherProGrid.transform)
|
|
if curEquipTreasureSefineFigData.Property and #curEquipTreasureSefineFigData.Property > 0 then --
|
|
self.curotherProscroll:SetActive(true)
|
|
for i = 1, #curEquipTreasureSefineFigData.Property do
|
|
local go = newObject(self.otherProPre)
|
|
go.transform:SetParent(self.otherProGrid.transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition = Vector3.zero
|
|
go:SetActive(true)
|
|
local proConFig = ConfigManager.GetConfigData(ConfigName.PropertyConfig,
|
|
curEquipTreasureSefineFigData.Property[i][1])
|
|
if proConFig then
|
|
Util.GetGameObject(go.transform, "proName"):GetComponent("Text").text = GetLanguageStrById(proConFig
|
|
.Info)
|
|
if curEquipTreasureSefineFigData.Property[i][2] == 0 and proConFig.Style ~= 1 then
|
|
Util.GetGameObject(go.transform, "proVale"):GetComponent("Text").text = "+0%"
|
|
else
|
|
Util.GetGameObject(go.transform, "proVale"):GetComponent("Text").text = "+" ..
|
|
GetEquipPropertyFormatStr(proConFig.Style, curEquipTreasureSefineFigData.Property[i][2])
|
|
end
|
|
end
|
|
end
|
|
else
|
|
self.curotherProscroll:SetActive(false)
|
|
end
|
|
|
|
|
|
if self.jumpViewList and #self.jumpViewList > 0 then
|
|
for i = 1, #self.jumpViewList do
|
|
SubUIManager.Close(self.jumpViewList[i])
|
|
end
|
|
end
|
|
self.jumpViewList = {}
|
|
|
|
local curitemData = itemConfig
|
|
if curitemData and curitemData.Jump then
|
|
if curitemData.Jump and #curitemData.Jump > 0 then
|
|
for i = 1, #curitemData.Jump do
|
|
local temp = SubUIManager.Open(SubUIConfig.JumpView, self.getTuGrid.transform, curitemData.Jump[i])
|
|
table.insert(self.jumpViewList, temp)
|
|
end
|
|
end
|
|
end
|
|
self.equipProGridCom.spacing = 130
|
|
if self.jumpViewList and #self.jumpViewList then
|
|
self.getTuGrid:GetComponent("RectTransform").sizeDelta = Vector2.New(911.56,
|
|
self.equipProGridCom.spacing * (#self.jumpViewList))
|
|
end
|
|
|
|
local data = jewelConfig[sId]
|
|
self.curMainProText.text = string.format(Language[12220], lv, data.Max[1])
|
|
self.otherProText.text = string.format(Language[12221], refineLv, data.Max[2])
|
|
end
|
|
|
|
--道具 和 装备分解 发送请求后 回调
|
|
function RewardTalismanSingleShowPopup:SendBackResolveReCallBack(drop)
|
|
local isShowReward = false
|
|
if drop.itemlist ~= nil and #drop.itemlist > 0 then
|
|
for i = 1, #drop.itemlist do
|
|
if drop.itemlist[i].itemNum > 0 then
|
|
isShowReward = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
if isShowReward then
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1, function()
|
|
BagManager.OnShowTipDropNumZero(drop)
|
|
end)
|
|
else
|
|
BagManager.OnShowTipDropNumZero(drop)
|
|
end
|
|
EquipTreasureManager.RemoveTreasureByIdDyn(dId)
|
|
self:ClosePanel()
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:OnClose()
|
|
if self.jumpViewList and #self.jumpViewList > 0 then
|
|
for i = 1, #self.jumpViewList do
|
|
SubUIManager.Close(self.jumpViewList[i])
|
|
end
|
|
end
|
|
self.jumpViewList = {}
|
|
-- if func then
|
|
-- func()
|
|
-- end
|
|
func = nil
|
|
end
|
|
|
|
function RewardTalismanSingleShowPopup:GetStrongAndRefineConFig(curEuipTreaSureConfig, lv, rlv)
|
|
local curEquipTreasureStrongFigData = {}
|
|
local curEquipTreasureSefineFigData = {}
|
|
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.JewelRankupConfig)) do
|
|
--强化的属性
|
|
if configInfo.PoolID == curEuipTreaSureConfig.LevelupPool and configInfo.Type == 1 and configInfo.Level == lv then
|
|
curEquipTreasureStrongFigData = configInfo
|
|
end
|
|
--精炼的属性
|
|
if configInfo.PoolID == curEuipTreaSureConfig.RankupPool and configInfo.Type == 2 and configInfo.Level == rlv then
|
|
curEquipTreasureSefineFigData = configInfo
|
|
end
|
|
end
|
|
return curEquipTreasureStrongFigData, curEquipTreasureSefineFigData
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function RewardTalismanSingleShowPopup:OnDestroy()
|
|
self.spLoader:Destroy()
|
|
if self.jumpViewList and #self.jumpViewList > 0 then
|
|
for i = 1, #self.jumpViewList do
|
|
SubUIManager.Close(self.jumpViewList[i])
|
|
end
|
|
end
|
|
self.jumpViewList = {}
|
|
end
|
|
|
|
return RewardTalismanSingleShowPopup
|