local this = class("simpleMapPainter", require("ui.manager.map.painter.mapPainter"))
local _areaTpl = L_GameTpl:getWorldAreaTpl()
local PATH_PAINTER = "Program/Map/pre_mapPainter.prefab"

function this:ctor(...)
  this.super.ctor(self, ...)
  self.imgMap = nil
end

function this:paint(container)
  if self.imgMap == nil then
    local go = L_ResPool:syncGameObject(PATH_PAINTER)
    go.transform:Reset(container, true)
    go.transform:SetAsFirstSibling()
    self.imgMap = {
      paintGo = go,
      rTrans = go:GetComponent(typeof(C_RectTransform)),
      img = go:GetComponent(typeof(C_LImage))
    }
  end
  L_Vector3.setUISize(container, self.mapData.imgSize)
  local areaId = self.mapData.areaId
  local tpl = _areaTpl:getTplById(areaId)
  local sp = _areaTpl:getAreaMap(tpl)
  self.imgMap.img:LoadSprite(sp, false)
  self.imgMap.img:SetNativeSize()
end

function this:removePaint()
  if self.imgMap ~= nil and self.imgMap.paintGo ~= nil then
    C_GameObject.Destroy(self.imgMap.paintGo)
    self.imgMap = nil
  end
end

return this
