local this = class("homeTileTpl")

function this:init()
  self.dic = {}
end

function this:getTplById(tileId)
  local cfg = self.dic[tileId]
  if cfg == nil then
    local path = string.format("Config/World/Home/home_editor_%s.bytes", tileId)
    cfg = L_CommonUtil.getTextToLua(path)
    self.dic[tileId] = self:initCfg(cfg)
  end
  return cfg
end

function this:initCfg(cfg)
  return cfg
end

function this:getGridSize(tpl)
  return tpl and tpl.size or 1
end

function this:getOffsetPos(tpl)
  local offset = C_Vector3(tpl.offset.x, tpl.offset.y, tpl.offset.z)
  return offset
end

function this:getOffsetRot(tpl)
  local rot = C_Vector3(tpl.rot.x, tpl.rot.y, tpl.rot.z)
  return rot
end

function this:getWidth(tpl)
  if tpl then
    return tpl.width
  end
end

function this:getHeight(tpl)
  if tpl then
    return tpl.height
  end
end

function this:getBuildTileList(tpl)
  if tpl then
    return tpl.map
  end
end

function this:getBanTileList(tpl)
  if tpl then
    return tpl.banMap
  end
end

function this:getCropTileList(tpl)
  if tpl then
    return tpl.cropMap
  end
end

function this:getCropEdgeTileList(tpl)
  if tpl then
    return tpl.cropEdgeMap
  end
end

function this:getRanchTileList(tpl)
  if tpl then
    return tpl.ranchMap
  end
end

return this
