local base = UIBaseContainer
local ParkourWinIconItemRender = BaseClass("ParkourWinIconItemRender", UIBaseContainer)
local Localization = CS.GameEntry.Localization

function ParkourWinIconItemRender:OnCreate()
  base.OnCreate(self)
  self:ComponentDefine()
  self:DataDefine()
end

function ParkourWinIconItemRender:OnDestroy()
  self:DataDestroy()
  self:ComponentDestroy()
  base.OnDestroy(self)
end

function ParkourWinIconItemRender:ComponentDefine()
  self.viewSkin = self:AddComponent(UIViewSkinBridge, "")
  self.imgIcon = self.viewSkin:AddComponent(self, UIImage, 1)
  self.killEff = self.viewSkin:AddComponent(self, UIBaseContainer, 2)
end

function ParkourWinIconItemRender:ComponentDestroy()
  self.viewSkin = nil
  self.imgIcon = nil
  self.killEff = nil
end

function ParkourWinIconItemRender:DataDefine()
  self.winType = nil
  self.winType2Index = nil
end

function ParkourWinIconItemRender:DataDestroy()
  self.winType = nil
  self.winType2Index = nil
end

function ParkourWinIconItemRender:OnAddListener()
  base.OnAddListener(self)
end

function ParkourWinIconItemRender:OnRemoveListener()
  base.OnRemoveListener(self)
end

function ParkourWinIconItemRender:InitData(icon, winType, winType2Index)
  self.imgIcon:LoadSprite(icon)
  self.imgIcon:SetNativeSize()
  self.winType = winType
  self.winType2Index = winType2Index
  self.killEff:SetActive(false)
end

function ParkourWinIconItemRender:RefreshKillEffectShowState(targetWinType, targetWinType2Index)
  if targetWinType == self.winType and targetWinType2Index == self.winType2Index then
    self.killEff:SetActive(true)
  end
end

return ParkourWinIconItemRender
