local LoadingMediator = {}
local this = LoadingMediator
local _adapter = CS.Azur.Gameplay.Flows.LoadingAdapter

function this.beforeCutWorld(nextWorldId)
  L_SceneManager:sendEvent(L_SceneManager.event.switchSceneStart, nextWorldId)
end

function this.beforeClearScene()
  L_SceneManager:sendEvent(L_SceneManager.event.unloadSceneStart)
end

function this.onScenePrepared(nextWorldId)
  L_SceneManager:sendEvent(L_SceneManager.event.loadSceneEnd, nextWorldId)
end

function this.onCutComplete(sceneId)
  L_BattleDataManager:resetPlayerBattleState()
  L_SceneManager:sendEvent(L_SceneManager.event.switchSceneEnd, sceneId)
end

function this.setLoadingUIVisible(visible, modType)
  if visible then
    local options = {}
    options.mode = L_Const.loadingShowType[modType]
    L_LoadingManager:openLoading(options)
  else
    L_LoadingManager:closeLoading()
  end
end

function this.syncLoadingProgress(progress)
  L_LoadingManager:sendOnLoadProcess({progress = progress})
end

function this.refreshProxy(module)
  L_WorldManager.handleCenter:refreshPrxoy(module)
end

function this.setCameraPos(sceneId)
  local module = L_WorldManager:getCurModule()
  local pos, rot = L_EntityDataManager:generateMainControlBirth(module, sceneId)
  L_CameraManager:bindPoint(pos, rot)
end

function this.transmitSceneStart(sceneId)
  L_SceneManager:sendEvent(L_SceneManager.event.transmitSceneStart, sceneId)
end

function this.transmitSceneEnd(sceneId)
  L_SceneManager:sendEvent(L_SceneManager.event.transmitSceneEnd, sceneId)
end

function this.newTransfer(pos, rot)
  L_PlayerManager:newTransfer(pos, rot)
end

_adapter.SetLuaMediator(this)
return LoadingMediator
