166 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			Lua
		
	
			
		
		
	
	
			166 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			Lua
		
	
require("Base/BasePanel")
 | 
						|
local RewardTailsmanChipShowPopup = Inherit(BasePanel)
 | 
						|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
 | 
						|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
 | 
						|
local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
 | 
						|
local _BaseProList = {}--基础属性对象
 | 
						|
 | 
						|
--初始化组件(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:InitComponent()
 | 
						|
    self.spLoader = SpriteLoader.New()
 | 
						|
    self.mask = Util.GetGameObject(self.transform, "mask")
 | 
						|
    self.content = Util.GetGameObject(self.transform, "Content")
 | 
						|
    --装备详情--topBar
 | 
						|
    self.topBar = Util.GetGameObject(self.transform, "Content/topBar")
 | 
						|
    self.eqiopName = Util.GetGameObject(self.topBar, "name"):GetComponent("Text")
 | 
						|
    self.icon = Util.GetGameObject(self.topBar, "icon"):GetComponent("Image")
 | 
						|
    self.frame = Util.GetGameObject(self.topBar, "frame"):GetComponent("Image")
 | 
						|
    self.equipType=Util.GetGameObject(self.topBar, "equipType"):GetComponent("Text")
 | 
						|
    self.equipQuaText=Util.GetGameObject(self.topBar, "equipQuaText"):GetComponent("Text")
 | 
						|
    self.equipInfoText=Util.GetGameObject(self.topBar, "equipInfoText"):GetComponent("Text")
 | 
						|
    self.effectbaijin = Util.GetGameObject(self.topBar, "fx_zhuangbeijiemian")
 | 
						|
    --装备属性--midBar
 | 
						|
    --basePro
 | 
						|
    self.midBar = Util.GetGameObject(self.transform, "Content/midBar")
 | 
						|
    self.basePro = Util.GetGameObject(self.midBar, "basePro")
 | 
						|
    self.baseProName = Util.GetGameObject(self.basePro, "PropertyName"):GetComponent("Text")
 | 
						|
    self.baseProGrid = Util.GetGameObject(self.basePro, "grid")
 | 
						|
    self.baseProPre = Util.GetGameObject(self.basePro, "grid/curProName")
 | 
						|
    self.baseProPre:SetActive(false)
 | 
						|
    --superPro
 | 
						|
    self.superPro = Util.GetGameObject(self.midBar, "superPro")
 | 
						|
    self.superProGrid = Util.GetGameObject(self.superPro, "proGrid")
 | 
						|
    self.superProPre = Util.GetGameObject(self.superPro, "proGrid/Desc")
 | 
						|
 | 
						|
    --装备获取途径--btmBar
 | 
						|
    self.btmBar = Util.GetGameObject(self.transform, "Content/btmBar/howGet")
 | 
						|
    self.canGetPre = Util.GetGameObject(self.btmBar, "scroll/canGetPre")
 | 
						|
    self.canGetGrid = Util.GetGameObject(self.btmBar, "scroll")
 | 
						|
    self.canGetScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.canGetGrid.transform,self.canGetPre, nil,
 | 
						|
    Vector2.New(self.canGetGrid.transform.rect.width, self.canGetGrid.transform.rect.height), 1, 1, Vector2.New(0, 0))
 | 
						|
    self.canGetScrollView.moveTween.MomentumAmount = 1
 | 
						|
    self.canGetScrollView.moveTween.Strength = 2
 | 
						|
    self.canGetScrollView.elastic = false
 | 
						|
    self.jumpViewList = {}
 | 
						|
end
 | 
						|
 | 
						|
--绑定事件(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:BindEvent()
 | 
						|
    Util.AddClick(self.mask, function()
 | 
						|
        PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
 | 
						|
        self:ClosePanel()
 | 
						|
    end)
 | 
						|
end
 | 
						|
 | 
						|
--添加事件监听(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:AddListener()
 | 
						|
 | 
						|
end
 | 
						|
 | 
						|
--移除事件监听(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:RemoveListener()
 | 
						|
 | 
						|
end
 | 
						|
 | 
						|
--界面打开时调用(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:OnOpen(_cardId,_cardLv,_cardStar)
 | 
						|
    self.cardItemId = _cardId    --化身卡道具id
 | 
						|
    self.level=0
 | 
						|
    self.star=0
 | 
						|
    if _cardLv then
 | 
						|
        self.level = _cardLv    --化身卡等级
 | 
						|
    end
 | 
						|
    if _cardStar then
 | 
						|
        self.star = _cardStar    --化身卡星级
 | 
						|
    end
 | 
						|
    
 | 
						|
end
 | 
						|
 | 
						|
function RewardTailsmanChipShowPopup:OnShow()
 | 
						|
    local itemData = itemConfig[tonumber(self.cardItemId)]
 | 
						|
    local cardId=ConfigManager.GetConfigDataByKey(ConfigName.ChangingCard,"CardId",self.cardItemId).Id
 | 
						|
    local proDatas = IncarnationManager.GetChangeCardPropertyAdd(cardId,self.level,self.star)
 | 
						|
    
 | 
						|
    self.topBar:GetComponent("Image").sprite = self.spLoader:LoadSprite("t_tongyong_di_"..itemData.Quantity)
 | 
						|
 | 
						|
    self.equipQuaText.text=GetStringByEquipQua(itemData.Quantity,GetQuaStringByEquipQua(itemData.Quantity))
 | 
						|
    self.eqiopName.text=GetStringByEquipQua(itemData.Quantity,GetLanguageStrById(itemData.Name))
 | 
						|
    self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemData.Quantity))
 | 
						|
    self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemData.ResourceID))
 | 
						|
    self.equipInfoText.text = GetLanguageStrById(itemData.ItemDescribe)
 | 
						|
    self.equipType.text = ""
 | 
						|
 | 
						|
    --下部按钮信息
 | 
						|
    self.effectbaijin:SetActive(itemData.Quantity==7)
 | 
						|
    Util.SetParticleSortLayer(self.effectbaijin,self.sortingOrder + 1)
 | 
						|
   
 | 
						|
    --basePro基础属性
 | 
						|
    if proDatas then
 | 
						|
        self.basePro:SetActive(true)
 | 
						|
        for _, pro in ipairs(_BaseProList) do
 | 
						|
            pro:SetActive(false)
 | 
						|
        end
 | 
						|
        for index, prop in ipairs(proDatas) do
 | 
						|
            local proConfigData = propertyConfig[index]
 | 
						|
            if proConfigData then
 | 
						|
                if not _BaseProList[index] then
 | 
						|
                    _BaseProList[index] = newObjToParent(self.baseProPre, self.baseProGrid)
 | 
						|
                end
 | 
						|
                _BaseProList[index]:SetActive(true)
 | 
						|
                _BaseProList[index]:GetComponent("Text").text = GetLanguageStrById(proConfigData.Info)
 | 
						|
                local vText = Util.GetGameObject(_BaseProList[index], "curProVale"):GetComponent("Text")
 | 
						|
                if prop > 0 then
 | 
						|
                    vText.text = "+"..GetPropertyFormatStr(proConfigData.Style, prop)
 | 
						|
                else
 | 
						|
                    vText.text = GetPropertyFormatStr(proConfigData.Style, prop)
 | 
						|
                end
 | 
						|
            end
 | 
						|
        end
 | 
						|
    else
 | 
						|
        self.basePro:SetActive(false)
 | 
						|
    end
 | 
						|
    self.superProPre:GetComponent("Text").text = IncarnationManager.GetSkillDesStr(cardId,self.star)
 | 
						|
 | 
						|
    --获取途径
 | 
						|
    if self.jumpViewList and #self.jumpViewList > 0 then
 | 
						|
        for i = 1,#self.jumpViewList do
 | 
						|
            SubUIManager.Close(self.jumpViewList[i])
 | 
						|
        end
 | 
						|
    end
 | 
						|
 | 
						|
    if itemData and itemData.Jump then
 | 
						|
        if itemData.Jump and #itemData.Jump>0 then
 | 
						|
            self.canGetScrollView:SetData(itemData.Jump,function (index, item)
 | 
						|
                local tempView = nil
 | 
						|
                if self.isShowGo then
 | 
						|
                    tempView = SubUIManager.Open(SubUIConfig.JumpView, item.transform, itemData.Jump[index],true)
 | 
						|
                else
 | 
						|
                    tempView = SubUIManager.Open(SubUIConfig.JumpView, item.transform, itemData.Jump[index],false)
 | 
						|
                end
 | 
						|
                table.insert(self.jumpViewList,tempView)
 | 
						|
            end,true,true)
 | 
						|
        end
 | 
						|
    end
 | 
						|
 | 
						|
 | 
						|
    --(此处需要三遍才能完全打开)
 | 
						|
    ForceRebuildLayout(self.midBar.transform)
 | 
						|
    ForceRebuildLayout(self.midBar.transform)
 | 
						|
    ForceRebuildLayout(self.midBar.transform)
 | 
						|
end
 | 
						|
 | 
						|
--界面关闭时调用(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:OnClose()
 | 
						|
    for i = 1, #self.jumpViewList do
 | 
						|
        destroy(self.jumpViewList[i].gameObject)
 | 
						|
    end
 | 
						|
end
 | 
						|
 | 
						|
--界面销毁时调用(用于子类重写)
 | 
						|
function RewardTailsmanChipShowPopup:OnDestroy()
 | 
						|
    self.spLoader:Destroy()
 | 
						|
    _BaseProList = {}
 | 
						|
    self.jumpViewList = {}
 | 
						|
end
 | 
						|
 | 
						|
return RewardTailsmanChipShowPopup |