local this = class("cameraController_battle", require("ui.manager.camera.controller.cameraController"))

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

function this:switchIn(preMode, params)
  if self.virCamera then
    local goVir = self.virCamera.gameObject
    goVir:ActiveTrans(true)
    if params.povH and params.povV then
      self.cameraTactics:SetCameraPOVHV(params.povH, params.povV)
    end
  else
    self:initVirCamera()
  end
end

function this:switchOut(nextMode)
  if self.virCamera then
    self.virCamera.gameObject:ActiveTrans(false)
  end
end

function this:initVirCamera()
  local goVirCam = L_GameUtil.loadVirtualCamera(nil, "Program/Camera/pre_worldVirtualCamera.prefab")
  self.virCamera = goVirCam:GetComponent(typeof(C_CinemachineVirtualCamera))
  self.fixedFollow = goVirCam:GetComponent(typeof(C_CameraFixedFollow))
  self.cameraTactics = C_CameraManager.create(goVirCam)
  C_CameraManager.ChangeCamera(self.cameraTactics, C_CinemachineBlendType.Cut)
  self:setCameraSpeed()
  self:refreshSoftCamera()
end

function this:setCameraSpeed()
  local speed = L_SettingStore:getSetData(L_Const.settingType.cameraSpeed)
  self.cameraTactics:SetCameraSpeed(tonumber(speed))
end

return this
