2021-04-20 13:58:00 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
RewardSoulPrintSingleShowPopup = Inherit(BasePanel)
|
|
|
|
|
local type
|
|
|
|
|
local sId
|
|
|
|
|
local dataItem
|
|
|
|
|
local func
|
|
|
|
|
local dataShow = {}
|
|
|
|
|
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:InitComponent()
|
|
|
|
|
|
|
|
|
|
self.btnBack = Util.GetGameObject(self.transform, "Content/bg/btnBack")
|
|
|
|
|
self.curEquipName = Util.GetGameObject(self.transform, "Content/bg/Text"):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.qualityText = Util.GetGameObject(self.transform, "Content/bg/armorInfo/equipQuaText"):GetComponent("Text")
|
|
|
|
|
self.powerNum1 = Util.GetGameObject(self.transform, "Content/bg/armorInfo/powerNum"):GetComponent("Text")
|
|
|
|
|
self.level = Util.GetGameObject(self.transform, "Content/bg/armorInfo/resetLv"):GetComponent("Text")
|
|
|
|
|
self.curMainProscroll = Util.GetGameObject(self.transform, "Content/mainProScroll")
|
|
|
|
|
self.curMainProGrid = Util.GetGameObject(self.transform, "Content/mainProScroll/proGrid")
|
|
|
|
|
self.otherProPre = Util.GetGameObject(self.transform, "Content/proPre")
|
|
|
|
|
self.btnSure = Util.GetGameObject(self.transform, "Content/bg/btnSure")
|
|
|
|
|
self.getTuGrid = Util.GetGameObject(self.transform, "Content/bg/scroll/grid")
|
|
|
|
|
self.skillObject = Util.GetGameObject(self.transform, "Content/skillObject")
|
|
|
|
|
self.skillInfo = Util.GetGameObject(self.transform, "Content/skillObject/skillInfo")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(self.btnBack, function()
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.btnSure, function()
|
|
|
|
|
local curResolveAllItemList = {}
|
|
|
|
|
table.insert(curResolveAllItemList, sId)
|
|
|
|
|
local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. "isSoulPrintShowSure")
|
|
|
|
|
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
|
|
|
|
local haveHighQuality=false
|
|
|
|
|
if(SoulPrintManager.soulPrintData[sId].quality>=4) then
|
|
|
|
|
haveHighQuality=true
|
|
|
|
|
end
|
|
|
|
|
if (isPopUp ~= currentTime and haveHighQuality) then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
MsgPanel.ShowTwo(Language[11901], nil, function(isShow)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if (isShow) then
|
|
|
|
|
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
|
|
|
|
RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. "isSoulPrintShowSure", currentTime)
|
|
|
|
|
end
|
|
|
|
|
NetManager.UseAndPriceItemRequest(5, curResolveAllItemList, function(drop)
|
|
|
|
|
self:SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end, nil, nil, nil, true)
|
|
|
|
|
else
|
|
|
|
|
NetManager.UseAndPriceItemRequest(5, curResolveAllItemList, function(drop)
|
|
|
|
|
self:SendBackResolveReCallBack(drop)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:OnOpen(_type, _sId, _func)
|
|
|
|
|
type = _type
|
|
|
|
|
sId = _sId
|
|
|
|
|
func = _func
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:OnShow()
|
|
|
|
|
LogError("sId "..sId)
|
|
|
|
|
dataShow = BagManager.bagDatas[sId]
|
|
|
|
|
if type == 1 then
|
|
|
|
|
--for i, v in pairs(SoulPrintManager.GetBagShowData(SoulPrintManager.soulPrintData)) do
|
|
|
|
|
-- if (v.did == dId) then
|
|
|
|
|
-- dataShow = v
|
|
|
|
|
-- end
|
|
|
|
|
--end
|
|
|
|
|
self.btnSure:SetActive(true)
|
|
|
|
|
elseif type == 0 then
|
|
|
|
|
--for i, v in pairs(SoulPrintManager.GetBagShowData(SoulPrintManager.soulPrintDataAll)) do
|
|
|
|
|
-- if (v.did == dId) then
|
|
|
|
|
-- dataShow = v
|
|
|
|
|
-- end
|
|
|
|
|
--end
|
|
|
|
|
self.btnSure:SetActive(false)
|
|
|
|
|
elseif type == 2 then
|
|
|
|
|
--dataShow = SoulPrintManager.GetStaticBagShowData(dId, 1)
|
|
|
|
|
self.btnSure:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
self.btnSure:SetActive(false)
|
|
|
|
|
self:OnShowPanelData()
|
|
|
|
|
end
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:OnShowPanelData()
|
2021-01-26 17:08:39 +08:00
|
|
|
|
self.curEquipName.text = GetStringByEquipQua(dataShow.quality, GetLanguageStrById(dataShow.itemConfig.Name))
|
2021-03-02 16:53:12 +08:00
|
|
|
|
self.curEquipDesc1.text = Language[11902]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
self.curEquipFrame.sprite = Util.LoadSprite(GetQuantityImageByquality(dataShow.quality))
|
|
|
|
|
self.curEquipIcon.sprite = Util.LoadSprite(dataShow.icon)
|
|
|
|
|
self.qualityText.text = GetStringByEquipQua(dataShow.quality, GetQuaStringByEquipQua(dataShow.quality))
|
|
|
|
|
--self.level.text = "+" .. dataShow.level
|
|
|
|
|
if (type == 2) then
|
|
|
|
|
self.powerNum1.text = SoulPrintManager.CalculateStaticSoulPrintAddVal(sId)
|
|
|
|
|
else
|
|
|
|
|
self.powerNum1.text = SoulPrintManager.CalculateSoulPrintAddVal(sId)
|
|
|
|
|
end
|
|
|
|
|
--主属性
|
|
|
|
|
Util.ClearChild(self.curMainProGrid.transform)
|
|
|
|
|
if equipConfig[dataShow.id].Property and #equipConfig[dataShow.id].Property > 0 then
|
|
|
|
|
self.curMainProscroll:SetActive(true)
|
|
|
|
|
for i = 1, #equipConfig[dataShow.id].Property do
|
|
|
|
|
if equipConfig[dataShow.id].Property[i] and equipConfig[dataShow.id].Property[i][1] then
|
|
|
|
|
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, equipConfig[dataShow.id].Property[i][1])
|
|
|
|
|
if proConFig then
|
2021-01-26 17:08:39 +08:00
|
|
|
|
Util.GetGameObject(go.transform, "proName"):GetComponent("Text").text = GetLanguageStrById(proConFig.Info)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.GetGameObject(go.transform, "proVale"):GetComponent("Text").text = "+" .. GetEquipPropertyFormatStr(proConFig.Style, equipConfig[dataShow.id].Property[i][2])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.curMainProscroll:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--装备获得途径
|
|
|
|
|
Util.ClearChild(self.getTuGrid.transform)
|
|
|
|
|
local itemConfig = dataShow.itemConfig
|
|
|
|
|
local curitemData = itemConfig
|
|
|
|
|
if curitemData and curitemData.Jump then
|
|
|
|
|
if curitemData.Jump and #curitemData.Jump > 0 then
|
|
|
|
|
for i = 1, #curitemData.Jump do
|
|
|
|
|
SubUIManager.Open(SubUIConfig.JumpView, self.getTuGrid.transform, curitemData.Jump[i])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-15 16:52:35 +08:00
|
|
|
|
local isShow = equipConfig[dataShow.id] and equipConfig[dataShow.id].PassiveSkill and true
|
|
|
|
|
self.skillObject:SetActive(isShow)
|
|
|
|
|
if isShow then
|
|
|
|
|
local txt = ""
|
|
|
|
|
for index, pid in ipairs(equipConfig[dataShow.id].PassiveSkill) do
|
|
|
|
|
if index > 1 then
|
|
|
|
|
txt = txt .. ","
|
|
|
|
|
end
|
2021-01-26 17:08:39 +08:00
|
|
|
|
txt = txt .. GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, pid).Desc)
|
2020-05-15 16:52:35 +08:00
|
|
|
|
end
|
|
|
|
|
self.skillInfo:GetComponent("Text").text = txt
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--道具 和 装备分解 发送请求后 回调
|
|
|
|
|
function RewardSoulPrintSingleShowPopup: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
|
|
|
|
|
SoulPrintManager.RemoveSoulPrint({ sId })
|
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
func = nil
|
|
|
|
|
end
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:OnClose()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function RewardSoulPrintSingleShowPopup:OnDestroy()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return RewardSoulPrintSingleShowPopup
|