local this = class("pageHeroStarAdvanceSuccess", G_UIPageBase)

function this.bind()
  return {
    advance = {},
    cur = {},
    imgStar = "",
    txtDescribe = "",
    rTransStarPos = C_Vector2(0, 0)
  }
end

function this.methods()
  return {
    onClick_closeUpStarSucceed = function(self)
      if self.callback then
        self.callback()
      end
      L_UI:close(self.pageName)
    end
  }
end

function this:open(...)
end

function this:close()
end

function this:preOpen(options)
  self.heroId = options and options.heroId or 0
  self.describe = options and options.describe or ""
  self.callback = options and options.callback
  self:upStarSucceed()
end

function this:upStarSucceed()
  local hero = L_HeroStore:getHero(self.heroId)
  self.heroStar = L_HeroStore:getHeroStar(hero)
  self.bind.txtDescribe = self.describe
  self.bind.imgStar = "BSHeroStar/tex_herorankup_icon_0" .. self.heroStar
  self.bind.rTransStarPos = -C_Vector2(self.heroStar * 25.5 + 50, 0)
  self.bind.cur:clear()
  self.bind.advance:clear()
  for i = 1, self.heroStar do
    self.bind.advance:insert(i, {})
    if i < self.heroStar then
      self.bind.cur:insert(i, {})
    end
  end
end

return this
