local this = class("cameraController_story", require("ui.manager.camera.controller.cameraController"))
local PATH_CAMERA = "Program/Camera/pre_CinemachineVirtualStoryCamera.prefab"

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

function this:switchIn(preMode)
  self.cameraTactics = C_CameraManager.CreateStoryTactics()
  self.cameraTactics:SetEnabled(true)
end

function this:getVirCamera()
  if self.cameraTactics then
    return self.cameraTactics.cineMachineCamera
  end
end

function this:switchOut(nextMode)
  self.cameraTactics:SetEnabled(false)
end

function this:onDestroy()
  self.cameraTactics:Dispose()
  C_CameraManager.RemoveTactics(self.cameraTactics)
  if L_CommonUtil.isValid(self.goVirCam) then
    C_GameObject.Destroy(self.goVirCam)
  end
  self.goVirCam = nil
end

function this:setCameraActive(isActive)
  self.cameraTactics:SetCameraActive(isActive)
end

function this:setCameraPosQua(pos, qua)
  self.cameraTactics:SetCameraPosQua(Unity.Vector3(pos.x, pos.y, pos.z), Unity.Quaternion(qua.x, qua.y, qua.z, qua.w))
end

function this:setCameraFov(fov)
  self.cameraTactics:SetCameraFov(fov)
end

function this:setBlendStyle(style, time)
  C_CameraManager.SetBrainBlendStyle(style)
  C_CameraManager.SetBrainBlendTime(time / 1000)
end

function this:setCameraPos(pos)
  self.cameraTactics:SetCameraPos(Unity.Vector3(pos.x, pos.y, pos.z))
end

function this:setCameraEuler(euler)
  self.cameraTactics:SetCameraEuler(Unity.Vector3(euler.x, euler.y, euler.z))
end

function this:setCameraQua(euler)
  self.cameraTactics:SetCameraQua(Unity.Quaternion.Euler(euler.x, euler.y, euler.z))
end

function this:getCameraPos()
  return self.cameraTactics:GetCameraPos()
end

function this:getCameraEuler()
  return self.cameraTactics:GetCameraEuler()
end

function this:getCameraQua()
  return self.cameraTactics:GetCameraQua()
end

function this:getPovHV()
  return self.cameraTactics:GetCameraPovH(), self.cameraTactics:GetCameraPovV()
end

function this:setTargetPosQua(pos, qua, duration, style, callback)
  self.cameraTactics:SetTargetPosQua(pos, qua, duration, style, callback)
end

function this:getCameraTransform()
  return self.cameraTactics.transform
end

return this
