---
--- Generated manually.
--- Created by gyz.
--- DateTime: 2020-6-30 10:30:29
---

local LGameStateManager = ImportScript("ugc_common/script/core/game_state/game_state_manager.lua")

local LMobileGameStateManager = LMobileGameStateManager or class("LMobileGameStateManager");

function LMobileGameStateManager:ctor()
    
end

function LMobileGameStateManager:dtor()
    
end

function LMobileGameStateManager:Init()
    LOG_I("[LMobileGameStateManager:Init]");
    self.onGameStart(self);
    --g_EventDispatcherManager:AddEventListener("game_state", "start", self.onGameStart, self);
    --g_EventDispatcherManager:AddEventListener("game_state", "end", self.onGameEnd, self);
end

function LMobileGameStateManager:UnInit()
    LOG_I("[LMobileGameStateManager:UnInit]");
    self.onGameEnd(self);
    --g_EventDispatcherManager:RemoveEventListener("game_state", "start", self.onGameStart, self);
    --g_EventDispatcherManager:RemoveEventListener("game_state", "end", self.onGameEnd, self);
end

function LMobileGameStateManager:GameTick()
    --
end

function LMobileGameStateManager:onGameStart()
    local bRetCode = g_SceneManager:BrowseMapByResPath("data/source/maps/miniscene角色光照/miniscene角色光照.jsonmap");
    LOG_I("[LGameStateManager:onGameStart] browse map ", bRetCode);
    if not bRetCode then
       return;
    end

    local lLocalPlayer = g_RoleListManager:GetDefaultActor();
    lLocalPlayer:AddModelToScene()
    lLocalPlayer:SetWorldPosition(0, 0, 0);

    g_CameraController:ResetCamera();

    --miniscene
    g_SceneManager:CreateMiniScene("data/source/maps/miniscene角色光照/miniscene角色光照.jsonmap");
    g_CameraController:SetFovAngleY_MiniScene(55.0);
    g_CameraController:SetAspectRatio_MiniScene(16.0 / 9.0);
    g_CameraController:SetNearPlane_MiniScene(50.0);
    g_CameraController:SetFarPlane_MiniScene(100000.0);

    g_CameraController:SetPosition_MiniScene(0, 100, -210);
    g_CameraController:SetLookDir_MiniScene(0, 100, 0);
    g_CameraController:SetUpDir_MiniScene(0, 1, 0);

    g_SchoolRoleListCfg:InitAniTable();
end

function LMobileGameStateManager:onGameEnd()
    g_ActorManager:DestroyAllActor();
    local bRetCode = g_SceneManager:DestroyCurMap();
    LOG_I("[LGameStateManager:onGameEnd] DestroyAllActor");
    LOG_I("[LMobileGameStateManager:onGameEnd]", bRetCode);
end

_G.g_GameStateManager = LMobileGameStateManager:new();

