local this = class("mapAreaBoundaryNode", require("ui.manager.map.node.mapNode"))
local _typeRect = typeof(C_RectTransform)
local _typeImg = typeof(C_LImage)
local PATH_AREABOUNDARYNODE = "UI/MapMask/MaskPrefab/pre_AreaBoundary.prefab"

function this:setShow(isShow)
end

function this:generate(parent, pool)
  self:_generate(parent, pool or L_ResPool)
end

function this:_generate(parent, pool)
  self.go = pool:syncGameObject(PATH_AREABOUNDARYNODE)
  self.trans = self.go:GetComponent(_typeRect)
  self.outLine = self.trans:Find("outline").gameObject:GetComponent(_typeImg)
  self.outLine_2 = self.trans:Find("outline2").gameObject:GetComponent(_typeImg)
  self.material = self.outLine.material
  self.material_2 = self.outLine_2.material
  if parent then
    self.trans:SetParent(parent)
    self.trans.offsetMin = C_Vector2(0, 0)
    self.trans.offsetMax = C_Vector2(0, 0)
    L_Vector3.setScale(self.trans, L_Vector3.getTemp(1, 1, 1))
    L_Vector3.setLocalPos(self.trans, L_Vector3.getTemp())
  end
  if not string.isEmpty(self.iconPath) then
    self.outLine:LoadSprite(self.iconPath, false)
    self.outLine_2:LoadSprite(self.iconPath, false)
  end
end

function this:refreshPosByMapData(mapData)
end

function this:refreshState(mapData)
  local percent = mapData:getPercent()
  local min, max = 1, math.min(1, mapData.minScale / mapData.maxScale * 2)
  local curScale = math.lerp(min, max, percent)
  self.material:SetFloat("_WidthScaler", curScale)
  self.material_2:SetFloat("_WidthScaler", curScale)
end

function this:refreshLockState()
end

function this:onDestroy()
  this.super.onDestroy(self)
end

return this
